qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] [PATCH] virtio-balloon: stats vq migration spec compliance


From: Michael S. Tsirkin
Subject: [Qemu-devel] [PATCH] virtio-balloon: stats vq migration spec compliance
Date: Tue, 16 Aug 2016 00:32:55 +0300

virtio spec says that devices must not touch VQs
before DRIVER_OK is set.

Additionally, balloon must not touch stats VQ
unless the stats feature bit has been negotiated.

Cc: Ladi Prosek <address@hidden>
Signed-off-by: Michael S. Tsirkin <address@hidden>
---
 hw/virtio/virtio-balloon.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/hw/virtio/virtio-balloon.c b/hw/virtio/virtio-balloon.c
index 65457e9..7189260 100644
--- a/hw/virtio/virtio-balloon.c
+++ b/hw/virtio/virtio-balloon.c
@@ -427,6 +427,7 @@ static void virtio_balloon_vmstate_cb(void *opaque, int 
running,
                                       RunState state)
 {
     VirtIOBalloon *s = opaque;
+    VirtIODevice *vdev = VIRTIO_DEVICE(s);
 
     if (!running) {
         /* put the stats element back if the VM is not running */
@@ -436,7 +437,8 @@ static void virtio_balloon_vmstate_cb(void *opaque, int 
running,
             s->stats_vq_elem = NULL;
         }
 
-    } else {
+    } else if (balloon_stats_supported(s) &&
+               (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK)) {
         /* poll stats queue for the element we may have discarded
          * when the VM was stopped */
         virtio_balloon_receive_stats(VIRTIO_DEVICE(s), s->svq);
-- 
MST



reply via email to

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