qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH for-2.7 4/4] virtio-balloon: fix stats vq migration


From: Stefan Hajnoczi
Subject: [Qemu-devel] [PATCH for-2.7 4/4] virtio-balloon: fix stats vq migration
Date: Fri, 12 Aug 2016 16:32:58 +0100

The statistics virtqueue is not migrated properly because virtio-balloon
does not include s->stats_vq_elem in the migration stream.

After migration the statistics virtqueue hangs because the host never
completes the last element (s->stats_vq_elem is NULL on the destination
QEMU).  Therefore the guest never submits new elements and the virtqueue
is hung.

Instead of changing the migration stream format in an incompatible way,
detect the migration case and rewind the virtqueue so the last element
can be completed.

Signed-off-by: Stefan Hajnoczi <address@hidden>
---
 hw/virtio/virtio-balloon.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 5af429a..a8d66b9 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -99,6 +99,16 @@ static void balloon_stats_poll_cb(void *opaque)
     VirtIOBalloon *s = opaque;
     VirtIODevice *vdev = VIRTIO_DEVICE(s);
 
+    /* After live migration we fetch the current element again */
+    if (s->stats_vq_elem == NULL && virtqueue_rewind(s->svq, 1)) {
+        VirtQueueElement *elem = virtqueue_pop(s->svq, sizeof(*elem));
+
+        if (elem) {
+            s->stats_vq_offset = iov_size(elem->out_sg, elem->out_num);
+            s->stats_vq_elem = elem;
+        }
+    }
+
     if (s->stats_vq_elem == NULL || !balloon_stats_supported(s)) {
         /* re-schedule */
         balloon_stats_change_timer(s, s->stats_poll_interval);
-- 
2.7.4




reply via email to

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