[PATCH net-next v1 0/4] net: remove rtnl_lock from the callers of queue APIs

Stanislav Fomichev posted 4 patches 11 months, 1 week ago
There is a newer version of this series
Documentation/netlink/specs/netdev.yaml   |  4 +--
drivers/net/ethernet/broadcom/bnxt/bnxt.c |  4 +--
drivers/net/netdevsim/netdev.c            |  4 +--
include/net/netdev_netlink.h              | 12 +++++++
net/core/devmem.c                         | 32 ++++++++---------
net/core/netdev-genl-gen.c                |  4 +--
net/core/netdev-genl-gen.h                |  6 ++--
net/core/netdev-genl.c                    | 42 ++++++++++-------------
net/core/netdev_rx_queue.c                | 15 +++-----
9 files changed, 63 insertions(+), 60 deletions(-)
create mode 100644 include/net/netdev_netlink.h
[PATCH net-next v1 0/4] net: remove rtnl_lock from the callers of queue APIs
Posted by Stanislav Fomichev 11 months, 1 week ago
All drivers that use queue management APIs already depend on the netdev
lock. Ultimately, we want to have most of the paths that work with
specific netdev to be rtnl_lock-free (ethtool mostly in particular).
Queue API currently has a much smaller API surface, so start with
rtnl_lock from it:

- add mutex to each dmabuf binding (to replace rtnl_lock)
- protect global net_devmem_dmabuf_bindings with a new (global) lock
- move netdev lock management to the callers of netdev_rx_queue_restart
  and drop rtnl_lock

Cc: Mina Almasry <almasrymina@google.com>

Stanislav Fomichev (4):
  net: create netdev_nl_sock to wrap bindings list
  net: protect net_devmem_dmabuf_bindings by new
    net_devmem_bindings_mutex
  net: add granular lock for the netdev netlink socket
  net: drop rtnl_lock for queue_mgmt operations

 Documentation/netlink/specs/netdev.yaml   |  4 +--
 drivers/net/ethernet/broadcom/bnxt/bnxt.c |  4 +--
 drivers/net/netdevsim/netdev.c            |  4 +--
 include/net/netdev_netlink.h              | 12 +++++++
 net/core/devmem.c                         | 32 ++++++++---------
 net/core/netdev-genl-gen.c                |  4 +--
 net/core/netdev-genl-gen.h                |  6 ++--
 net/core/netdev-genl.c                    | 42 ++++++++++-------------
 net/core/netdev_rx_queue.c                | 15 +++-----
 9 files changed, 63 insertions(+), 60 deletions(-)
 create mode 100644 include/net/netdev_netlink.h

-- 
2.48.1
Re: [PATCH net-next v1 0/4] net: remove rtnl_lock from the callers of queue APIs
Posted by Jakub Kicinski 11 months ago
On Fri,  7 Mar 2025 07:57:21 -0800 Stanislav Fomichev wrote:
> All drivers that use queue management APIs already depend on the netdev
> lock. Ultimately, we want to have most of the paths that work with
> specific netdev to be rtnl_lock-free (ethtool mostly in particular).
> Queue API currently has a much smaller API surface, so start with
> rtnl_lock from it:
> 
> - add mutex to each dmabuf binding (to replace rtnl_lock)
> - protect global net_devmem_dmabuf_bindings with a new (global) lock
> - move netdev lock management to the callers of netdev_rx_queue_restart
>   and drop rtnl_lock

One more note, looks like this silently conflicts with my:
https://lore.kernel.org/all/20250307183006.2312761-1-kuba@kernel.org/

You need to add:

#include <net/netdev_lock.h>

to net/core/netdev_rx_queue.c, otherwise the series together break 
the build.
Re: [PATCH net-next v1 0/4] net: remove rtnl_lock from the callers of queue APIs
Posted by Stanislav Fomichev 11 months ago
On 03/07, Jakub Kicinski wrote:
> On Fri,  7 Mar 2025 07:57:21 -0800 Stanislav Fomichev wrote:
> > All drivers that use queue management APIs already depend on the netdev
> > lock. Ultimately, we want to have most of the paths that work with
> > specific netdev to be rtnl_lock-free (ethtool mostly in particular).
> > Queue API currently has a much smaller API surface, so start with
> > rtnl_lock from it:
> > 
> > - add mutex to each dmabuf binding (to replace rtnl_lock)
> > - protect global net_devmem_dmabuf_bindings with a new (global) lock
> > - move netdev lock management to the callers of netdev_rx_queue_restart
> >   and drop rtnl_lock
> 
> One more note, looks like this silently conflicts with my:
> https://lore.kernel.org/all/20250307183006.2312761-1-kuba@kernel.org/
> 
> You need to add:
> 
> #include <net/netdev_lock.h>
> 
> to net/core/netdev_rx_queue.c, otherwise the series together break 
> the build.

Noted, thanks!