Skip to contentSkip to conversation

virtio-scsi: restart DMA after iothread

PATCH Superseded Stefan Hajnoczi 1 participant 2 messages Jun 20, 2019

lore
Share & tools
lore
#0 lore raw

v5 cover virtio-scsi: restart DMA after iothread

v5:
* Plumbing vm change state handlers into DeviceClass/BusClass is a rather large bug fix. Instead I've combined the previous priorities approach with the observation from Kevin and Paolo that we really want to order by qdev tree depth.

The new qdev_add_vm_change_state_handler() API lets DeviceStates register callbacks that execute in qdev tree depth order. This solves the virtio-scsi bug since the virtio-scsi device's callback must complete before its child scsi-disk's callback runs.

Is this a good compromise for everyone?

Stefan Hajnoczi (3):
vl: add qemu_add_vm_change_state_handler_prio()
qdev: add qdev_add_vm_change_state_handler()
virtio-scsi: restart DMA after iothread

 hw/core/Makefile.objs             |  1 +
 include/hw/qdev-core.h            |  5 +++
 include/sysemu/sysemu.h           |  2 +
 hw/core/vm-change-state-handler.c | 61 +++++++++++++++++++++++++++++++
 hw/scsi/scsi-bus.c                |  4 +-
 hw/virtio/virtio.c                |  4 +-
 vl.c                              | 59 ++++++++++++++++++++++++------
 7 files changed, 120 insertions(+), 16 deletions(-)
 create mode 100644 hw/core/vm-change-state-handler.c
Signature · 1 line
2.21.0
#1 lore raw

PATCH v5 1/3 vl: add qemu_add_vm_change_state_handler_prio()

Add an API for registering vm change state handlers with a well-defined ordering. This is necessary when handlers depend on each other.

Small coding style fixes are included to make checkpatch.pl happy.

---
 include/sysemu/sysemu.h |  2 ++
 vl.c                    | 59 ++++++++++++++++++++++++++++++++---------
 2 files changed, 49 insertions(+), 12 deletions(-)
include/sysemu/sysemu.h +2 -0
index 61579ae71e..984c439ac9 100644
@@ -29,6 +29,8 @@ typedef void VMChangeStateHandler(void *opaque, int running, RunState state);
 
 VMChangeStateEntry *qemu_add_vm_change_state_handler(VMChangeStateHandler *cb,
                                                      void *opaque);
+VMChangeStateEntry *qemu_add_vm_change_state_handler_prio(
+        VMChangeStateHandler *cb, void *opaque, int priority);
 void qemu_del_vm_change_state_handler(VMChangeStateEntry *e);
 void vm_state_notify(int running, RunState state);
 
vl.c +47 -12

90 lines not on this page · raw message

Signature · 1 line
2.21.0