Netdev List
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: manuel.janocha@amperfied.com
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
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	[thread overview]
Message-ID: <179629543648.3146.13965202360925036247@kernel.org> (raw)
In-Reply-To: <20261202-cpsw-ale-lock-v3-1-b40dc361d6b9@amperfied.com>

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

  reply	other threads:[~2026-12-03 10:57 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02 10:29 [PATCH net v3 0/4] net: ethernet: ti: cpsw_ale: fix lost ALE entries Manuel Janocha via B4 Relay
2026-12-02 10:29 ` [PATCH net v3 1/4] net: netcp: do not disable interrupts in the VLAN callbacks Manuel Janocha via B4 Relay
2026-12-03 10:57   ` netdev-bot+sashiko [this message]
2026-12-02 10:29 ` [PATCH net v3 2/4] net: ethernet: ti: cpsw_ale: serialize ALE table accesses Manuel Janocha via B4 Relay
2026-12-03 10:57   ` netdev-bot+sashiko
2026-12-02 10:29 ` [PATCH net v3 3/4] net: ethernet: ti: cpsw_ale: serialize control register updates Manuel Janocha via B4 Relay
2026-12-02 10:29 ` [PATCH net v3 4/4] net: ethernet: ti: cpsw_ale: verify ALE table reads Manuel Janocha via B4 Relay
2026-12-03 10:57   ` netdev-bot+sashiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=179629543648.3146.13965202360925036247@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=manuel.janocha@amperfied.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rogerq@kernel.org \
    --cc=s-vadapalli@ti.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox