Skip to content

vhost: clean up device reset

Stefan Hajnoczi qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 6 repliesIn review
  2. v13 patches 7 repliesSuperseded

Changes in v2 from the cover letter

- Fix compilation error when vhost is not built [Michael]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3vhost-user: do not send RESET_OWNER on device resethw/scsi/vhost-user-scsi.c hw/virtio/vhost-user.c+9 -133 replies
2/3vhost-backend: remove vhost_kernel_reset_device()hw/virtio/vhost-backend.c+0 -61 reply
3/3virtio: call ->vhost_reset_device() during resethw/scsi/vhost-user-scsi.c hw/virtio/vhost.c hw/virtio/virtio.c +2 more+24 -111 reply

Reviews trailers per patch

2 of 3 patches have a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchRaphael NorwitzHanna Czenczek
SeriesR-b
1/3
2/3R-b
3/3R-b

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

Read the v2 thread

Cover letter [PATCH v2 0/3] vhost: clean up device reset

v2:
- Fix compilation error when vhost is not built [Michael]

Stateful vhost devices may need to free resources or clear device state upon device reset. The vhost-user protocol has a VHOST_USER_RESET_DEVICE message for this and vDPA has SET_STATUS 0, but only QEMU's vhost-user-scsi device actually implements this today.

This patch series performs device reset across all device types. When virtio_reset() is called, the associated vhost_dev's ->vhost_reset_device() is called. vhost-user-scsi's one-off implementation is obsoleted and removed.

This patch affects behavior as follows:
- vhost-kernel: no change in behavior. No ioctl calls are made.
- vhost-user: back-ends that negotiate VHOST_USER_PROTOCOL_F_RESET_DEVICE now receive a VHOST_USER_DEVICE_RESET message upon device reset. Otherwise there is no change in behavior. DPDK, SPDK, libvhost-user, and the vhost-user-backend crate do not negotiate VHOST_USER_PROTOCOL_F_RESET_DEVICE automatically.
- vhost-vdpa: an extra SET_STATUS 0 call is made during device reset.

I have tested this series with vhost-net (kernel), vhost-user-blk, and vhost-user-fs (both Rust and legacy C).

Stefan Hajnoczi (3):
vhost-user: do not send RESET_OWNER on device reset
vhost-backend: remove vhost_kernel_reset_device()
virtio: call ->vhost_reset_device() during reset

 meson.build               |  1 +
 include/hw/virtio/vhost.h | 10 ++++++++++
 hw/scsi/vhost-user-scsi.c | 20 --------------------
 hw/virtio/vhost-backend.c |  6 ------
 hw/virtio/vhost-user.c    | 13 +++++++++----
 hw/virtio/vhost.c         |  9 +++++++++
 hw/virtio/virtio.c        |  4 ++++
 7 files changed, 33 insertions(+), 30 deletions(-)
Signature · 1 line
2.41.0