Skip to content

virtio: Always reset vhost devices

Hanna Czenczek qemu-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 1 replyIn review
  2. v11 patch 4 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2virtio: Allow .get_vhost() without vhost_startedhw/display/vhost-user-gpu.c hw/net/virtio-net.c hw/virtio/virtio-crypto.c +1 more+34 -61 reply
2/2virtio: Always reset vhost deviceshw/virtio/virtio.c+6 -20 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchStefan HajnocziMichael S. Tsirkin
1/2R-b
2/2R-b R-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/2] virtio: Always reset vhost devices

Hi,

As explained in patch 2 (the main one) of this series, we currently don’t issue the RESET_DEVICE command to vhost back-ends, even though we fully intend to do so.

The problem is that sending this command is gated behind a vhost_started check, but at that point (during the device reset process), the device is actually stopped, and so vhost_started is false. We still want to send RESET_DEVICE there, so patch 2 removes the vhost_started condition.

This means that we need to be able to call VirtioDeviceClass.get_vhost() when vhost_started is false. For most .get_vhost() implementations, that’s perfectly fine; but three of them (crypto, gpu, net) dereference some pointers, so if any of them is NULL, we have to explicitly return NULL in those implementations. That’s what patch 1 is for.

This time, I’ve run make check with ubsan; I can confirm that v1 generated errors for vhost-net, but with patch 1 added, it’s clean. I’ve also run the CI pipeline:
https://gitlab.com/hreitz/qemu/-/pipelines/1384524949
Specifically, clang-system passed:
https://gitlab.com/hreitz/qemu/-/jobs/7406688234
The only failure is msys2-64bit, which timed out (re-tried repeatedly), but judging from https://gitlab.com/qemu-project/qemu/-/pipelines, I think that’s expected.

v2: Added patch 1, left patch 2 unchanged.

Hanna Czenczek (2):
virtio: Allow .get_vhost() without vhost_started
virtio: Always reset vhost devices

 include/hw/virtio/virtio.h  |  1 +
 hw/display/vhost-user-gpu.c |  2 +-
 hw/net/virtio-net.c         | 19 +++++++++++++++++--
 hw/virtio/virtio-crypto.c   | 18 +++++++++++++++---
 hw/virtio/virtio.c          |  8 ++++++--
 5 files changed, 40 insertions(+), 8 deletions(-)
Signature · 1 line
2.45.2