Skip to content

ASID support in vhost-vdpa net

Eugenio Pérez kvm qemu-devel virtualization 9 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v9 Latest12 patches 5 repliesIn review
  2. v812 patches 7 repliesSuperseded
  3. v710 patches 9 repliesSuperseded
Earlier versions · 6
VersionPostedPatchesRepliesStatus
v610 patches35 repliesSuperseded
v56 patches7 repliesSuperseded
v46 patches6 repliesSuperseded
v37 patches8 repliesSuperseded
v27 patches5 repliesSuperseded
v16 patches1 replySuperseded

Changes in v9 from the cover letter

- Reuse iova_range fetched from the device at initialization, instead of fetch it again at vhost_vdpa_net_cvq_start.
- Add comment about how migration is blocked in case ASID does not met our expectations.
- Delete warning about CVQ group not being independent.

Patches in v9 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/12vdpa: use v->shadow_vqs_enabled in vhost_vdpa_svqs_start & stophw/virtio/vhost-vdpa.c+2 -20 replies
2/12vhost: set SVQ device call handler at SVQ starthw/virtio/vhost-shadow-virtqueue.c+2 -20 replies
3/12vhost: allocate SVQ device file descriptors at device starthw/virtio/vhost-shadow-virtqueue.c hw/virtio/vhost-vdpa.c+30 -360 replies
4/12vhost: move iova_tree set to vhost_svq_starthw/virtio/vhost-shadow-virtqueue.c hw/virtio/vhost-shadow-virtqueue.h hw/virtio/vhost-vdpa.c+8 -110 replies
5/12vdpa: add vhost_vdpa_net_valid_svq_featuresnet/vhost-vdpa.c+17 -90 replies
6/12vdpa: request iova_range only oncehw/virtio/vhost-vdpa.c net/vhost-vdpa.c+14 -284 replies
7/12vdpa: move SVQ vring features check to net/hw/virtio/vhost-vdpa.c net/vhost-vdpa.c+4 -310 replies
8/12vdpa: allocate SVQ array unconditionallyhw/virtio/vhost-vdpa.c+0 -40 replies
9/12vdpa: add asid parameter to vhost_vdpa_dma_map/unmaphw/virtio/trace-events hw/virtio/vhost-vdpa.c include/hw/virtio/vhost-vdpa.h +1 more+41 -190 replies
10/12vdpa: store x-svq parameter in VhostVDPAStatenet/vhost-vdpa.c+3 -00 replies
11/12vdpa: add shadow_data to vhost_vdpahw/virtio/vhost-vdpa.c include/hw/virtio/vhost-vdpa.h net/vhost-vdpa.c+6 -30 replies
12/12vdpa: always start CVQ in SVQ mode if possiblehw/virtio/vhost-vdpa.c net/vhost-vdpa.c+111 -21 reply

Reviews trailers per patch

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

PatchJason Wang
1/12A-b
2/12A-b
3/12A-b
4/12A-b
5/12A-b
6/12A-b
7/12A-b
8/12A-b
9/12A-b
10/12A-b
11/12A-b
12/12A-b

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

Read the v9 thread

Cover letter [PATCH v9 00/12] ASID support in vhost-vdpa net

Control VQ is the way net devices use to send changes to the device state, like the number of active queues or its mac address.

QEMU needs to intercept this queue so it can track these changes and is able to migrate the device. It can do it from 1576dbb5bbc4 ("vdpa: Add x-svq to NetdevVhostVDPAOptions"). However, to enable x-svq implies to shadow all VirtIO device's virtqueues, which will damage performance.

This series adds address space isolation, so the device and the guest communicate directly with them (passthrough) and CVQ communication is split in
two: The guest communicates with qemu and qemu forwards the commands to the device.

Comments are welcome. Thanks!

v9:
- Reuse iova_range fetched from the device at initialization, instead of fetch it again at vhost_vdpa_net_cvq_start.
- Add comment about how migration is blocked in case ASID does not met our expectations.
- Delete warning about CVQ group not being independent.

v8:
- Do not allocate iova_tree on net_init_vhost_vdpa if only CVQ is shadowed. Move the iova_tree allocation to vhost_vdpa_net_cvq_start and vhost_vdpa_net_cvq_stop in this case.

v7:
- Never ask for number of address spaces, just react if isolation is not possible.
- Return ASID ioctl errors instead of masking them as if the device has no asid.
- Rename listener_shadow_vq to shadow_data
- Move comment on zero initailization of vhost_vdpa_dma_map above the functions.
- Add VHOST_VDPA_GUEST_PA_ASID macro.

v6:
- Do not allocate SVQ resources like file descriptors if SVQ cannot be used.
- Disable shadow CVQ if the device does not support it because of net features.

v5:
- Move vring state in vhost_vdpa_get_vring_group instead of using a parameter.
- Rename VHOST_VDPA_NET_CVQ_PASSTHROUGH to VHOST_VDPA_NET_DATA_ASID

v4:
- Rebased on last CVQ start series, that allocated CVQ cmd bufs at load
- Squash vhost_vdpa_cvq_group_is_independent.
- Do not check for cvq index on vhost_vdpa_net_prepare, we only have one that callback registered in that NetClientInfo.
- Add comment specifying behavior if device does not support _F_ASID
- Update headers to a later Linux commit to not to remove SETUP_RNG_SEED

v3:
- Do not return an error but just print a warning if vdpa device initialization returns failure while getting AS num of VQ groups
- Delete extra newline

v2:
- Much as commented on series [1], handle vhost_net backend through NetClientInfo callbacks instead of directly.
- Fix not freeing SVQ properly when device does not support CVQ
- Add BIT_ULL missed checking device's backend feature for _F_ASID.

Eugenio Pérez (12):
vdpa: use v->shadow_vqs_enabled in vhost_vdpa_svqs_start & stop
vhost: set SVQ device call handler at SVQ start
vhost: allocate SVQ device file descriptors at device start
vhost: move iova_tree set to vhost_svq_start
vdpa: add vhost_vdpa_net_valid_svq_features
vdpa: request iova_range only once
vdpa: move SVQ vring features check to net/
vdpa: allocate SVQ array unconditionally
vdpa: add asid parameter to vhost_vdpa_dma_map/unmap
vdpa: store x-svq parameter in VhostVDPAState
vdpa: add shadow_data to vhost_vdpa
vdpa: always start CVQ in SVQ mode if possible

 hw/virtio/vhost-shadow-virtqueue.h |   5 +-
 include/hw/virtio/vhost-vdpa.h     |  16 ++-
 hw/virtio/vhost-shadow-virtqueue.c |  44 ++------
 hw/virtio/vhost-vdpa.c             | 140 +++++++++++------------
 net/vhost-vdpa.c                   | 174 ++++++++++++++++++++++++-----
 hw/virtio/trace-events             |   4 +-
 6 files changed, 237 insertions(+), 146 deletions(-)
Signature · 1 line
2.31.1