From: Breno Leitao <leitao@debian.org>
To: Kuniyuki Iwashima <kuniyu@amazon.com>
Cc: andrew+netdev@lunn.ch, edumazet@google.com, kernel-team@meta.com,
kuba@kernel.org, netdev@vger.kernel.org,
ushankar@purestorage.com
Subject: Re: for_each_netdev_rcu() protected by RTNL and CONFIG_PROVE_RCU_LIST
Date: Fri, 7 Feb 2025 02:46:21 -0800 [thread overview]
Message-ID: <20250207-active-solid-vole-26a2c6@leitao> (raw)
In-Reply-To: <20250207033822.47317-1-kuniyu@amazon.com>
Hello Kuniyuki,
On Fri, Feb 07, 2025 at 12:38:22PM +0900, Kuniyuki Iwashima wrote:
> From: Breno Leitao <leitao@debian.org>
> Date: Thu, 6 Feb 2025 07:51:55 -0800
> > Are there better approaches to silence these warnings when RTNL is held?
> > Any suggestions would be appreciated.
>
> We can't use lockdep_rtnl_net_is_held() there yet because most users are
> not converted to per-netns RTNL, so it will complain loudly.
Right, so, I understand the best approach is to leverage
lockdep_rtnl_is_held() only right now. Something as:
diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 1dcc76af75203..0deee1313f23a 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -3217,7 +3217,8 @@ int call_netdevice_notifiers_info(unsigned long val,
#define for_each_netdev_reverse(net, d) \
list_for_each_entry_reverse(d, &(net)->dev_base_head, dev_list)
#define for_each_netdev_rcu(net, d) \
- list_for_each_entry_rcu(d, &(net)->dev_base_head, dev_list)
+ list_for_each_entry_rcu(d, &(net)->dev_base_head, dev_list, \
+ lockdep_rtnl_is_held())
#define for_each_netdev_safe(net, d, n) \
list_for_each_entry_safe(d, n, &(net)->dev_base_head, dev_list)
#define for_each_netdev_continue(net, d) \
Which brings another problem:
lockdep_rtnl_is_held() is defined in include/linux/rtnetlink.h, so,
we'll need to include 'linux/rtnetlink.h' in linux/netdevice.h, which
doesn't seem correct (!?).
Otherwise drivers using for_each_netdev_rcu() will not be able to find
lockdep_rtnl_is_held().
I suppose we will need to move some of definitions around, but, I am
confident in which way.
--breno
next prev parent reply other threads:[~2025-02-07 10:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-06 15:51 for_each_netdev_rcu() protected by RTNL and CONFIG_PROVE_RCU_LIST Breno Leitao
2025-02-07 3:38 ` Kuniyuki Iwashima
2025-02-07 10:46 ` Breno Leitao [this message]
2025-02-07 10:56 ` Eric Dumazet
2025-02-07 11:26 ` Breno Leitao
2025-02-07 12:17 ` Breno Leitao
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=20250207-active-solid-vole-26a2c6@leitao \
--to=leitao@debian.org \
--cc=andrew+netdev@lunn.ch \
--cc=edumazet@google.com \
--cc=kernel-team@meta.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=netdev@vger.kernel.org \
--cc=ushankar@purestorage.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