netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Stanislav Fomichev <sdf@fomichev.me>
Cc: netdev@vger.kernel.org, davem@davemloft.net, edumazet@google.com,
	pabeni@redhat.com, linux-kernel@vger.kernel.org,
	horms@kernel.org, donald.hunter@gmail.com,
	michael.chan@broadcom.com, pavan.chebbi@broadcom.com,
	andrew+netdev@lunn.ch, jdamato@fastly.com,
	xuanzhuo@linux.alibaba.com, almasrymina@google.com,
	asml.silence@gmail.com, dw@davidwei.uk
Subject: Re: [PATCH net-next v1 4/4] net: drop rtnl_lock for queue_mgmt operations
Date: Fri, 7 Mar 2025 15:39:22 -0800	[thread overview]
Message-ID: <20250307153922.18e52263@kernel.org> (raw)
In-Reply-To: <20250307155725.219009-5-sdf@fomichev.me>

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"

  reply	other threads:[~2025-03-07 23:39 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-07 15:57 [PATCH net-next v1 0/4] net: remove rtnl_lock from the callers of queue APIs Stanislav Fomichev
2025-03-07 15:57 ` [PATCH net-next v1 1/4] net: create netdev_nl_sock to wrap bindings list Stanislav Fomichev
2025-03-07 15:57 ` [PATCH net-next v1 2/4] net: protect net_devmem_dmabuf_bindings by new net_devmem_bindings_mutex Stanislav Fomichev
2025-03-07 17:49   ` Jakub Kicinski
2025-03-07 19:36     ` Stanislav Fomichev
2025-03-07 15:57 ` [PATCH net-next v1 3/4] net: add granular lock for the netdev netlink socket Stanislav Fomichev
2025-03-07 17:50   ` Jakub Kicinski
2025-03-07 19:35     ` Stanislav Fomichev
2025-03-07 23:33       ` Jakub Kicinski
2025-03-07 23:34   ` Jakub Kicinski
2025-03-07 23:43     ` Stanislav Fomichev
2025-03-09 21:57       ` Mina Almasry
2025-03-10  5:02         ` Stanislav Fomichev
2025-03-10  5:45           ` Mina Almasry
2025-03-07 15:57 ` [PATCH net-next v1 4/4] net: drop rtnl_lock for queue_mgmt operations Stanislav Fomichev
2025-03-07 23:39   ` Jakub Kicinski [this message]
2025-03-07 23:50     ` Stanislav Fomichev
2025-03-08  3:22 ` [PATCH net-next v1 0/4] net: remove rtnl_lock from the callers of queue APIs Jakub Kicinski
2025-03-08  3:33   ` Stanislav Fomichev

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=20250307153922.18e52263@kernel.org \
    --to=kuba@kernel.org \
    --cc=almasrymina@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=asml.silence@gmail.com \
    --cc=davem@davemloft.net \
    --cc=donald.hunter@gmail.com \
    --cc=dw@davidwei.uk \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jdamato@fastly.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.chan@broadcom.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pavan.chebbi@broadcom.com \
    --cc=sdf@fomichev.me \
    --cc=xuanzhuo@linux.alibaba.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).