]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
virtio: Use started flag in virtio_vmstate_change()
authorXie Yongji <xieyongji@baidu.com>
Wed, 20 Mar 2019 11:26:41 +0000 (19:26 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Mon, 20 May 2019 22:40:02 +0000 (18:40 -0400)
Currently, we use DRIVER_OK status bit to check whether guest
driver has started the device in virtio_vmstate_change(). But it's
not the case for virtio 1.0 transitional devices. If migration completes
between kicking virtqueue and setting VIRTIO_CONFIG_S_DRIVER_OK, guest
may be hung. So here we use started flag to check guest state instead.

Signed-off-by: Xie Yongji <xieyongji@baidu.com>
Signed-off-by: Zhang Yu <zhangyu31@baidu.com>
Message-Id: <20190320112646.3712-3-xieyongji@baidu.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/virtio/virtio.c

index 5d533ac74ec55058ead295425c174f09a024a2aa..4805727b5355b3fbeea05ba40002afa8de62cad2 100644 (file)
@@ -2291,7 +2291,7 @@ static void virtio_vmstate_change(void *opaque, int running, RunState state)
     VirtIODevice *vdev = opaque;
     BusState *qbus = qdev_get_parent_bus(DEVICE(vdev));
     VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
-    bool backend_run = running && (vdev->status & VIRTIO_CONFIG_S_DRIVER_OK);
+    bool backend_run = running && vdev->started;
     vdev->vm_running = running;
 
     if (backend_run) {