This series aims to address SIGTERM/QMP quit() being a bit too graceful in
respect to devices. Both of the aforementioned ways to stop QEMU completely
bypass the guest OS so in that sense they're basically equal to pulling the
power plug on a computer, yet the device shutdown code still tries to do
everything as graceful as possible, draining all in-flight requests etc.
I explain one of the use problems/use cases below.

If we have a server running disk requests that is for whatever reason
hanging or not able to process any more IO requests but still has some
in-flight requests previously issued by the guest OS, QEMU will still
try to drain the vring before shutting down even if it was explicitly
asked to do a "force shutdown" via SIGTERM or QMP quit. This is not
useful since the guest is no longer running at this point since it was
killed by QEMU earlier in the process. At this point, we don't care
about whatever in-flight IO it might have pending, we just want QEMU
to shut down.

Add an option called "skip-get-vring-base-on-force-shutdown" to allow
SIGTERM/QMP quit() to actually act like a "force shutdown" at least
for vhost-user-blk devices since those require the drain operation
to shut down gracefully unlike, for example, network devices.

Daniil Tatianin (3):
  softmmu/runstate: add a way to detect force shutdowns
  vhost: add a helper for force stopping a device
  vhost-user-blk: add an option to skip GET_VRING_BASE for force
    shutdown

 hw/block/vhost-user-blk.c          |  9 +++++-
 hw/virtio/vhost.c                  | 52 ++++++++++++++++++++++--------
 include/hw/virtio/vhost-user-blk.h |  2 ++
 include/hw/virtio/vhost.h          | 15 +++++++++
 include/system/runstate.h          |  1 +
 system/runstate.c                  | 10 ++++++
 6 files changed, 75 insertions(+), 14 deletions(-)

-- 
2.34.1


Reply via email to