[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
- [Qemu-devel] [PATCH for-2.7 0/4] virtio-balloon: fix stats vq migration, Stefan Hajnoczi, 2016/08/12
- [Qemu-devel] [PATCH for-2.7 2/4] virtio: decrement vq->inuse in virtqueue_discard(), Stefan Hajnoczi, 2016/08/12
- [Qemu-devel] [PATCH for-2.7 4/4] virtio-balloon: fix stats vq migration,
Stefan Hajnoczi <=
- [Qemu-devel] [PATCH for-2.7 3/4] virtio: add virtqueue_rewind(), Stefan Hajnoczi, 2016/08/12
- [Qemu-devel] [PATCH for-2.7 1/4] virtio: recalculate vq->inuse after migration, Stefan Hajnoczi, 2016/08/12
- Re: [Qemu-devel] [PATCH for-2.7 0/4] virtio-balloon: fix stats vq migration, no-reply, 2016/08/12
- Re: [Qemu-devel] [PATCH for-2.7 0/4] virtio-balloon: fix stats vq migration, Gaudenz Steinlin, 2016/08/15