|
|
4a2fec |
From 0166112bf9b190bb38208d507b7af4a6dca81063 Mon Sep 17 00:00:00 2001
|
|
|
4a2fec |
From: Maxime Coquelin <maxime.coquelin@redhat.com>
|
|
|
4a2fec |
Date: Tue, 5 Dec 2017 09:28:39 +0100
|
|
|
4a2fec |
Subject: [PATCH 17/21] vhost: restore avail index from vring used index on
|
|
|
4a2fec |
disconnection
|
|
|
4a2fec |
MIME-Version: 1.0
|
|
|
4a2fec |
Content-Type: text/plain; charset=UTF-8
|
|
|
4a2fec |
Content-Transfer-Encoding: 8bit
|
|
|
4a2fec |
|
|
|
4a2fec |
RH-Author: Maxime Coquelin <maxime.coquelin@redhat.com>
|
|
|
4a2fec |
Message-id: <20171205092839.17597-3-maxime.coquelin@redhat.com>
|
|
|
4a2fec |
Patchwork-id: 78141
|
|
|
4a2fec |
O-Subject: [RHV7.5 qemu-kvm-rhev PATCH 2/2] vhost: restore avail index from vring used index on disconnection
|
|
|
4a2fec |
Bugzilla: 1491909
|
|
|
4a2fec |
RH-Acked-by: wexu@redhat.com
|
|
|
4a2fec |
RH-Acked-by: Marc-André Lureau <marcandre.lureau@redhat.com>
|
|
|
4a2fec |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
4a2fec |
RH-Acked-by: Xiao Wang <jasowang@redhat.com>
|
|
|
4a2fec |
|
|
|
4a2fec |
vhost_virtqueue_stop() gets avail index value from the backend,
|
|
|
4a2fec |
except if the backend is not responding.
|
|
|
4a2fec |
|
|
|
4a2fec |
It happens when the backend crashes, and in this case, internal
|
|
|
4a2fec |
state of the virtio queue is inconsistent, making packets
|
|
|
4a2fec |
to corrupt the vring state.
|
|
|
4a2fec |
|
|
|
4a2fec |
With a Linux guest, it results in following error message on
|
|
|
4a2fec |
backend reconnection:
|
|
|
4a2fec |
|
|
|
4a2fec |
[ 22.444905] virtio_net virtio0: output.0:id 0 is not a head!
|
|
|
4a2fec |
[ 22.446746] net enp0s3: Unexpected TXQ (0) queue failure: -5
|
|
|
4a2fec |
[ 22.476360] net enp0s3: Unexpected TXQ (0) queue failure: -5
|
|
|
4a2fec |
|
|
|
4a2fec |
Fixes: 283e2c2adcb8 ("net: virtio-net discards TX data after link down")
|
|
|
4a2fec |
Cc: qemu-stable@nongnu.org
|
|
|
4a2fec |
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
|
|
|
4a2fec |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
4a2fec |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
4a2fec |
(cherry picked from commit 2ae39a113af311cb56a0c35b7f212dafcef15303)
|
|
|
4a2fec |
Signed-off-by: Maxime Coquelin <maxime.coquelin@redhat.com>
|
|
|
4a2fec |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
4a2fec |
---
|
|
|
4a2fec |
hw/virtio/vhost.c | 4 ++++
|
|
|
4a2fec |
1 file changed, 4 insertions(+)
|
|
|
4a2fec |
|
|
|
4a2fec |
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
|
|
|
4a2fec |
index b737ca9..76f6e1f 100644
|
|
|
4a2fec |
--- a/hw/virtio/vhost.c
|
|
|
4a2fec |
+++ b/hw/virtio/vhost.c
|
|
|
4a2fec |
@@ -1137,6 +1137,10 @@ static void vhost_virtqueue_stop(struct vhost_dev *dev,
|
|
|
4a2fec |
r = dev->vhost_ops->vhost_get_vring_base(dev, &state);
|
|
|
4a2fec |
if (r < 0) {
|
|
|
4a2fec |
VHOST_OPS_DEBUG("vhost VQ %d ring restore failed: %d", idx, r);
|
|
|
4a2fec |
+ /* Connection to the backend is broken, so let's sync internal
|
|
|
4a2fec |
+ * last avail idx to the device used idx.
|
|
|
4a2fec |
+ */
|
|
|
4a2fec |
+ virtio_queue_restore_last_avail_idx(vdev, idx);
|
|
|
4a2fec |
} else {
|
|
|
4a2fec |
virtio_queue_set_last_avail_idx(vdev, idx, state.num);
|
|
|
4a2fec |
}
|
|
|
4a2fec |
--
|
|
|
4a2fec |
1.8.3.1
|
|
|
4a2fec |
|