qemu/include/system
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
..
accel-blocker.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
accel-ops.h accel: Forward-declare AccelOpsClass in 'qemu/typedefs.h' 2025-03-06 15:46:18 +01:00
address-spaces.h include/system: Move exec/address-spaces.h to system/address-spaces.h 2025-04-23 14:08:21 -07:00
arch_init.h system: Replace arch_type global by qemu_arch_available() helper 2025-03-11 20:03:26 +01:00
balloon.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
block-backend-common.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
block-backend-global-state.h block: Remove unused blk_op_is_blocked() 2025-03-11 15:49:14 +01:00
block-backend-io.h block: Improve blk_get_attached_dev_id() docstring 2025-02-06 13:59:00 +01:00
block-backend.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
block-ram-registrar.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
blockdev.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
confidential-guest-support.h meson: Only allow CONFIG_USER_ONLY from certain source sets 2025-04-23 14:08:44 -07:00
cpu-throttle.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
cpu-timers-internal.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
cpu-timers.h include/exec: Split out icount.h 2025-04-23 14:08:44 -07:00
cpus.h accel: Forward-declare AccelOpsClass in 'qemu/typedefs.h' 2025-03-06 15:46:18 +01:00
cryptodev-vhost-user.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
cryptodev-vhost.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
cryptodev.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
device_tree.h hw: Centralize handling of -machine dumpdtb option 2025-02-24 15:03:42 +00:00
dirtylimit.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
dirtyrate.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
dma.h include/system: Move exec/address-spaces.h to system/address-spaces.h 2025-04-23 14:08:21 -07:00
dump-arch.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
dump.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
event-loop-base.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
host_iommu_device.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
hostmem.h include/system: Move exec/memory.h to system/memory.h 2025-04-23 14:08:21 -07:00
hvf.h system/hvf: Expose hvf_enabled() to common code 2025-05-08 14:22:12 +02:00
hvf_int.h system/hvf: Avoid including 'cpu.h' 2025-05-08 14:22:12 +02:00
hw_accel.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
iommufd.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
ioport.h include/system: Move exec/ioport.h to system/ioport.h 2025-04-23 14:08:21 -07:00
iothread.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
kvm.h system/kvm: make functions accessible from common code 2025-04-25 17:09:58 +02:00
kvm_int.h include/system: Move exec/memory.h to system/memory.h 2025-04-23 14:08:21 -07:00
kvm_xen.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
memory.h include/system: Move exec/memory.h to system/memory.h 2025-04-23 14:08:21 -07:00
memory_mapping.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
numa.h system/numa: Remove unnecessary 'exec/cpu-common.h' header 2024-12-20 17:44:57 +01:00
nvmm.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
os-posix.h os: add an ability to lock memory on_fault 2025-02-12 11:36:01 -05:00
os-wasm.h include/qemu/osdep.h: Add Emscripten-specific OS dependencies 2025-05-06 16:02:04 +02:00
os-win32.h cleanup: Drop pointless return at end of function 2025-04-24 09:33:42 +02:00
qtest.h include/system: Remove ifndef CONFIG_USER_ONLY in qtest.h 2025-04-23 14:08:44 -07:00
ram_addr.h include: Remove 'exec/exec-all.h' 2025-04-30 12:45:05 -07:00
ramblock.h include/system: Move exec/ramblock.h to system/ramblock.h 2025-04-23 14:08:26 -07:00
replay.h meson: Only allow CONFIG_USER_ONLY from certain source sets 2025-04-23 14:08:44 -07:00
reset.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
rng-random.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
rng.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
rtc.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
runstate-action.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
runstate.h system/runstate: add VM state change cb with return value 2025-05-14 05:39:14 -04:00
seccomp.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
spdm-socket.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
stats.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
system.h overcommit: introduce mem-lock=on-fault 2025-02-12 11:36:13 -05:00
tcg.h tcg: Move qemu_tcg_mttcg_enabled() to 'system/tcg.h' 2025-04-23 15:07:32 -07:00
tpm.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
tpm_backend.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
tpm_util.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
vhost-user-backend.h vhost-user: return failure if backend crash when live migration 2025-05-14 05:39:15 -04:00
watchdog.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
whpx.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
xen-mapcache.h system/xen: remove inline stubs 2025-04-23 13:52:37 -07:00
xen.h meson: Only allow CONFIG_USER_ONLY from certain source sets 2025-04-23 14:08:44 -07:00