[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0063ca98-93c2-4df4-9c0a-7a145e5409ee@redhat.com>
Date: Wed, 19 Mar 2025 13:59:47 +0100
From: Paolo Abeni <pabeni@...hat.com>
To: netdev@...r.kernel.org
Cc: Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
<davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
Jakub Kicinski <kuba@...nel.org>, Simon Horman <horms@...nel.org>,
Sabrina Dubroca <sd@...asysnail.net>
Subject: Re: [PATCH v2] net: introduce per netns packet chains
On 3/18/25 7:03 PM, Paolo Abeni wrote:
> @@ -2463,16 +2477,18 @@ static inline bool skb_loop_sk(struct packet_type *ptype, struct sk_buff *skb)
> }
>
> /**
> - * dev_nit_active - return true if any network interface taps are in use
> + * dev_nit_active_rcu - return true if any network interface taps are in use
> + *
> + * The caller must hold the RCU lock
> *
> * @dev: network device to check for the presence of taps
> */
> -bool dev_nit_active(struct net_device *dev)
> +bool dev_nit_active_rcu(struct net_device *dev)
> {
> - return !list_empty(&net_hotdata.ptype_all) ||
> + return !list_empty(&dev_net_rcu(dev)->ptype_all) ||
Sadly lockdep is not happy about the above, the caller can acquire
either the RCU lock and the RCU BH lock, and dev_net_rcu() is happy only
with the former - even if AFAICT either are safe. I'll use:
/* Callers may hold either RCU or RCU BH lock */
WARN_ON_ONCE(!rcu_read_lock_held() && !rcu_read_lock_bh_held());
return !list_empty(&dev_net(dev)->ptype_all) ||
!list_empty(&dev->ptype_all);
/P
Powered by blists - more mailing lists