[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230122100526.2302556-5-lvivier@redhat.com>
Date: Sun, 22 Jan 2023 11:05:26 +0100
From: Laurent Vivier <lvivier@...hat.com>
To: linux-kernel@...r.kernel.org
Cc: "Michael S. Tsirkin" <mst@...hat.com>,
Parav Pandit <parav@...dia.com>,
virtualization@...ts.linux-foundation.org, netdev@...r.kernel.org,
Eli Cohen <elic@...dia.com>, Jason Wang <jasowang@...hat.com>,
Gautam Dawar <gautam.dawar@...inx.com>,
Cindy Lu <lulu@...hat.com>,
"David S. Miller" <davem@...emloft.net>,
Eugenio PĂ©rez <eperezma@...hat.com>
Subject: [PATCH 4/4] virtio_net: fix virtnet_send_command() with vdpa_sim_net
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 <lvivier@...hat.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 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;
}
--
2.39.0
Powered by blists - more mailing lists