From: Simon Horman <horms@kernel.org>
To: Hangbin Liu <liuhangbin@gmail.com>
Cc: netdev@vger.kernel.org, "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
MD Danish Anwar <danishanwar@ti.com>,
Alexander Lobakin <aleksander.lobakin@intel.com>,
Jaakko Karrenpalo <jkarrenpalo@gmail.com>,
Fernando Fernandez Mancera <ffmancera@riseup.net>,
Murali Karicheri <m-karicheri2@ti.com>,
WingMan Kwok <w-kwok2@ti.com>,
Stanislav Fomichev <sdf@fomichev.me>,
Xiao Liang <shaw.leon@gmail.com>,
Kuniyuki Iwashima <kuniyu@google.com>,
Johannes Berg <johannes.berg@intel.com>
Subject: Re: [PATCHv3 net 1/3] hsr: use rtnl lock when iterating over ports
Date: Wed, 10 Sep 2025 18:06:13 +0100 [thread overview]
Message-ID: <20250910170613.GB30363@horms.kernel.org> (raw)
In-Reply-To: <20250905091533.377443-2-liuhangbin@gmail.com>
On Fri, Sep 05, 2025 at 09:15:31AM +0000, Hangbin Liu wrote:
> hsr_for_each_port is called in many places without holding the RCU read
> lock, this may trigger warnings on debug kernels. Most of the callers
> are actually hold rtnl lock. So add a new helper hsr_for_each_port_rtnl
> to allow callers in suitable contexts to iterate ports safely without
> explicit RCU locking.
>
> This patch only fixed the callers that is hold rtnl lock. Other caller
> issues will be fixed in later patches.
>
> Fixes: c5a759117210 ("net/hsr: Use list_head (and rcu) instead of array for slave devices.")
> Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
> ---
> net/hsr/hsr_device.c | 18 +++++++++---------
> net/hsr/hsr_main.c | 2 +-
> net/hsr/hsr_main.h | 3 +++
> 3 files changed, 13 insertions(+), 10 deletions(-)
Thanks,
I've done a once over all the callers of these functions
(which was quite a task) and I believe they all hold
either RTNL or rcu_read_lock.
Reviewed-by: Simon Horman <horms@kernel.org>
next prev parent reply other threads:[~2025-09-10 17:06 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-05 9:15 [PATCHv3 net 0/3] hsr: fix lock warnings Hangbin Liu
2025-09-05 9:15 ` [PATCHv3 net 1/3] hsr: use rtnl lock when iterating over ports Hangbin Liu
2025-09-10 17:06 ` Simon Horman [this message]
2025-09-05 9:15 ` [PATCHv3 net 2/3] hsr: use hsr_for_each_port_rtnl in hsr_port_get_hsr Hangbin Liu
2025-09-10 17:07 ` Simon Horman
2025-09-05 9:15 ` [PATCHv3 net 3/3] hsr: hold rcu and dev lock for hsr_get_port_ndev Hangbin Liu
2025-09-10 17:09 ` Simon Horman
2025-09-11 10:00 ` [PATCHv3 net 0/3] hsr: fix lock warnings patchwork-bot+netdevbpf
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=20250910170613.GB30363@horms.kernel.org \
--to=horms@kernel.org \
--cc=aleksander.lobakin@intel.com \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=ffmancera@riseup.net \
--cc=jkarrenpalo@gmail.com \
--cc=johannes.berg@intel.com \
--cc=kuba@kernel.org \
--cc=kuniyu@google.com \
--cc=liuhangbin@gmail.com \
--cc=m-karicheri2@ti.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
--cc=shaw.leon@gmail.com \
--cc=w-kwok2@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;
as well as URLs for NNTP newsgroup(s).