From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55549) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7fbq-0002x6-K2 for qemu-devel@nongnu.org; Wed, 24 Jun 2015 04:00:44 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Z7fbk-0002qN-Un for qemu-devel@nongnu.org; Wed, 24 Jun 2015 04:00:38 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54901) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Z7fbk-0002ng-Pg for qemu-devel@nongnu.org; Wed, 24 Jun 2015 04:00:32 -0400 Message-ID: <558A6399.6090906@redhat.com> Date: Wed, 24 Jun 2015 16:00:25 +0800 From: Jason Wang MIME-Version: 1.0 References: <1434650744-6585-1-git-send-email-marcel@redhat.com> In-Reply-To: <1434650744-6585-1-git-send-email-marcel@redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] net/virtio: fix multi-queue negotiation List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Marcel Apfelbaum , qemu-devel@nongnu.org Cc: famz@redhat.com, n.nikolaev@virtualopensystems.com, mst@redhat.com On 06/19/2015 02:05 AM, Marcel Apfelbaum wrote: > Clear host multi-queue related features if the peer > doesn't support it. > > Signed-off-by: Marcel Apfelbaum > --- > 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 (!). Could you please describe how to reproduce this issue? > > 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; > +} The name is confusing, this is in fact whether or not guest support multiqueue. To check peer's ability, you need check n->nic_conf.peers.queues instead. > + > 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); I'm not quite understand this, VIRTIO_NET_F_MQ should work if peer has only 1 queue. > + 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); > + } > + Those features don't depend on multiqueue, why clear them? > if (!get_vhost_net(nc->peer)) { > virtio_add_feature(&features, VIRTIO_F_VERSION_1); > return features; > @@ -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); > } >