From: "Michael S. Tsirkin" <mst@redhat.com>
To: Zigit Zo <zuozhijie@bytedance.com>
Cc: jasowang@redhat.com, xuanzhuo@linux.alibaba.com,
eperezma@redhat.com, virtualization@lists.linux.dev,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
kuba@kernel.org, pabeni@redhat.com, andrew+netdev@lunn.ch,
edumazet@google.com
Subject: Re: [PATCH net v3] virtio-net: fix recursived rtnl_lock() during probe()
Date: Wed, 16 Jul 2025 09:27:24 -0400 [thread overview]
Message-ID: <20250716092717-mutt-send-email-mst@kernel.org> (raw)
In-Reply-To: <20250716115717.1472430-1-zuozhijie@bytedance.com>
On Wed, Jul 16, 2025 at 07:57:17PM +0800, Zigit Zo wrote:
> The deadlock appears in a stack trace like:
>
> virtnet_probe()
> rtnl_lock()
> virtio_config_changed_work()
> netdev_notify_peers()
> rtnl_lock()
>
> It happens if the VMM sends a VIRTIO_NET_S_ANNOUNCE request while the
> virtio-net driver is still probing.
>
> The config_work in probe() will get scheduled until virtnet_open() enables
> the config change notification via virtio_config_driver_enable().
>
> Fixes: df28de7b0050 ("virtio-net: synchronize operstate with admin state on up/down")
> Signed-off-by: Zigit Zo <zuozhijie@bytedance.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
> ---
> v3 -> v2:
> * Simplify the changes.
> v1 -> v2:
> * Check vi->status in virtnet_open().
> * https://lore.kernel.org/netdev/20250702103722.576219-1-zuozhijie@bytedance.com/
> v1:
> * https://lore.kernel.org/netdev/20250630095109.214013-1-zuozhijie@bytedance.com/
> ---
> drivers/net/virtio_net.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
> index 5d674eb9a0f2..82b4a2a2b8c4 100644
> --- a/drivers/net/virtio_net.c
> +++ b/drivers/net/virtio_net.c
> @@ -7059,7 +7059,7 @@ static int virtnet_probe(struct virtio_device *vdev)
> otherwise get link status from config. */
> netif_carrier_off(dev);
> if (virtio_has_feature(vi->vdev, VIRTIO_NET_F_STATUS)) {
> - virtnet_config_changed_work(&vi->config_work);
> + virtio_config_changed(vi->vdev);
> } else {
> vi->status = VIRTIO_NET_S_LINK_UP;
> virtnet_update_settings(vi);
>
> base-commit: dae7f9cbd1909de2b0bccc30afef95c23f93e477
> --
> 2.49.0
next prev parent reply other threads:[~2025-07-16 13:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-16 11:57 [PATCH net v3] virtio-net: fix recursived rtnl_lock() during probe() Zigit Zo
2025-07-16 13:27 ` Michael S. Tsirkin [this message]
2025-07-17 2:02 ` Jason Wang
2025-07-17 14:50 ` patchwork-bot+netdevbpf
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=20250716092717-mutt-send-email-mst@kernel.org \
--to=mst@redhat.com \
--cc=andrew+netdev@lunn.ch \
--cc=edumazet@google.com \
--cc=eperezma@redhat.com \
--cc=jasowang@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=virtualization@lists.linux.dev \
--cc=xuanzhuo@linux.alibaba.com \
--cc=zuozhijie@bytedance.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.