[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250307153922.18e52263@kernel.org>
Date: Fri, 7 Mar 2025 15:39:22 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Stanislav Fomichev <sdf@...ichev.me>
Cc: netdev@...r.kernel.org, davem@...emloft.net, edumazet@...gle.com,
pabeni@...hat.com, linux-kernel@...r.kernel.org, horms@...nel.org,
donald.hunter@...il.com, michael.chan@...adcom.com,
pavan.chebbi@...adcom.com, andrew+netdev@...n.ch, jdamato@...tly.com,
xuanzhuo@...ux.alibaba.com, almasrymina@...gle.com, asml.silence@...il.com,
dw@...idwei.uk
Subject: Re: [PATCH net-next v1 4/4] net: drop rtnl_lock for queue_mgmt
operations
On Fri, 7 Mar 2025 07:57:25 -0800 Stanislav Fomichev wrote:
> All drivers that use queue API are already converted to use
> netdev instance lock. Move netdev instance lock management to
> the netlink layer and drop rtnl_lock.
> @@ -860,12 +854,11 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)
> }
>
> mutex_lock(&priv->lock);
> - rtnl_lock();
>
> - netdev = __dev_get_by_index(genl_info_net(info), ifindex);
> + netdev = netdev_get_by_index_lock(genl_info_net(info), ifindex);
> if (!netdev || !netif_device_present(netdev)) {
> err = -ENODEV;
> - goto err_unlock;
> + goto err_unlock_sock;
> }
>
> if (dev_xdp_prog_count(netdev)) {
> @@ -918,14 +911,15 @@ int netdev_nl_bind_rx_doit(struct sk_buff *skb, struct genl_info *info)
> if (err)
> goto err_unbind;
>
> - rtnl_unlock();
> + netdev_unlock(netdev);
Ah, here's the unlock :)
Looks good for the devmem binding, I think, the other functions will
need a bit more careful handling. So perhaps drop the queue get changes?
I'm cooking some patches for the queue get and queue stats.
AFAIU we need helpers which will go over netdevs and either take rtnl
lock or instance lock, depending on whether the driver is "ops locked"
Powered by blists - more mailing lists