qemu/hw/input
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
..
adb-internal.h Supply missing header guards 2019-06-12 13:20:21 +02:00
adb-kbd.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
adb-mouse.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
adb.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
hid.c hw/input: Constify VMState 2023-12-29 11:17:30 +11:00
Kconfig hw/input: Remove lm832x device 2024-10-01 14:41:10 +01:00
lasips2.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
meson.build hw/input: Remove lm832x device 2024-10-01 14:41:10 +01:00
pckbd.c qom: Make InterfaceInfo[] uses const 2025-04-25 17:00:41 +02:00
pl050.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
ps2.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
stellaris_gamepad.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
trace-events hw/input: Remove tsc2005 touchscreen controller 2024-10-01 14:40:30 +01:00
trace.h trace: switch position of headers to what Meson requires 2020-08-21 06:18:24 -04:00
virtio-input-hid.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
virtio-input-host.c qom: Have class_init() take a const data argument 2025-04-25 17:00:41 +02:00
virtio-input.c vhost-user: return failure if backend crash when live migration 2025-05-14 05:39:15 -04:00