Skip to content

Add queue ready message to VDUSE

Eugenio Pérez lkml virtualization 4 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 0 repliesNew
  2. v33 patches 15 repliesSuperseded
  3. v25 patches 8 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v16 patches26 repliesSuperseded

Changes in v4 from the cover letter

* Create its own spinlock for vq->ready instead of relying on kick and call spinlocks.
* Add VDUSE_SET_FEATURES ioctl and the corresponding validation paths instead of using device config.

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4vduse: store control device pointerdrivers/vdpa/vdpa_user/vduse_dev.c+5 -40 replies
2/4vduse: add VDUSE_GET_FEATURES ioctldrivers/vdpa/vdpa_user/vduse_dev.c include/uapi/linux/vduse.h+10 -00 replies
3/4vduse: add VDUSE_SET_FEATURES ioctldrivers/vdpa/vdpa_user/vduse_dev.c include/uapi/linux/vduse.h+27 -00 replies
4/4vduse: add F_QUEUE_READY featuredrivers/vdpa/vdpa_user/vduse_dev.c include/uapi/linux/vduse.h+74 -170 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/4] Add queue ready message to VDUSE

This series introduces a new VDUSE message for VDUSE userland instance to detect when a VirtQueue (VQ) is enabled, replacing the polling.

VirtIO net devices' dataplane is started after the control virtqueue so QEMU can apply the configuration in the destination of a Live Migration. Without this feature, the VDUSE instance must poll the VQs to check when (and if) a VQ has been enabled.

This series also implements VDUSE feature flags allowing the VDUSE devices to opt-in to the VQ ready message. Devices that opt-in to this feature will receive explicit notifications when a VQ is ready. Devices that do not set this flag remain unaffected, ensuring backward compatibility without indefinitely incrementing API versions.

The VDUSE features is a 64 bit bitmap for simplicity, the same way as vhost and vhost-net started. It can be extended as a flexible array of bits when we reach so many features, but it seems unlikely at this point.

Error cases tested:
* Call VDUSE_GET_FEATURES without get the API VERSION (so API == 0) and with API VERSION set to 1 with VDUSE_SET_API_VERSION (-EINVAL returned from VDUSE_GET_FEATURES ioctl).
* Try to set invalid features.
* Test regular initialization of single queue devices with and without VDUSE_F_QUEUE_READY set.
* Test expected behavior when VDUSE userland instance returns VDUSE_REQ_RESULT_FAILED from VDUSE_SET_VQ_READY message.
* Repeat all the tests with multiqueue devices, by reverting 56e71885b0349 ("vduse: Temporarily fail if control queue feature requested").

v4:
* Create its own spinlock for vq->ready instead of relying on kick and call spinlocks.
* Add VDUSE_SET_FEATURES ioctl and the corresponding validation paths instead of using device config.

v3:
* Remove API_VERSION bump to 2
* Add comment about struct vduse_dev_config:vduse_features is only valid if VDUSE_GET_FEATURES success.

v2:
* Fix comment of vduse_dev_request.vq_ready
* Set vq_ready before sending the message to the VDUSE userland instance, avoiding the need for SMP sync after receiving the message.
* Return -EINVAL if control ioctl called with version < 2, so userland visible reply is kept (Jason).

Eugenio Pérez (4):
vduse: store control device pointer
vduse: add VDUSE_GET_FEATURES ioctl
vduse: add VDUSE_SET_FEATURES ioctl
vduse: add F_QUEUE_READY feature

 drivers/vdpa/vdpa_user/vduse_dev.c | 111 +++++++++++++++++++++++------
 include/uapi/linux/vduse.h         |  24 +++++++
 2 files changed, 115 insertions(+), 20 deletions(-)
Signature · 1 line
2.55.0