๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #26279

Re: [PATCH net v3 1/4] net: netcp: do not disable interrupts in the VLAN callbacks

#26279
From: netdev-bot+sashiko
Date: Thu, 03 Dec 2026 10:57
120 lines
12692 bytes
Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] The stable tagging and changelog of this patch leave out its real
  reason for existing.

Pre-existing issues:
- [Low] The comment on struct netcp_intf::lock in
  drivers/net/ethernet/ti/netcp.h:117 ("Lock used for protecting Rx/Txโ€ฆ

--

net: netcp: do not disable interrupts in the VLAN callbacks

This commit changes netcp_rx_add_vid() and netcp_rx_kill_vid() to take
netcp->lock with spin_lock_bh() instead of spin_lock_irqsave(). With this
change, the ALE table scans in cpsw_ale_add_vlan() and cpsw_ale_del_vlan()
no longer run with hard interrupts disabled. The changelog also calls it a
prerequisite for the next patch, which adds a BH lock in the ALE library.

> Use spin_lock_bh() instead. This keeps the exclusion against
> netcp_set_rx_mode() and does not disable hard interrupts. It is also a
> prerequisite for the next patch, which takes a lock in the ALE library
> with spin_lock_bh(), so that no caller holds off interrupts while it
> scans the table.

[ ... ]

> Cc: stable@vger.kernel.org
> Signed-off-by: Manuel Janocha <manuel.janocha@amperfied.com>

[Severity: Low]
This patch is tagged for stable but has no Fixes: tag, and "the next patch"
is not named. Should the changelog state the correctness dependency more
directly?

The later patch in the series, "net: ethernet: ti: cpsw_ale: serialize ALE
table accesses", makes cpsw_ale_add_vlan() and cpsw_ale_del_vlan() take
ale->lock with spin_lock_bh(). Those functions are reached with netcp->lock
held:

netcp_rx_add_vid()
    spin_lock_irqsave(&netcp->lock, flags);   <- before this patch
    module->add_vid()
        gbe_add_vid()
            cpsw_ale_add_vlan()
                spin_lock_bh(&ale->lock);
                ...
                spin_unlock_bh(&ale->lock);

The same applies to netcp_rx_kill_vid()->gbe_del_vid()->cpsw_ale_del_vlan().

If the ALE patch is backported without this one, spin_unlock_bh() runs with
hard IRQs disabled. That trips lockdep_assert_irqs_enabled() in
__local_bh_enable_ip(), and pending softirqs can run inside the IRQs-off
region.

The changelog presents this only as an interrupt latency improvement. Could
it say that the ALE locking patch needs this one to be correct, and name
that patch? Should it also carry a Fixes: tag matching that patch (which
targets 1767bb2d47b7), so stable backporters pick up both together?

For reference, the irqsave in these callbacks came from 8ceaf361ffd131
("net: netcp: fix deadlock reported by lockup detector"). Before that,
84640e27f230 used mutex_lock() here.

> diff --git a/drivers/net/ethernet/ti/netcp_core.c b/drivers/net/ethernet/ti/netcp_core.c
> index f5e093dc983b5..09fa4c7321554 100644
> --- a/drivers/net/ethernet/ti/netcp_core.c
> +++ b/drivers/net/ethernet/ti/netcp_core.c
> @@ -1881,12 +1881,11 @@ static int netcp_rx_add_vid(struct net_device *ndev, __be16 proto, u16 vid)
>  	struct netcp_intf *netcp = netdev_priv(ndev);
>  	struct netcp_intf_modpriv *intf_modpriv;
>  	struct netcp_module *module;
> -	unsigned long flags;
>  	int err = 0;
>  
>  	dev_dbg(netcp->ndev_dev, "adding rx vlan id: %d\n", vid);
>  
> -	spin_lock_irqsave(&netcp->lock, flags);
> +	spin_lock_bh(&netcp->lock);
>  	for_each_module(netcp, intf_modpriv) {

[Severity: Low]
This is a pre-existing issue and was not introduced by this patch. The
comment on the lock in struct netcp_intf in drivers/net/ethernet/ti/netcp.h
says:

	/* Lock used for protecting Rx/Tx hook list management */
	spinlock_t		lock;

The lock is also used for other things:

  - netcp_set_rx_mode() takes it around the addr_list mark/sweep.
  - netcp_rx_add_vid() and netcp_rx_kill_vid() take it around the
    module_head walk and the add_vid/del_vid callbacks.

The code that changes module_head does not take netcp->lock. That includes
the list_add_tail() in netcp_module_probe() and the
list_for_each_entry_safe() removal loops in netcp_release_module() and
netcp_delete_interface().

The changelog gives a third description, "The lock only protects the module
list walk".

Would it be worth updating the comment in netcp.h to describe what
netcp->lock actually serializes? The mismatch dates back to 8ceaf361ffd131,
and it does not affect whether the conversion to the bh variant is correct.

>  		module = intf_modpriv->netcp_module;
>  		if ((module->add_vid) && (vid != 0)) {

[ ... ]

-- 
Sashiko AI review ยท https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261202-cpsw-ale-lock-v3-0-b40dc361d6b9%40amperfied.com
Technical Details
Message-ID: <179629543648.3146.13965202360925036247@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376490-linux-kernel-netdev=dewy.ru
References: <20261202-cpsw-ale-lock-v3-1-b40dc361d6b9@amperfied.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu.MISMATCH!feed-us-txt.newsdeef.eu!feed-us-ny.newsdeef.eu!srv.newsdeef.eu!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-376490-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net v3 1/4] net: netcp: do not disable interrupts in the
 VLAN callbacks
Date: Thu, 03 Dec 2026 10:57:16 +0000
Organization: Usenet Network
Message-ID: <179629543648.3146.13965202360925036247@kernel.org>
References: <20261202-cpsw-ale-lock-v3-1-b40dc361d6b9@amperfied.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2464942"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:P4hbrLzvkkxr+cshYeb2mXksueY= sha256:6ck5oah5WSEZ7bQM5Vo4EsjXCsk3wuNO/skYT+/xdSk=
	sha1:XVWnnABgtkQarltocf/z42t/dE0= sha256:GdofVffjY/QjXUBmvk8h2t0Ao2KZaste4evXZ0tlTFc=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 9BAB31178D9; Thu,  3 Dec 2026 13:57:43 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.64
X-Spam-Status: No, score=-3.64 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.24, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id YydDN9bILRPo;
	Thu,  3 Dec 2026 13:57:40 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=netdev+bounces-376490-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id F407E1178D2; Thu,  3 Dec 2026 13:57:31 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id C8EBE2BC5B; Thu,  3 Dec 2026 10:57:19 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1796295439;
	b=zkTFZxaxA9aGWw/4iVRiZq06BH/Lf4RX1eiZL+4g2L94/NLVSEeIQ9GHayprBCzerAPg
	 uPZnfLC3uRIw1SLijwDC18XIDvQw0zYUMpbVrIgx4OPUD//1oX+dXcj101sQuM92TwSJd
	 d2MBQgaIiE0yCFM/zWAs4tK/nTaJYLMG+cU7FVAo63GMYcJV5e+VMl5SjSlxnFR2wdIYb
	 3HAy2IM7FsqKvdhvdumwCxHsm6VKjGCkFlwa3/fyRa23xcn/ClQQJgsFzBxRBZZMJa41I
	 lZ33YZWIvuqeag7jCXrOR4UelZI4L3Ya4LG3K8tMmcYsdPYytsSM0HUNHTuaOTUxuzw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796295439;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=O5d9gBcuk+4aF7PkT9OHDFBF2TlP99/hfR6MyA4KvMA=;
	b=gYCfRPIuwakce4+/lA/1UMDQ8rDGY8sPSHmB3y5kIpU9YfuInV10LccgdOS0kf5Ggj8P
	 k+kSyemOGU9Ddn8yhHzSsFpVk2RA8IBPyxKvOThpq3F6QUuUP155GCeiCVyAqNQP+P+PN
	 lWTn5ao5KII54ig4ZMdT45hfbH4I8oe0XGCtZPD1MnWZqn4KWN5G9FVI6KYYkAfJMZMHP
	 l9PmezpigNP/B2tL/ESdtjxydlZOf36+PvabhWANTDLMHo8EZuFQ7yQkO34M0kZSFtc0Z
	 ZWnIFsOI/DyYi3GZQfsArD95xz4FTI/Vtuaqaw8/slrJCaSElveZjKfIP+W2pP2Dw2w==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hc1PXppI;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id E1735606A32C;
	Thu,  3 Dec 2026 10:57:18 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hc1PXppI
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1796295438;
	b=KJHxy7UnIs5gMFgyBgkyqsyUoG8Ozt2y8QmMDtAF8yCNuK5CpQFp0IxQYjtKrZXB+3c0
	 oJH7g9psc/D1cJEKztuwA5O7Ziw9cimMhwhrCVBGvIJq8gMlZse+9cg/+OL+J0f6/2ptJ
	 zOheWPcDgeQdBhZSKdmT4RHw35V8gUAOWVMyclzec4TAdzAJBMk7c7zryy9bIE4xAmKtU
	 eqefghWF6GSacTOs3yI82iNeX0puYgI6JXib8sDhVA69mCpAzrbCP5QFGZnj9xr/I/aJN
	 /ZJRcp0Jw4UaeA2ACh16Wd+LBCeBY3hhOipukJia/9gRhxYQ9teUu3TMo++u7iE1NOw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1796295438;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=O5d9gBcuk+4aF7PkT9OHDFBF2TlP99/hfR6MyA4KvMA=;
	b=mSkR1Fg2yfgP51okO9teZG+2ozTioBGIhK0wZj4YtashngYjoCxVF1yqMhCDrOO/Rgnz
	 +v3kMBquyJ/u4nDp4cmuIXAWW05NULPTom/kpSYidp/3uLCMWeyq2d7h+beRIKKlO+ddS
	 OOw8axy5cWIYBTMinofVMl2QDa5d/gBNccR0AHz+ltF83rzQm4dL6VW1mdbzeECa/FgA6
	 +tPWyeoDDM85dLSAUnsNFmA0zvEoSbnBa9nfiZHOGUjx/HEDj0Q7GRf+2J5TpxvPvZOEI
	 lozHmDDCeMeZJDw6vkAibK+Ut5fep7Vr1nhwM3VfhxxC7OtElEYc2OKGPFfq/OkJyDQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=hc1PXppI;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 10896606A33B;
	Thu,  3 Dec 2026 10:57:17 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id EF8EB1F000C1;
	Thu,  3 Dec 2026 10:57:16 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1796295437;
	bh=O5d9gBcuk+4aF7PkT9OHDFBF2TlP99/hfR6MyA4KvMA=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=hc1PXppIi0vevWNl0ovKqb/JOVyp9MQTTFVO3x4uEVmELSUad9MZbAU6oQdjbWDX/
	 gC0RyZefbxqwZJnbpqM5+y/wdDzWo0dS0s0SLKIfaEiVSNDiB1YxcNBo/DKYN6RADh
	 dGMBqmGynv5gHCR3OcrkMl4yW0vWXs2I5N+Y1ADvc1kgYgdmS/lk5j4SNwDVxPxyOo
	 WCHUerJLKJH/tx4ixdrrcPXqGf0gyLGyQrdZe1LvifIb03KTCB7J64BtW6vcQmk00N
	 HzSrU2Ryc+DmyO86+n1Kcz5SLts22lFIZHyzqCtbD4dG5TryENgAfbS3gfz+2hiYhI
	 GiDOIxxQ4/pEw==
X-Cc: s-vadapalli@ti.com, rogerq@kernel.org, andrew+netdev@lunn.ch,
 davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org, pabeni@redhat.com,
 vigneshr@ti.com, linux-omap@vger.kernel.org, netdev@vger.kernel.org,
 kuniyu@google.com
X-In-Reply-To: <20261202-cpsw-ale-lock-v3-1-b40dc361d6b9@amperfied.com>
X-sashiko-severity: Low
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list