From: Jakub Kicinski <kuba@kernel.org>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Eric Dumazet <edumazet@google.com>,
"David S . Miller" <davem@davemloft.net>,
Paolo Abeni <pabeni@redhat.com>,
Ziwei Xiao <ziweixiao@google.com>,
Praveen Kaligineedi <pkaligineedi@google.com>,
Harshitha Ramamurthy <hramamurthy@google.com>,
Willem de Bruijn <willemb@google.com>,
Jeroen de Borst <jeroendb@google.com>,
Shailend Chand <shailend@google.com>,
netdev@vger.kernel.org, eric.dumazet@gmail.com
Subject: Re: [PATCH net-next 3/6] net: ethtool: perform pm duties outside of rtnl lock
Date: Thu, 20 Jun 2024 19:11:48 -0700 [thread overview]
Message-ID: <20240620191148.26fc09ac@kernel.org> (raw)
In-Reply-To: <48ac02dc-001e-48e3-ba87-8c4397bf7430@lunn.ch>
On Fri, 21 Jun 2024 02:59:54 +0200 Andrew Lunn wrote:
> > I also keep wondering whether we shouldn't use this as an opportunity
> > to introduce a "netdev instance lock". I think you mentioned we should
> > move away from rtnl for locking ethtool and ndos since most drivers
> > don't care at all about global state. Doing that is a huge project,
> > but maybe this is where we start?
>
> Is there much benefit to the average system?
>
> Embedded systems typically have 1 or 2 netdevs. Laptops, desktops and
> the like have one, maybe two netdevs. VMs typically have one netdev.
> So we are talking about high end switches with lots of ports and
> servers hosting lots of VMs. So of the around 500 netdev drivers we
> have, only maybe a dozen drivers would benefit?
>
> It seems unlikely those 500 drivers will be reviewed and declared safe
> to not take RTNL. So maybe a better way forward is that struct
> ethtool_ops gains a flag indicating its ops can be called without
> first talking RTNL. Somebody can then look at those dozen drivers, and
> we leave the other 490 alone and don't need to worry about
> regressions.
Right, we still need an opt in.
My question is more whether we should offer an opt out from rtnl_lock,
and beyond that driver is on its own (which reviewing the driver code
- I believe will end pretty badly), or to also offer a per-netdev
instance lock. Give the drivers a choice:
- rtnl
- netdev_lock(dev)
- (my least preferred) nothing.
The netdev lock would also be useful for things like napi and queue
stats, RSS contexts, and whatever else we add for drivers in the core.
For NAPI / queue info via netlink we currently require rtnl_lock,
taking a global lock to access a couple of per-netdevs structs feels
quite wasteful :(
next prev parent reply other threads:[~2024-06-21 2:11 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-20 11:47 [PATCH net-next 0/6] net: ethtool: reduce RTNL pressure in dev_ethtool() Eric Dumazet
2024-06-20 11:47 ` [PATCH net-next 1/6] net: ethtool: grab a netdev reference " Eric Dumazet
2024-06-20 11:47 ` [PATCH net-next 2/6] net: ethtool: add dev_ethtool_cap_check() Eric Dumazet
2024-06-20 11:47 ` [PATCH net-next 3/6] net: ethtool: perform pm duties outside of rtnl lock Eric Dumazet
2024-06-21 0:22 ` Jakub Kicinski
2024-06-21 0:59 ` Andrew Lunn
2024-06-21 2:11 ` Jakub Kicinski [this message]
2024-06-21 4:16 ` Eric Dumazet
2024-06-20 11:47 ` [PATCH net-next 4/6] net: ethtool: call ethtool_get_one_feature() without RTNL Eric Dumazet
2024-06-20 11:47 ` [PATCH net-next 5/6] net: ethtool: implement lockless ETHTOOL_GFLAGS Eric Dumazet
2024-06-20 11:47 ` [PATCH net-next 6/6] net: ethtool: add the ability to run ethtool_[gs]et_rxnfc() without RTNL Eric Dumazet
2024-06-20 17:45 ` Willem de Bruijn
2024-06-20 18:29 ` Eric Dumazet
2024-06-20 17:58 ` [PATCH net-next 0/6] net: ethtool: reduce RTNL pressure in dev_ethtool() Willem de Bruijn
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=20240620191148.26fc09ac@kernel.org \
--to=kuba@kernel.org \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=hramamurthy@google.com \
--cc=jeroendb@google.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pkaligineedi@google.com \
--cc=shailend@google.com \
--cc=willemb@google.com \
--cc=ziweixiao@google.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).