qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] virtio-net: do not start queues that are not enabled by the guest
@ 2019-02-13 14:51 Yuri Benditovich
  2019-02-18  3:49 ` Jason Wang
  0 siblings, 1 reply; 20+ messages in thread
From: Yuri Benditovich @ 2019-02-13 14:51 UTC (permalink / raw)
  To: qemu-devel, Jason Wang, Michael S . Tsirkin, yan

https://bugzilla.redhat.com/show_bug.cgi?id=1608226
On startup/link-up in multiqueue configuration the virtio-net
tries to starts all the queues, including those that the guest
will not enable by VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET.
If the guest driver does not allocate queues that it will not
use (for example, Windows driver does not) and number of actually
used queues is less that maximal number supported by the device,
this causes vhost_net_start to fail and actually disables vhost
for all the queues, reducing the performance.
Current commit fixes this: initially only first queue is started,
upon VIRTIO_NET_CTRL_MQ_VQ_PAIRS_SET started all the queues
requested by the guest.

Signed-off-by: Yuri Benditovich <yuri.benditovich@daynix.com>
---
 hw/net/virtio-net.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 3f319ef723..d3b1ac6d3a 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -174,7 +174,7 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
 {
     VirtIODevice *vdev = VIRTIO_DEVICE(n);
     NetClientState *nc = qemu_get_queue(n->nic);
-    int queues = n->multiqueue ? n->max_queues : 1;
+    int queues = n->multiqueue ? n->curr_queues : 1;
 
     if (!get_vhost_net(nc->peer)) {
         return;
@@ -1016,9 +1016,12 @@ static int virtio_net_handle_mq(VirtIONet *n, uint8_t cmd,
         return VIRTIO_NET_ERR;
     }
 
-    n->curr_queues = queues;
     /* stop the backend before changing the number of queues to avoid handling a
      * disabled queue */
+    virtio_net_set_status(vdev, 0);
+
+    n->curr_queues = queues;
+
     virtio_net_set_status(vdev, vdev->status);
     virtio_net_set_queues(n);
 
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2019-02-28 14:09 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-13 14:51 [Qemu-devel] [PATCH] virtio-net: do not start queues that are not enabled by the guest Yuri Benditovich
2019-02-18  3:49 ` Jason Wang
2019-02-18  9:58   ` Yuri Benditovich
2019-02-18 16:39     ` Michael S. Tsirkin
2019-02-18 20:49       ` Yuri Benditovich
2019-02-18 23:34         ` Michael S. Tsirkin
2019-02-19  6:27           ` Jason Wang
2019-02-19 14:19             ` Michael S. Tsirkin
2019-02-20 10:13               ` Jason Wang
2019-02-21  6:00             ` Yuri Benditovich
2019-02-21  6:49               ` Jason Wang
2019-02-21  8:18                 ` Yuri Benditovich
2019-02-21  9:40                   ` Jason Wang
2019-02-22  1:35                     ` Michael S. Tsirkin
2019-02-22  3:04                       ` Jason Wang
2019-02-22  3:10                         ` Michael S. Tsirkin
2019-02-22  4:22                           ` Michael S. Tsirkin
2019-02-25  7:47                             ` Jason Wang
2019-02-25 12:33                               ` Michael S. Tsirkin
2019-02-28 14:08                   ` Michael S. Tsirkin

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).