You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qemu/backends
Stefano Garzarella 4daa5054c5 vhost: enable vrings in vhost_dev_start() for vhost-user devices
Commit 02b61f38d3 ("hw/virtio: incorporate backend features in features")
properly negotiates VHOST_USER_F_PROTOCOL_FEATURES with the vhost-user
backend, but we forgot to enable vrings as specified in
docs/interop/vhost-user.rst:

    If ``VHOST_USER_F_PROTOCOL_FEATURES`` has not been negotiated, the
    ring starts directly in the enabled state.

    If ``VHOST_USER_F_PROTOCOL_FEATURES`` has been negotiated, the ring is
    initialized in a disabled state and is enabled by
    ``VHOST_USER_SET_VRING_ENABLE`` with parameter 1.

Some vhost-user front-ends already did this by calling
vhost_ops.vhost_set_vring_enable() directly:
- backends/cryptodev-vhost.c
- hw/net/virtio-net.c
- hw/virtio/vhost-user-gpio.c

But most didn't do that, so we would leave the vrings disabled and some
backends would not work. We observed this issue with the rust version of
virtiofsd [1], which uses the event loop [2] provided by the
vhost-user-backend crate where requests are not processed if vring is
not enabled.

Let's fix this issue by enabling the vrings in vhost_dev_start() for
vhost-user front-ends that don't already do this directly. Same thing
also in vhost_dev_stop() where we disable vrings.

[1] https://gitlab.com/virtio-fs/virtiofsd
[2] https://github.com/rust-vmm/vhost/blob/240fc2966/crates/vhost-user-backend/src/event_loop.rs#L217

Fixes: 02b61f38d3 ("hw/virtio: incorporate backend features in features")
Reported-by: German Maglione <gmaglione@redhat.com>
Tested-by: German Maglione <gmaglione@redhat.com>
Signed-off-by: Stefano Garzarella <sgarzare@redhat.com>
Acked-by: Raphael Norwitz <raphael.norwitz@nutanix.com>
Message-Id: <20221123131630.52020-1-sgarzare@redhat.com>
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Message-Id: <20221130112439.2527228-3-alex.bennee@linaro.org>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2 years ago
..
tpm tpm_emulator: Have swtpm relock storage upon migration fall-back 2 years ago
Kconfig tpm: Move backend code under the 'backends/' directory 4 years ago
confidential-guest-support.c confidential guest support: Introduce new confidential guest support class 4 years ago
cryptodev-builtin.c virtio-crypto: Support asynchronous mode 2 years ago
cryptodev-lkcf.c cryptodev: Add a lkcf-backend for cryptodev 2 years ago
cryptodev-vhost-user.c virtio-crypto: Support asynchronous mode 2 years ago
cryptodev-vhost.c vhost: enable vrings in vhost_dev_start() for vhost-user devices 2 years ago
cryptodev.c virtio-crypto: Support asynchronous mode 2 years ago
dbus-vmstate.c dbus-vmstate: Restrict error checks to registered proxies in dbus_get_proxies 2 years ago
dbus-vmstate1.xml docs: move D-Bus VMState documentation to source XML 3 years ago
hostmem-epc.c Remove qemu-common.h include from most units 3 years ago
hostmem-file.c include: Move qemu_madvise() and related #defines to new qemu/madvise.h 3 years ago
hostmem-memfd.c hostmem: Wire up RAM_NORESERVE via "reserve" property 3 years ago
hostmem-ram.c hostmem: Wire up RAM_NORESERVE via "reserve" property 3 years ago
hostmem.c hostmem: Allow for specifying a ThreadContext for preallocation 2 years ago
meson.build cryptodev: Add a lkcf-backend for cryptodev 2 years ago
rng-builtin.c replay: rng-builtin support 4 years ago
rng-egd.c backends: Improve error messages when property can no longer be set 2 years ago
rng-random.c backends: Improve error messages when property can no longer be set 2 years ago
rng.c rng: make opened property read-only 3 years ago
trace-events docs: fix references to docs/devel/tracing.rst 4 years ago
trace.h trace: switch position of headers to what Meson requires 4 years ago
vhost-user.c vhost: enable vrings in vhost_dev_start() for vhost-user devices 2 years ago