qemu-cr16/include/hw/virtio
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
..
cbor-helpers.h
iothread-vq-mapping.h virtio: extract iothread-vq-mapping.h API 2025-03-13 17:57:23 +01:00
vdpa-dev.h
vhost-backend.h include/system: Move exec/memory.h to system/memory.h 2025-04-23 14:08:21 -07:00
vhost-scsi-common.h vhost-user: return failure if backend crash when live migration 2025-05-14 05:39:15 -04:00
vhost-scsi.h
vhost-user-base.h
vhost-user-blk.h
vhost-user-fs.h
vhost-user-gpio.h
vhost-user-i2c.h
vhost-user-rng.h
vhost-user-scmi.h
vhost-user-scsi.h
vhost-user-snd.h
vhost-user-vsock.h
vhost-user.h
vhost-vdpa.h
vhost-vsock-common.h vhost-user: return failure if backend crash when live migration 2025-05-14 05:39:15 -04:00
vhost-vsock.h
vhost.h vhost: return failure if stop virtqueue failed in vhost_dev_stop 2025-05-14 05:39:14 -04:00
virtio-access.h
virtio-acpi.h
virtio-balloon.h hw/virtio: reset virtio balloon stats on machine reset 2025-02-21 07:18:42 -05:00
virtio-blk-common.h
virtio-blk.h hw/vmapple/virtio-blk: Add support for apple virtio-blk 2025-03-04 14:45:34 +01:00
virtio-bus.h
virtio-crypto.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
virtio-dmabuf.h
virtio-gpu-bswap.h
virtio-gpu-pci.h
virtio-gpu-pixman.h
virtio-gpu.h virtio-gpu: Add definition for resource_uuid feature 2025-01-15 13:05:26 -05:00
virtio-input.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
virtio-iommu.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
virtio-md-pci.h
virtio-mem.h Hi, 2024-12-22 14:33:27 -05:00
virtio-mmio.h
virtio-net.h hw/net/virtio-net.c: Don't assume IP length field is aligned 2024-11-18 13:45:45 +01:00
virtio-nsm.h
virtio-pci.h virtio-pci: Implement SR-IOV PF 2025-05-14 05:39:14 -04:00
virtio-pmem.h
virtio-rng.h include: Rename sysemu/ -> system/ 2024-12-20 17:44:56 +01:00
virtio-scsi.h virtio-scsi: handle ctrl virtqueue in main loop 2025-03-13 17:57:23 +01:00
virtio-serial.h
virtio.h vhost-user: return failure if backend crash when live migration 2025-05-14 05:39:15 -04:00