vhost-user-blk: Add support for backend reconnecting
A message that is not in the archive (sent off-list or not yet received): [email protected]
Ping...
Quoted 96 lines · On Wed, 20 Mar 2019 at 19:27, <[email protected]> wrote:
From: Xie Yongji <[email protected]>
This patchset is aimed at supporting qemu to reconnect vhost-user-blk backend after vhost-user-blk backend crash or restart.
The patch 1,2,3 introduce started flag to VirtioDevice to fix possible guest hung after migration for virtio 1.0 transitional devices.
The patch 4,5,6 support vhost-user-blk to reconnect backend when connection closed.
The patch 7 introduces
VHOST_USER_PROTOCOL_F_SLAVE_SHMFDto vhost-user-blk backend which is used to tell qemu that we support reconnecting now.To use it, we could start qemu with:
qemu-system-x86_64 \ -chardev socket,id=char0,path=/path/vhost.socket,reconnect=1, \ -device vhost-user-blk-pci,chardev=char0 \and start vhost-user-blk backend with:
vhost-user-blk -b /path/file -s /path/vhost.socket
Then we can restart vhost-user-blk at any time during VM running.
v8:
- Remove merged vhost-user part
- Introduce started flag to VirtioDevice to fix some bugs
- Rework reconnect logic invhost_user_blk_device_realize()v7:
- Introduce a 64-bit counter to struct DescStateSplit/DescStatePacked to preserve the order of fetching available descriptors
- Add support to resubmit inflight I/O in order inlibvhost-user.c
- Renameprocess_headtolast_batch_headin struct DescStateSplitv6:
- Document the layout in inflight buffer for packed virtqueue
- Rework the layout in inflight buffer for split virtqueue
- Remove version field in VhostUserInflight
- Add a patch to remove some redundant check incontrib/libvhost-user.c
- Document more details in vhost-user.txtv5:
- Drop patch that enables "nowait" option on client sockets
- Support resubmitting inflight I/O in order
- Make inflight I/O tracking more robust
- Remove align field and add queue size field in VhostUserInflight
- Document more details in vhost-user.txtv4:
- Drop messagesVHOST_USER_GET_SHM_SIZEandVHOST_USER_SET_SHM_FD
- Introduce two new messagesVHOST_USER_GET_INFLIGHT_FDandVHOST_USER_SET_INFLIGHT_FD
- Allocate inflight buffer in backend rather than in qemu
- Document a recommended format for inflight bufferv3:
- Using exisiting wait/nowait options to control connection on client sockets instead of introducing "disconnected" option.
- Support the case that vhost-user backend restart during initialzation of vhost-user-blk device.v2:
- Introduce "disconnected" option for chardev instead of reuse "wait" option
- Support the case that QEMU starts before vhost-user backend
- Drop messageVHOST_USER_SET_VRING_INFLIGHT
- Introduce two new messagesVHOST_USER_GET_SHM_SIZE
andVHOST_USER_SET_SHM_FDXie Yongji (7):
virtio: Introduce started flag to VirtioDevice
virtio: Use started flag invirtio_vmstate_change()
vhost-user-blk: Use started flag invhost_user_blk_set_status()
vhost-user-blk: Only start vhost-user backend with the first kick
vhost-user-blk: Add return value forvhost_user_blk_start()
vhost-user-blk: Add support to reconnect backend contrib/vhost-user-blk: enable inflight I/O trackingcontrib/vhost-user-blk/vhost-user-blk.c | 3 +- hw/block/vhost-user-blk.c | 175 +++++++++++++++++++----- hw/virtio/virtio.c | 54 +++++++- include/hw/virtio/vhost-user-blk.h | 3 + include/hw/virtio/virtio.h | 2 + 5 files changed, 202 insertions(+), 35 deletions(-)--
2.17.1