From: Wang Zhan <wang.zhan@smartx.com>
To: netdev@vger.kernel.org, Jakub Kicinski <kuba@kernel.org>
Cc: Wang Zhan <wang.zhan@smartx.com>,
davem@davemloft.net, edumazet@google.com, pabeni@redhat.com,
andrew+netdev@lunn.ch, horms@kernel.org, sdf@fomichev.me
Subject: Re: [PATCH net-next] net: opt loopback into instance locking
Date: Wed, 11 Nov 2026 13:07:27 +0800 [thread overview]
Message-ID: <20261111050727.643231-1-wang.zhan@smartx.com> (raw)
In-Reply-To: <20261109173902.1225585-1-kuba@kernel.org>
On Mon, 09 Nov 2026 09:39:02 -0800 Jakub Kicinski wrote:
> netdev netlink iterates over devices when dumping queues/NAPIs/qstats
> etc. and takes rtnl_lock or instance lock depending on the underlying
> device. Currently even if all the "real" devices in the system are ops
> locked we still have to take rtnl_lock for lo (only to find out
> that it doesn't even have queues or NAPIs to report).
> Opt loopback into having control path under the ops lock.
nit: NAPI dump no longer takes RTNL since commit
062e789172226 ("netdev-genl: remove rtnl_lock protection from NAPI
ops"). "dumping queues/qstats" is enough, right?
> This is a pretty obvious thing to do, I've held back this
> patch because we used to only apply ops locking on physical devices.
> netkit queue leasing made a precedent for (far more complex)
> SW devices enabling ops locking. Now adding it to lo should
> not create much new bug surface.
>
> I considered an alternative of adding a "predicate" to the iteration
> primitive so that we can skip the devices which obviously don't
> support given API (eg qstat) without any locking. But it's more
> LoC and real_num_.x_queues is not currently WRITE_ONCE()ed so
> it doesn't work too well for queues.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Tested on x86_64 QEMU TCG with lockdep:
- with RTNL held for 3 seconds, all-device queue and qstats dumps waited
before this patch and completed in about 4 ms after it
- no lockdep warnings across lo up/down, MTU change, rename,
promisc/allmulti, ethtool get_link/get_ts_info and netns teardown
Tested-by: Wang Zhan <wang.zhan@smartx.com>
Thanks
next prev parent reply other threads:[~2026-11-11 5:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-09 17:39 [PATCH net-next] net: opt loopback into instance locking Jakub Kicinski
2026-11-10 16:55 ` Stanislav Fomichev
2026-11-11 5:07 ` Wang Zhan [this message]
2026-11-11 22:40 ` patchwork-bot+netdevbpf
-- strict thread matches above, loose matches on Subject: below --
2026-09-18 21:04 Jakub Kicinski
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=20261111050727.643231-1-wang.zhan@smartx.com \
--to=wang.zhan@smartx.com \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sdf@fomichev.me \
/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