qemu/backends
Haoqian He bc85aae420 vhost-user: return failure if backend crash when live migration
Live migration should be terminated if the vhost-user backend crashes
before the migration completes.

Specifically, since the vhost device will be stopped when VM is stopped
before the end of the live migration, in current implementation if the
backend crashes, vhost-user device set_status() won't return failure,
live migration won't perceive the disconnection between QEMU and the
backend.

When the VM is migrated to the destination, the inflight IO will be
resubmitted, and if the IO was completed out of order before, it will
cause IO error.

To fix this issue:
1. Add the return value to set_status() for VirtioDeviceClass.
  a. For the vhost-user device, return failure when the backend crashes.
  b. For other virtio devices, always return 0.
2. Return failure if vhost_dev_stop() failed for vhost-user device.

If QEMU loses connection with the vhost-user backend, virtio set_status()
can return failure to the upper layer, migration_completion() can handle
the error, terminate the live migration, and restore the VM, so that
inflight IO can be completed normally.

Signed-off-by: Haoqian He <haoqian.he@smartx.com>
Message-Id: <20250416024729.3289157-4-haoqian.he@smartx.com>
Tested-by: Lei Yang <leiyang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2025-05-14 05:39:15 -04:00
..
tpm qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
confidential-guest-support.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
cryptodev-builtin.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
cryptodev-hmp-cmds.c qapi: Move include/qapi/qmp/ to include/qobject/ 2025-02-10 15:33:16 +01:00
cryptodev-lkcf.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
cryptodev-vhost-user.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
cryptodev-vhost.c cryptodev/vhost: allocate CryptoDevBackendVhost using g_mem0() 2025-02-21 07:18:42 -05:00
cryptodev.c qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
dbus-vmstate.c qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
dbus-vmstate1.xml docs: move D-Bus VMState documentation to source XML 2021-12-21 10:50:21 +04:00
host_iommu_device.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
hostmem-epc.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
hostmem-file.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
hostmem-memfd.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
hostmem-ram.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
hostmem-shm.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
hostmem.c qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
iommufd.c Various patches loosely related to single binary work: 2025-04-27 12:47:16 -04:00
Kconfig backends: Initial support for SPDM socket support 2024-07-22 20:15:42 -04:00
meson.build util: exclude mmap-alloc.c from compilation target on Emscripten 2025-05-06 16:02:04 +02:00
rng-builtin.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
rng-egd.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
rng-random.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
rng.c qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
spdm-socket.c include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
trace-events vfio/iommufd: Implement VFIOIOMMUClass::query_dirty_bitmap support 2024-07-23 17:14:52 +02:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
vhost-user.c vhost-user: return failure if backend crash when live migration 2025-05-14 05:39:15 -04:00