From patchwork Sun Jan 22 10:05:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 13111428 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 11CEFC54EB4 for ; Sun, 22 Jan 2023 10:06:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229947AbjAVKGg (ORCPT ); Sun, 22 Jan 2023 05:06:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229890AbjAVKGd (ORCPT ); Sun, 22 Jan 2023 05:06:33 -0500 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A084B1CF6C; Sun, 22 Jan 2023 02:05:45 -0800 (PST) Received: from lenovo-t14s.redhat.com ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MRVy9-1p53Hj1ciT-00NSmk; Sun, 22 Jan 2023 11:05:30 +0100 From: Laurent Vivier To: linux-kernel@vger.kernel.org Cc: "Michael S. Tsirkin" , Parav Pandit , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Eli Cohen , Jason Wang , Gautam Dawar , Cindy Lu , "David S. Miller" , =?utf-8?q?Eugenio_P=C3=A9rez?= Subject: [PATCH 1/4] virtio_net: notify MAC address change on device initialization Date: Sun, 22 Jan 2023 11:05:23 +0100 Message-Id: <20230122100526.2302556-2-lvivier@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230122100526.2302556-1-lvivier@redhat.com> References: <20230122100526.2302556-1-lvivier@redhat.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:OvJkQJpHxHaDCPIk3W9i4eIYijK92aR7qOa7YFbWU4FKa/YfJkR E/a6z8dxmCPAKztm0ukyh/oHdFFG7zYa7NElzj3pnNbO1BMzo/7IgFa9I1NikV6ZzztbCV3 E2fJahWqrWBM5gzAUbZWhNFFhiRGzyTdLzqCq6fUs9xJ4pp7Ki6jrCSc0gh3nZNZ5YSb5mm D7PIF++SRA45BlYtN3wpw== UI-OutboundReport: notjunk:1;M01:P0:uI0nKc6Xg14=;V2mW9Yjl2DK8tq+0C6gzIszIg/5 o3q1eas0KF63Bj1HGMfGHZKC0xuc5cpaegmNi9jljig1AveJMDqZ+xRSp/3J5VSVrPcrY3PXw hDtqkTmTbonvTFiqsdrU/uFHuMUVr368KTf3JkgY3MbEtqrdlb46MPQ9ypvUaaoQo8LQF7AXW TX9MwGXOBJy2akXwI1VhwiWkPKGOzrAPdF2UT/GIOlfPoyyhwTMbmWf7pTMf+KPBz8sB3KwOx zyYQ877hiE8zBrwaehPa6PL7QLxIgTKbS9c1Ceo+I6rzs7prqVP7FhZQiixKmSXKIYMCKwa6m wj1A8adlm3mowJ8f5pTMW1LinSu0Swa7ErS0nmmq30z9SwufZx1imMcf1Xpv7OH6y9wnZ5GnW xdUGgBKDrqNc1jLJ/tV+PbkaVUtWTw+mifPUTFIn/rzXQowAqFZ/EPsCJ+s0/4wDQ3UM8zJS+ +XicJtU2EGEPPRbvh9gE28qLvYHibQz7QOsaOMGTeuMViVPvMoR9/1wJPFLF7kaNeraAlvXA7 db/rKUxbBngrNrndSgEK/wlhhXNM4U3wt4K3Ciij1pDt4XoMF65rSSN0Owb4x0fYQWgyN9YG5 4V3MlTq/JdA643f4WoBmkCL7ISjkuQJR7VqL4fd3F/tcdKomV6mSHVy5Y5q3NHT7VAWymh/ry 0Lewed5/mAWn7fJIz1fNou7E+NZoOGGS9SHTOAi8bw== Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org In virtnet_probe(), if the device doesn't provide a MAC address the driver assigns a random one. As we modify the MAC address we need to notify the device to allow it to update all the related information. The problem can be seen with vDPA and mlx5_vdpa driver as it doesn't assign a MAC address by default. The virtio_net device uses a random MAC address (we can see it with "ip link"), but we can't ping a net namespace from another one using the virtio-vdpa device because the new MAC address has not been provided to the hardware. Signed-off-by: Laurent Vivier --- drivers/net/virtio_net.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 7723b2a49d8e..25511a86590e 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -3800,6 +3800,8 @@ static int virtnet_probe(struct virtio_device *vdev) eth_hw_addr_set(dev, addr); } else { eth_hw_addr_random(dev); + dev_info(&vdev->dev, "Assigned random MAC address %pM\n", + dev->dev_addr); } /* Set up our device-specific information */ @@ -3956,6 +3958,18 @@ static int virtnet_probe(struct virtio_device *vdev) pr_debug("virtnet: registered device %s with %d RX and TX vq's\n", dev->name, max_queue_pairs); + /* a random MAC address has been assigned, notify the device */ + if (dev->addr_assign_type == NET_ADDR_RANDOM && + virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_MAC_ADDR)) { + struct scatterlist sg; + + sg_init_one(&sg, dev->dev_addr, dev->addr_len); + if (!virtnet_send_command(vi, VIRTIO_NET_CTRL_MAC, + VIRTIO_NET_CTRL_MAC_ADDR_SET, &sg)) { + dev_warn(&vdev->dev, "Failed to update MAC address.\n"); + } + } + return 0; free_unregister_netdev: From patchwork Sun Jan 22 10:05:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 13111427 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D1DB7C25B4E for ; Sun, 22 Jan 2023 10:06:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229904AbjAVKGe (ORCPT ); Sun, 22 Jan 2023 05:06:34 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229907AbjAVKGd (ORCPT ); Sun, 22 Jan 2023 05:06:33 -0500 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FC8F1CF69; Sun, 22 Jan 2023 02:05:45 -0800 (PST) Received: from lenovo-t14s.redhat.com ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mv3M8-1oSwdn1I24-00r0FP; Sun, 22 Jan 2023 11:05:31 +0100 From: Laurent Vivier To: linux-kernel@vger.kernel.org Cc: "Michael S. Tsirkin" , Parav Pandit , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Eli Cohen , Jason Wang , Gautam Dawar , Cindy Lu , "David S. Miller" , =?utf-8?q?Eugenio_P=C3=A9rez?= Subject: [PATCH 2/4] virtio_net: add a timeout in virtnet_send_command() Date: Sun, 22 Jan 2023 11:05:24 +0100 Message-Id: <20230122100526.2302556-3-lvivier@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230122100526.2302556-1-lvivier@redhat.com> References: <20230122100526.2302556-1-lvivier@redhat.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:Q/I/cga4nZOLWJZ6626JLw2DTN8BqDTEy/TTN7AmLPPbAvv4s/x 3Mb+7W/tWh2hPzaySdoOxxbH2k0Iq67YvdoSX7Dy/+p2/8WeDpQc94lfaAGKtjv1tyBixOT y23u7MmcoQ0e7tZLyBsqOQfI0xHlC5Abzxl7uPydBZiPyOdJhnFQarIJhyt9uTi0wD/VXiK DrR/t3vOSm/bCjw6SHx7w== UI-OutboundReport: notjunk:1;M01:P0:HM0lcQr5Jvs=;mzd2YF4kR7weYP6YA3EqDZLTl2j A/oWHtswsjYt5zeLBta83WIk2hmbo/2M4lwL+uRMaFO680jdbnFH/qJ1SEIVOfc4kdFZzO0MC 0IStB76FO8D90jh28K5SndhKkJlx0ufbU5Fa4c67couM3raVz+8TIMpe2RVLI6nvJd7BwdcLY fgNq0EdlP/dSQt84R3QRYJWOOy72MfZZyOd1K4ZmKdLLeu/myBHU83vzrXLYIM73p/s6QKQzE vrZGMnzViOj1b8+HGW47AHla/36LMPiLkSe1O3szv57s9vjJnV7dAWltB/UXqBTU8Bw1a0wtL KUr2NwWuSjq5JnalEn1A7Gu9up6cZDc0+GrNaKHfUSNZj6eXl77N4oq0ebxPYWsDHeo9luLG8 1dsOYnD7xSvb09yVpH+V2fGnxgAi+urXAW+UE87MIG1Mi1FjcQJoOLNUm9f6MR18cWak1wamO s9z2jKhwkblBXG7JYw7pK2IR5+5lYOvUCW4h7u0Ev97bWBUfFeQG/pJZXAqiKBleW5Q45nI1X 9Iwnd5yFJNHLOVaqsb2l4UfrIp5ltMYm+/RcTu9OOs2qSRMPBa/QHhx3KslOiwAMb46HQdlxK zyHw7iP1Zsd/17wwDqDUe59QVyEz2tZkBJkIiK4n+R5QE1he4/uZ7ftHBqmkeB0L5eJmeWDgk 5Fi7qCAtfgPFvPBqdDKEzHRYfVWzVwwUX6SEQvo6kw== Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org if the device control queue is buggy, don't crash the kernel by waiting for ever the response. Signed-off-by: Laurent Vivier --- drivers/net/virtio_net.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index 25511a86590e..29b3cc72082d 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -1974,6 +1974,7 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, struct scatterlist *sgs[4], hdr, stat; unsigned out_num = 0, tmp; int ret; + unsigned long timeout; /* Caller should know better */ BUG_ON(!virtio_has_feature(vi->vdev, VIRTIO_NET_F_CTRL_VQ)); @@ -2006,8 +2007,10 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, /* Spin for a response, the kick causes an ioport write, trapping * into the hypervisor, so the request should be handled immediately. */ + timeout = jiffies + 20 * HZ; while (!virtqueue_get_buf(vi->cvq, &tmp) && - !virtqueue_is_broken(vi->cvq)) + !virtqueue_is_broken(vi->cvq) && + !time_after(jiffies, timeout)) cpu_relax(); return vi->ctrl->status == VIRTIO_NET_OK; From patchwork Sun Jan 22 10:05:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 13111426 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F677C38142 for ; Sun, 22 Jan 2023 10:06:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229841AbjAVKG0 (ORCPT ); Sun, 22 Jan 2023 05:06:26 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47772 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229636AbjAVKG0 (ORCPT ); Sun, 22 Jan 2023 05:06:26 -0500 Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 844E71CF66; Sun, 22 Jan 2023 02:05:45 -0800 (PST) Received: from lenovo-t14s.redhat.com ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1N62mG-1odzFs1dl2-016Sip; Sun, 22 Jan 2023 11:05:32 +0100 From: Laurent Vivier To: linux-kernel@vger.kernel.org Cc: "Michael S. Tsirkin" , Parav Pandit , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Eli Cohen , Jason Wang , Gautam Dawar , Cindy Lu , "David S. Miller" , =?utf-8?q?Eugenio_P=C3=A9rez?= Subject: [PATCH 3/4] vdpa_sim_net: don't always set VIRTIO_NET_F_MAC Date: Sun, 22 Jan 2023 11:05:25 +0100 Message-Id: <20230122100526.2302556-4-lvivier@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230122100526.2302556-1-lvivier@redhat.com> References: <20230122100526.2302556-1-lvivier@redhat.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:C0lmlhI9YjKOrifXTYZOHEY7D8bGXsds0Mu6iD7d1jXwqVaA7WL sYcBzy078gS83j0QHDpnJctaFKmGZiLCuxb3AA/tfTBL3PRP12tRjCTniZHuigzDnhw/RSg zjJVDPHYnTe+K4n9N8dD0jA0kYx8t+SRt+UppkXo1ECIK5buDQUtx5S8U11UY/uLr7Wbis6 lxctRwls0pgcX4TTRKSBQ== UI-OutboundReport: notjunk:1;M01:P0:6zYbxARN6Fw=;NZdmpebzzy4EWONpLH5sP7s5tqY Pd0rYgvFLRGaaBtvWDkzvY5vtmGYpFo48jBn3ra9agZuwM6P7JtXAk9FWwptQILP0ZqWYdToY TAGSCJ2bjCkayikhHdNEAGLjNAGfincmOs8StnOdT4cW73zuT36kn+RWkMdTPBGqV2somiaIQ 98cxTL64LzR+lANpumdAq6HFlI+a/3qPTwbdcfPOhaoLc+F1ZWOl3+w8MFDTbdT9hBlf5K4Nc wFi1M3vJxtH6CDUyrv5KY6F6J2FrbXVkWdLHxP3S++FZ2aPLmbKWLsm/P9y9LwW0JJXKagV7m YH91u7GjV3f5rFh5bRiMsroGK9Jcr3NKPWPR/tFdN/HswNroUtDndNsY74OsGrTeDRMIsqBaW iWCqlArzOY444BVAlswkyySL2bHvl+gFBdte6H1FqkZ2kYSen22lrw0HZ6+TpC4FyKvnopNwe 2JKlhWyQ99SRmpBLVh3QijZqE6gYCSdcjGgq+17bKPwedvC1w0gKkfY7ZVsH8m6eROyHObHpj bu19aicnLqghoe+kjMJXDsqPqq2tZFY+sxia36YkY7yzsmqz2l+FozmphKL7+C6ByadbRvKEv Ql8AQDuspgjF3FQwDRLj9WA0/t6c4xqRpZmlIBEKFX0Mq/yzuDOghRS8T0iF2FVMy9VVFrlxs zi76BFTexWgbEu3x4Se8xDXA73pkqD7Pn4EBCmKoOg== Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org if vdpa dev command doesn't set a MAC address, don't report VIRTIO_NET_F_MAC. As vdpa_sim_net sets VIRTIO_NET_F_MAC without setting the MAC address, virtio-net doesn't set a random one and the address appears to be the zero MAC address. Signed-off-by: Laurent Vivier --- drivers/vdpa/vdpa_sim/vdpa_sim_net.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/vdpa/vdpa_sim/vdpa_sim_net.c b/drivers/vdpa/vdpa_sim/vdpa_sim_net.c index 584b975a98a7..28e858659b85 100644 --- a/drivers/vdpa/vdpa_sim/vdpa_sim_net.c +++ b/drivers/vdpa/vdpa_sim/vdpa_sim_net.c @@ -257,6 +257,12 @@ static int vdpasim_net_dev_add(struct vdpa_mgmt_dev *mdev, const char *name, dev_attr.work_fn = vdpasim_net_work; dev_attr.buffer_size = PAGE_SIZE; + /* if vdpa dev doesn't provide a MAC address, + * don't report we have one + */ + if (!(config->mask & (1 << VDPA_ATTR_DEV_NET_CFG_MACADDR))) + dev_attr.supported_features &= ~(1ULL << VIRTIO_NET_F_MAC); + simdev = vdpasim_create(&dev_attr, config); if (IS_ERR(simdev)) return PTR_ERR(simdev); From patchwork Sun Jan 22 10:05:26 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Vivier X-Patchwork-Id: 13111430 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 63E06C38142 for ; Sun, 22 Jan 2023 10:12:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229983AbjAVKL7 (ORCPT ); Sun, 22 Jan 2023 05:11:59 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49768 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229966AbjAVKLw (ORCPT ); Sun, 22 Jan 2023 05:11:52 -0500 X-Greylist: delayed 318 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Sun, 22 Jan 2023 02:11:03 PST Received: from mout.kundenserver.de (mout.kundenserver.de [212.227.126.187]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C109C1D90F; Sun, 22 Jan 2023 02:11:03 -0800 (PST) Received: from lenovo-t14s.redhat.com ([82.142.8.70]) by mrelayeu.kundenserver.de (mreue012 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MqINP-1oy0341K9z-00nPdI; Sun, 22 Jan 2023 11:05:33 +0100 From: Laurent Vivier To: linux-kernel@vger.kernel.org Cc: "Michael S. Tsirkin" , Parav Pandit , virtualization@lists.linux-foundation.org, netdev@vger.kernel.org, Eli Cohen , Jason Wang , Gautam Dawar , Cindy Lu , "David S. Miller" , =?utf-8?q?Eugenio_P=C3=A9rez?= Subject: [PATCH 4/4] virtio_net: fix virtnet_send_command() with vdpa_sim_net Date: Sun, 22 Jan 2023 11:05:26 +0100 Message-Id: <20230122100526.2302556-5-lvivier@redhat.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230122100526.2302556-1-lvivier@redhat.com> References: <20230122100526.2302556-1-lvivier@redhat.com> MIME-Version: 1.0 X-Provags-ID: V03:K1:YTjFLU1lj+k8vApmSwkjqxN3EBr0drRgQSUre+RfcDGSw4uTA+0 fpObHvWK8k3li6YWyS80RiUZHOX8MywdgaDytn/6t8T+DiaynYAOSnUv/FWk1HaQEOmrj5S KrovGMPtwrXHOQlFb5ZB7KBF2sy6BQdtTORgHlq35jPyVn4D7dbru2lBJVeYHfpcThtGErb +Fr/sA0/vvb/ZKDcaf4ag== UI-OutboundReport: notjunk:1;M01:P0:W/8CbaMJfHI=;CztS2YeNk03sPaZQmk0pcBJ6L43 XcTq3jVYTR1mPvip15m9kRcm4gx/fCYvZXXAiserRgQ9GFMVi/1LZ0b4jQkbYecKpXXQ+1YOU rBpVaXPROlsifSO1bNiEiHYAbudG2KcSeHDa4oueEPlBlJpIcVfy5U+3ZlKYLxT5ZRzdg50Qs g/IdVtnBO6yU19WOFGc0dYdOtjbIpFy66HsEykChNF0WWHZQhrOOJ2WhiAuzsvuBRJTgO05cc GLWOboaYKXGeWF74daHubX+BlE1K7ZZS9qZ6sIRQ2qMZO+rA8owLFae2Y/cg3W80pIRcNgW47 jkd67qMPk0vZjxCO9UrPIK3Tls1BKbZ2u91VxEMWay+YYAE1RqV/NhWBUjZ85vf/Jua4dzf9u UzzD3cflGJ9vqwlR003dHr1chEHCC6R+ff7po0WY+C8azbOlMMlJlx4lV5ntjVsWQkQgVzihl cgg+JKelqfGLSQlRJBSx6aNgedhV/zvuqXKnNPGdNSttYep61gKReoyF4gEDLnVmvpkLkjVzM nlV+b2ig0YvJfYiuFp4QMmD4FiCpy5+9MDcBhXTpaiIDFvMhaMsPdgwPCARDGRKYR8/7oPQku F5Nzmv3rfaax47qfuviRX2Dq8X+FsMmh0fbGYELuiT9zFEea8uCwaEwaW4BsNrsCbbzen8UtB xzMSe0bE+Kdl8LxR2gO5YF/TUzIUv4hfj3/YxuuEzA== Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org virtnet_send_command() sends a command to the control virtqueue by adding the command to the virtqueue, kicking the queue and waiting in a loop. The vdpa simulator simulates the control virqueue using a work queue: the virqueue_kick() calls schedule_work() to start the queue processing. But as virtnet_send_command() uses a loop, the scheduler cannot schedule the workqueue and the virtqueue is never processed (and the command never executed). To fix that, replace in the loop the cpu_relax() by a schedule(). Signed-off-by: Laurent Vivier --- 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 29b3cc72082d..546c0b2baaca 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c @@ -2011,7 +2011,7 @@ static bool virtnet_send_command(struct virtnet_info *vi, u8 class, u8 cmd, while (!virtqueue_get_buf(vi->cvq, &tmp) && !virtqueue_is_broken(vi->cvq) && !time_after(jiffies, timeout)) - cpu_relax(); + schedule(); return vi->ctrl->status == VIRTIO_NET_OK; }