Skip to content

RFC vhost-user: Shutdown/Flush slave channel properly

Vivek Goyal qemu-devel virtio-fs 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 19 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6virtiofsd: Drop ->vu_dispatch_rwlock while waiting for thread to exittools/virtiofsd/fuse_virtio.c+14 -04 replies
2/6libvhost-user: Use slave_mutex in all slave messagessubprojects/libvhost-user/libvhost-user.c+27 -233 replies
3/6vhost-user: Return error code from slave_read()hw/virtio/vhost-user.c+37 -62 replies
4/6qemu, vhost-user: Extend protocol to start/stop/flush slave channelhw/virtio/vhost-user.c+108 -04 replies
5/6libvhost-user: Add support to start/stop/flush slave channelsubprojects/libvhost-user/libvhost-user.c subprojects/libvhost-user/libvhost-user.h+105 -60 replies
6/6virtiofsd: Opt in for slave start/stop/shutdown functionalitytools/virtiofsd/fuse_virtio.c+6 -00 replies

Reviews trailers per patch

1 of 6 patches has a Reviewed-by or Acked-by.

PatchGreg Kurz
1/6
2/6R-b
3/6
4/6
5/6
6/6

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [RFC PATCH 0/6] vhost-user: Shutdown/Flush slave channel properly

Hi,

We are working on DAX support in virtiofs and have some patches out of the tree hosted here.

https://gitlab.com/virtio-fs/qemu/-/commits/virtio-fs-dev

These patches have not been proposed for merge yet, becasue David Gilbert noticed that we can run into a deadlock during an emergency reboot of guest kernel. (echo b > /proc/sysrq-trigger).

I have provided details of deadlock in 4th path of the series with subject "qemu, vhost-user: Extend protocol to start/stop/flush slave channel".

Basic problem seems to be that we don't have a proper mechanism to shutdown slave channel when vhost-user device is stopping. This means there might be pending messages in slave channel and slave is blocked and waiting for response.

This is an RFC patch series to enhance vhost-user protocol to properly shutdown/flush slave channel and avoid the deadlock. Though we faced the issue in the context of virtiofs, any vhost-user device using slave channel can potentially run into issues and can benefit from these patches.

Any feedback is welcome. Currently patches are based on out of tree code but after I get some feedback, I can only take pieces which are relevant to upstream and post separately.

Thanks
Vivek

Vivek Goyal (6):
virtiofsd: Drop ->vu_dispatch_rwlock while waiting for thread to exit
libvhost-user: Use slave_mutex in all slave messages
vhost-user: Return error code from slave_read()
qemu, vhost-user: Extend protocol to start/stop/flush slave channel
libvhost-user: Add support to start/stop/flush slave channel
virtiofsd: Opt in for slave start/stop/shutdown functionality

 hw/virtio/vhost-user.c                    | 151 +++++++++++++++++++++-
 subprojects/libvhost-user/libvhost-user.c | 147 +++++++++++++++++----
 subprojects/libvhost-user/libvhost-user.h |   8 +-
 tools/virtiofsd/fuse_virtio.c             |  20 +++
 4 files changed, 294 insertions(+), 32 deletions(-)
Signature · 1 line
2.25.4