[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL v2 09/14] virtio-balloon: fix stats vq migration
From: |
Michael S. Tsirkin |
Subject: |
[Qemu-devel] [PULL v2 09/14] virtio-balloon: fix stats vq migration |
Date: |
Sat, 10 Sep 2016 00:47:33 +0300 |
From: Ladi Prosek <address@hidden>
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.
Cc: Michael S. Tsirkin <address@hidden>
Cc: Roman Kagan <address@hidden>
Cc: Stefan Hajnoczi <address@hidden>
Suggested-by: Roman Kagan <address@hidden>
Signed-off-by: Ladi Prosek <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
Reviewed-by: Michael S. Tsirkin <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
hw/virtio/virtio-balloon.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index ad4189a..49a2f4a 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -469,6 +469,18 @@ static void virtio_balloon_device_reset(VirtIODevice *vdev)
}
}
+static void virtio_balloon_set_status(VirtIODevice *vdev, uint8_t status)
+{
+ VirtIOBalloon *s = VIRTIO_BALLOON(vdev);
+
+ if (!s->stats_vq_elem && vdev->vm_running &&
+ (status & VIRTIO_CONFIG_S_DRIVER_OK) && virtqueue_rewind(s->svq, 1)) {
+ /* poll stats queue for the element we have discarded when the VM
+ * was stopped */
+ virtio_balloon_receive_stats(vdev, s->svq);
+ }
+}
+
static void virtio_balloon_instance_init(Object *obj)
{
VirtIOBalloon *s = VIRTIO_BALLOON(obj);
@@ -506,6 +518,7 @@ static void virtio_balloon_class_init(ObjectClass *klass,
void *data)
vdc->get_features = virtio_balloon_get_features;
vdc->save = virtio_balloon_save_device;
vdc->load = virtio_balloon_load_device;
+ vdc->set_status = virtio_balloon_set_status;
}
static const TypeInfo virtio_balloon_info = {
--
MST
- [Qemu-devel] [PULL v2 00/14] virtio,vhost,pc: fixes and updates, Michael S. Tsirkin, 2016/09/09
- [Qemu-devel] [PULL v2 02/14] virtio-pci: use size from correct structure, Michael S. Tsirkin, 2016/09/09
- [Qemu-devel] [PULL v2 01/14] virtio: Tell the user what went wrong when event_notifier_init failed, Michael S. Tsirkin, 2016/09/09
- [Qemu-devel] [PULL v2 03/14] pc: Add 2.8 machine, Michael S. Tsirkin, 2016/09/09
- [Qemu-devel] [PULL v2 04/14] target-i386: present virtual L3 cache info for vcpus, Michael S. Tsirkin, 2016/09/09
- [Qemu-devel] [PULL v2 05/14] virtio-pci: reduce modern_mem_bar size, Michael S. Tsirkin, 2016/09/09
- [Qemu-devel] [PULL v2 06/14] virtio: zero vq->inuse in virtio_reset(), Michael S. Tsirkin, 2016/09/09
- [Qemu-devel] [PULL v2 07/14] virtio-balloon: discard virtqueue element on reset, Michael S. Tsirkin, 2016/09/09
- [Qemu-devel] [PULL v2 08/14] virtio: add virtqueue_rewind(), Michael S. Tsirkin, 2016/09/09
- [Qemu-devel] [PULL v2 09/14] virtio-balloon: fix stats vq migration,
Michael S. Tsirkin <=
- [Qemu-devel] [PULL v2 10/14] virtio-pci: error out when both legacy and modern modes are disabled, Michael S. Tsirkin, 2016/09/09
- [Qemu-devel] [PULL v2 12/14] virtio-pci: minor refactoring, Michael S. Tsirkin, 2016/09/09
- [Qemu-devel] [PULL v2 11/14] vhost: don't set vring call if no vector, Michael S. Tsirkin, 2016/09/09
- [Qemu-devel] [PULL v2 13/14] tests/acpi: speedup acpi tests, Michael S. Tsirkin, 2016/09/09
- [Qemu-devel] [PULL v2 14/14] vhost-vsock: add virtio sockets device, Michael S. Tsirkin, 2016/09/09
- Re: [Qemu-devel] [PULL v2 00/14] virtio, vhost, pc: fixes and updates, Peter Maydell, 2016/09/12