hw/virtio/vhost-shadow-virtqueue.c | 313 ++++++++++++++++++++++++++--- hw/virtio/vhost-shadow-virtqueue.h | 45 +++++ hw/virtio/vhost-vdpa.c | 163 ++++++++++++++- 3 files changed, 495 insertions(+), 26 deletions(-)
From: wafer Xie <wafer@jaguarmicro.com>
This patch series adds support for VIRTIO split indirect descriptors.
The feature is VIRTIO_RING_F_INDIRECT_DESC.
Eugenio hs submitted a patch: vhost: accept indirect descriptors in shadow virtqueue
https://lists.nongnu.org/archive/html/qemu-devel/2025-12/msg00056.html
Therefore, this patch must be applied first.
The current svq implementation can read the indirect descriptors provided by the driver,
but it cannot use indirect descriptors when interacting with the backend device.
However, if a backend device implements indirect descriptors and wants to use QEMU
to validate its indirect descriptor support,
then QEMU needs to fully support indirect descriptors in this path.
This series is intended to provide that full support,
so that such backend devices can be properly tested and validated via QEMU.
Multiple buffers are used to store indirect descriptors, and each buffer has a size of ring.num * 4.
Each buffer has two states: FREED and FREEING.
When adding elements to the virtio available ring,
descriptors can only be allocated from buffers in the FREED state.
If the current buffer does not have enough FREED descriptors,
its state is changed to FREEING,
and descriptors are then allocated from another buffer in the FREED state.
When retrieving entries from the virtio used ring,
descriptors are returned to the buffer indicated
by the buffer index associated with the element.
If all descriptors in a buffer have been reclaimed,
the buffer’s state is changed back to FREED.
Performance (pps) was evaluated using testpmd, comparing three scenarios:
1) fully indirect descriptors(apply this path series, indirect_desc=on)
guset<--------indirect desc-----SVQ-------indirect desc----->device
2) hybrid mode with indirect plus chained descriptors(only apply VIRTIO_RING_F_INDIRECT_DESC, indirect_desc=on)
guset<--------indirect desc-----SVQ-------chain desc----->device
3) fully chained descriptor mode(don't apply any patch,indirect_desc=off).
guset<--------chain desc-----SVQ-------chain desc----->device
The results show that the fully indirect descriptor mode achieves approximately 5%~10% higher performance than the indirect + chained descriptor mode,
and approximately 12%~17% higher performance than the fully chained descriptor mode.
The raw testpmd output is provided below.
testpmd configuration:
1) set txonly; set txpkts 2048,1024;set burst 8
fully indirect descriptors:
######################## NIC statistics for port 0 ########################
RX-packets: 256 RX-missed: 0 RX-bytes: 491520
RX-errors: 0
RX-nombuf: 0
TX-packets: 74700761 TX-errors: 0 TX-bytes: 307543211008
Throughput (since last show)
Rx-pps: 0 Rx-bps: 0
Tx-pps: 745609 Tx-bps: 18324096544
############################################################################
hybrid mode with indirect plus chained descriptors
######################## NIC statistics for port 0 ########################
RX-packets: 256 RX-missed: 0 RX-bytes: 491520
RX-errors: 0
RX-nombuf: 0
TX-packets: 44153053 TX-errors: 0 TX-bytes: 202580423680
Throughput (since last show)
Rx-pps: 0 Rx-bps: 0
Tx-pps: 674954 Tx-bps: 16587671544
############################################################################
fully chained descriptor mode:
######################## NIC statistics for port 0 ########################
RX-packets: 256 RX-missed: 0 RX-bytes: 491520
RX-errors: 0
RX-nombuf: 0
TX-packets: 48458913 TX-errors: 0 TX-bytes: 212695989248
Throughput (since last show)
Rx-pps: 0 Rx-bps: 0
Tx-pps: 665493 Tx-bps: 16355164120
############################################################################
2) set txonly; set txpkts 2048,2048,1024;set burst 8
fully indirect descriptors:
######################## NIC statistics for port 0 ########################
RX-packets: 0 RX-missed: 0 RX-bytes: 0
RX-errors: 0
RX-nombuf: 0
TX-packets: 18193774 TX-errors: 0 TX-bytes: 93152122880
Throughput (since last show)
Rx-pps: 0 Rx-bps: 0
Tx-pps: 683537 Tx-bps: 27997687072
############################################################################
hybrid mode with indirect plus chained descriptors
######################## NIC statistics for port 0 ########################
RX-packets: 0 RX-missed: 0 RX-bytes: 0
RX-errors: 0
RX-nombuf: 0
TX-packets: 18948021 TX-errors: 0 TX-bytes: 97013867520
Throughput (since last show)
Rx-pps: 0 Rx-bps: 0
Tx-pps: 646147 Tx-bps: 26466218232
############################################################################
fully chained descriptor mode:
######################## NIC statistics for port 0 ########################
RX-packets: 0 RX-missed: 0 RX-bytes: 0
RX-errors: 0
RX-nombuf: 0
TX-packets: 15944245 TX-errors: 0 TX-bytes: 81634534400
Throughput (since last show)
Rx-pps: 0 Rx-bps: 0
Tx-pps: 583981 Tx-bps: 23919889848
############################################################################
-----
Changes in v2:
-Use a static allocated buffer for the indirect descriptors
wafer Xie (4):
vhost: add data structure of virtio indirect descriptors in SVQ
vdpa: implement a statically allocated buffer for SVQ
vhost: SVQ get the indirect descriptors from used ring
vhost: SVQ add the indirect descriptors to available ring
hw/virtio/vhost-shadow-virtqueue.c | 313 ++++++++++++++++++++++++++---
hw/virtio/vhost-shadow-virtqueue.h | 45 +++++
hw/virtio/vhost-vdpa.c | 163 ++++++++++++++-
3 files changed, 495 insertions(+), 26 deletions(-)
--
2.48.1
© 2016 - 2025 Red Hat, Inc.