|
|
9ae3a8 |
From 92a638cb3b0601746d47b4a443762fe71bb21431 Mon Sep 17 00:00:00 2001
|
|
|
9ae3a8 |
From: Ladi Prosek <lprosek@redhat.com>
|
|
|
9ae3a8 |
Date: Thu, 10 Nov 2016 23:00:51 +0100
|
|
|
9ae3a8 |
Subject: [PATCH 8/8] virtio-balloon: fix stats vq migration
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
RH-Author: Ladi Prosek <lprosek@redhat.com>
|
|
|
9ae3a8 |
Message-id: <1478797251-10302-2-git-send-email-lprosek@redhat.com>
|
|
|
9ae3a8 |
Patchwork-id: 72819
|
|
|
9ae3a8 |
O-Subject: [PATCH v2 8/6] virtio-balloon: fix stats vq migration
|
|
|
9ae3a8 |
Bugzilla: 1377968
|
|
|
9ae3a8 |
RH-Acked-by: Paolo Bonzini <pbonzini@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
The statistics virtqueue is not migrated properly because virtio-balloon
|
|
|
9ae3a8 |
does not include s->stats_vq_elem in the migration stream.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
After migration the statistics virtqueue hangs because the host never
|
|
|
9ae3a8 |
completes the last element (s->stats_vq_elem is NULL on the destination
|
|
|
9ae3a8 |
QEMU). Therefore the guest never submits new elements and the virtqueue
|
|
|
9ae3a8 |
is hung.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Instead of changing the migration stream format in an incompatible way,
|
|
|
9ae3a8 |
detect the migration case and rewind the virtqueue so the last element
|
|
|
9ae3a8 |
can be completed.
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
Cc: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
Cc: Roman Kagan <rkagan@virtuozzo.com>
|
|
|
9ae3a8 |
Cc: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
Suggested-by: Roman Kagan <rkagan@virtuozzo.com>
|
|
|
9ae3a8 |
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
|
|
|
9ae3a8 |
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
|
|
|
9ae3a8 |
(cherry picked from commit 4a1e48becab81020adfb74b22c76a595f2d02a01)
|
|
|
9ae3a8 |
Signed-off-by: Ladi Prosek <lprosek@redhat.com>
|
|
|
9ae3a8 |
Signed-off-by: Miroslav Rezanina <mrezanin@redhat.com>
|
|
|
9ae3a8 |
---
|
|
|
9ae3a8 |
hw/virtio/virtio-balloon.c | 13 +++++++++++++
|
|
|
9ae3a8 |
1 file changed, 13 insertions(+)
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
|
|
|
9ae3a8 |
index faf93f7..1a60d3c 100644
|
|
|
9ae3a8 |
--- a/hw/virtio/virtio-balloon.c
|
|
|
9ae3a8 |
+++ b/hw/virtio/virtio-balloon.c
|
|
|
9ae3a8 |
@@ -403,6 +403,18 @@ static void virtio_balloon_device_reset(VirtIODevice *vdev)
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
+static void virtio_balloon_set_status(VirtIODevice *vdev, uint8_t status)
|
|
|
9ae3a8 |
+{
|
|
|
9ae3a8 |
+ VirtIOBalloon *s = VIRTIO_BALLOON(vdev);
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
+ if (!s->stats_vq_elem_pending && vdev->vm_running &&
|
|
|
9ae3a8 |
+ (status & VIRTIO_CONFIG_S_DRIVER_OK) && virtqueue_rewind(s->svq, 1)) {
|
|
|
9ae3a8 |
+ /* poll stats queue for the element we have discarded when the VM
|
|
|
9ae3a8 |
+ * was stopped */
|
|
|
9ae3a8 |
+ virtio_balloon_receive_stats(vdev, s->svq);
|
|
|
9ae3a8 |
+ }
|
|
|
9ae3a8 |
+}
|
|
|
9ae3a8 |
+
|
|
|
9ae3a8 |
static Property virtio_balloon_properties[] = {
|
|
|
9ae3a8 |
DEFINE_PROP_END_OF_LIST(),
|
|
|
9ae3a8 |
};
|
|
|
9ae3a8 |
@@ -419,6 +431,7 @@ static void virtio_balloon_class_init(ObjectClass *klass, void *data)
|
|
|
9ae3a8 |
vdc->get_config = virtio_balloon_get_config;
|
|
|
9ae3a8 |
vdc->set_config = virtio_balloon_set_config;
|
|
|
9ae3a8 |
vdc->get_features = virtio_balloon_get_features;
|
|
|
9ae3a8 |
+ vdc->set_status = virtio_balloon_set_status;
|
|
|
9ae3a8 |
}
|
|
|
9ae3a8 |
|
|
|
9ae3a8 |
static const TypeInfo virtio_balloon_info = {
|
|
|
9ae3a8 |
--
|
|
|
9ae3a8 |
1.8.3.1
|
|
|
9ae3a8 |
|