qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] net/virtio: fix multi-queue negotiation


From: Marcel Apfelbaum
Subject: Re: [Qemu-devel] [PATCH] net/virtio: fix multi-queue negotiation
Date: Tue, 23 Jun 2015 13:23:10 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0

On 06/23/2015 12:57 PM, Michael S. Tsirkin wrote:
On Thu, Jun 18, 2015 at 09:05:44PM +0300, Marcel Apfelbaum wrote:
Clear host multi-queue related features if the peer
doesn't support it.

Signed-off-by: Marcel Apfelbaum <address@hidden>
---
Notes:
  This fixes a guest CPU soft lock, however the virtio-net
  device will not work correctly. It seems that is
  peer's "fault", not knowing how to handle the situation.
  However, I submit this patch since it corrects the negotiation
  and saves us from a guest crash (!).

  Any ideas from the virtio/multi-queue developers on how to debug
  this further are welcomed.

  hw/net/virtio-net.c | 13 ++++++++++++-
  1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 9281aa1..63e59e8 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -367,6 +367,11 @@ static int peer_has_ufo(VirtIONet *n)
      return n->has_ufo;
  }

+static int peer_has_multiqueue(VirtIONet *n)
+{
+    return n->multiqueue;
+}
+
  static void virtio_net_set_mrg_rx_bufs(VirtIONet *n, int mergeable_rx_bufs,
                                         int version_1)
  {
@@ -469,6 +474,13 @@ static uint64_t virtio_net_get_features(VirtIODevice 
*vdev, uint64_t features)
          virtio_clear_feature(&features, VIRTIO_NET_F_HOST_UFO);
      }

+    if (!peer_has_multiqueue(n)) {
+        virtio_clear_feature(&features, VIRTIO_NET_F_MQ);
+        virtio_clear_feature(&features, VIRTIO_NET_F_GUEST_ANNOUNCE);
+        virtio_clear_feature(&features, VIRTIO_NET_F_CTRL_VQ);
+        virtio_clear_feature(&features, VIRTIO_NET_F_CTRL_RX);
+    }
+
      if (!get_vhost_net(nc->peer)) {
          virtio_add_feature(&features, VIRTIO_F_VERSION_1);
          return features;

_MQ makes sense but what about the rest? Why clear them?
Guest's virtio driver doesn't like if MQ is off and any of the other flags 
remains ON.
It has a specific check for each of them and fails the loading if not all are 
off.

Thanks,
Marcel


@@ -1314,7 +1326,6 @@ static void virtio_net_tx_bh(void *opaque)
  static void virtio_net_set_multiqueue(VirtIONet *n, int multiqueue)
  {
      n->multiqueue = multiqueue;
-
      virtio_net_set_queues(n);
  }

--
2.1.0




reply via email to

[Prev in Thread] Current Thread [Next in Thread]