diff options
author | Stefan Hajnoczi <stefanha@redhat.com> | 2019-06-20 18:37:09 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2019-07-08 16:00:26 +0200 |
commit | 1a8c091c4ea5db3126514e3f7df678c9ee328802 (patch) | |
tree | 15149cf49a60253597d6df16ca91380e681096db /hw/virtio/virtio.c | |
parent | e965ffa70ac8ddc334dd5990f6907789bd9e6af6 (diff) | |
download | qemu-1a8c091c4ea5db3126514e3f7df678c9ee328802.zip qemu-1a8c091c4ea5db3126514e3f7df678c9ee328802.tar.gz qemu-1a8c091c4ea5db3126514e3f7df678c9ee328802.tar.bz2 |
virtio-scsi: restart DMA after iothread
When the 'cont' command resumes guest execution the vm change state
handlers are invoked. Unfortunately there is no explicit ordering
between classic qemu_add_vm_change_state_handler() callbacks. When two
layers of code both use vm change state handlers, we don't control which
handler runs first.
virtio-scsi with iothreads hits a deadlock when a failed SCSI command is
restarted and completes before the iothread is re-initialized.
This patch uses the new qdev_add_vm_change_state_handler() API to
guarantee that virtio-scsi's virtio change state handler executes before
the SCSI bus children. This way DMA is restarted after the iothread has
re-initialized.
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'hw/virtio/virtio.c')
-rw-r--r-- | hw/virtio/virtio.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c index 18f9f4c..a94ea18 100644 --- a/hw/virtio/virtio.c +++ b/hw/virtio/virtio.c @@ -2362,8 +2362,8 @@ void virtio_init(VirtIODevice *vdev, const char *name, } else { vdev->config = NULL; } - vdev->vmstate = qemu_add_vm_change_state_handler(virtio_vmstate_change, - vdev); + vdev->vmstate = qdev_add_vm_change_state_handler(DEVICE(vdev), + virtio_vmstate_change, vdev); vdev->device_endian = virtio_default_endian(); vdev->use_guest_notifier_mask = true; } |