[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-block] [PULL 3/6] virtio-scsi: restart DMA after iothread
From: |
Kevin Wolf |
Subject: |
[Qemu-block] [PULL 3/6] virtio-scsi: restart DMA after iothread |
Date: |
Mon, 8 Jul 2019 16:18:09 +0200 |
From: Stefan Hajnoczi <address@hidden>
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 <address@hidden>
Signed-off-by: Kevin Wolf <address@hidden>
---
hw/scsi/scsi-bus.c | 4 ++--
hw/virtio/virtio.c | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/hw/scsi/scsi-bus.c b/hw/scsi/scsi-bus.c
index 196136a307..fdc3a0e4e0 100644
--- a/hw/scsi/scsi-bus.c
+++ b/hw/scsi/scsi-bus.c
@@ -207,8 +207,8 @@ static void scsi_qdev_realize(DeviceState *qdev, Error
**errp)
error_propagate(errp, local_err);
return;
}
- dev->vmsentry = qemu_add_vm_change_state_handler(scsi_dma_restart_cb,
- dev);
+ dev->vmsentry = qdev_add_vm_change_state_handler(DEVICE(dev),
+ scsi_dma_restart_cb, dev);
}
static void scsi_qdev_unrealize(DeviceState *qdev, Error **errp)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 18f9f4c372..a94ea18a9c 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;
}
--
2.20.1
- [Qemu-block] [PULL 0/6] Block layer patches, Kevin Wolf, 2019/07/08
- [Qemu-block] [PULL 5/6] MAINTAINERS: update RBD block maintainer, Kevin Wolf, 2019/07/08
- [Qemu-block] [PULL 1/6] vl: add qemu_add_vm_change_state_handler_prio(), Kevin Wolf, 2019/07/08
- [Qemu-block] [PULL 3/6] virtio-scsi: restart DMA after iothread,
Kevin Wolf <=
- [Qemu-block] [PULL 2/6] qdev: add qdev_add_vm_change_state_handler(), Kevin Wolf, 2019/07/08
- [Qemu-block] [PULL 4/6] block/qcow: Improve error when opening qcow2 files as qcow, Kevin Wolf, 2019/07/08
- [Qemu-block] [PULL 6/6] qcow2: Allow -o compat=v3 during qemu-img amend, Kevin Wolf, 2019/07/08
- Re: [Qemu-block] [PULL 0/6] Block layer patches, Peter Maydell, 2019/07/08