[libvirt PATCH 5/5] qemu: Implement support for vDPA block devices

Peter Krempa pkrempa at redhat.com
Thu Jun 8 11:50:08 UTC 2023


On Tue, Jun 06, 2023 at 16:15:30 -0500, Jonathon Jongsma wrote:
> Requires recent qemu with support for the virtio-blk-vhost-vdpa device
> and the ability to pass a /dev/fdset/N path for the vdpa path (8.1.0)
> 
> Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1900770
> ---
>  src/qemu/qemu_block.c                      | 20 ++++++++--
>  src/qemu/qemu_domain.c                     | 25 ++++++++++++
>  src/qemu/qemu_validate.c                   | 44 +++++++++++++++++++---
>  tests/qemuxml2argvdata/disk-vhostvdpa.args | 35 +++++++++++++++++
>  tests/qemuxml2argvdata/disk-vhostvdpa.xml  | 21 +++++++++++
>  tests/qemuxml2argvtest.c                   |  2 +
>  6 files changed, 139 insertions(+), 8 deletions(-)
>  create mode 100644 tests/qemuxml2argvdata/disk-vhostvdpa.args
>  create mode 100644 tests/qemuxml2argvdata/disk-vhostvdpa.xml

[...]

> diff --git a/tests/qemuxml2argvdata/disk-vhostvdpa.args b/tests/qemuxml2argvdata/disk-vhostvdpa.args
> new file mode 100644
> index 0000000000..878f3b5fce
> --- /dev/null
> +++ b/tests/qemuxml2argvdata/disk-vhostvdpa.args
> @@ -0,0 +1,35 @@
> +LC_ALL=C \
> +PATH=/bin \
> +HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1 \
> +USER=test \
> +LOGNAME=test \
> +XDG_DATA_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.local/share \
> +XDG_CACHE_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.cache \
> +XDG_CONFIG_HOME=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/.config \
> +/usr/bin/qemu-system-x86_64 \
> +-name guest=QEMUGuest1,debug-threads=on \
> +-S \
> +-object secret,id=masterKey0,format=raw,file=/var/lib/libvirt/qemu/domain--1-QEMUGuest1/master-key.aes \
> +-machine pc,usb=off,dump-guest-core=off \
> +-accel tcg \
> +-m 214 \
> +-overcommit mem-lock=off \
> +-smp 1,sockets=1,cores=1,threads=1 \
> +-uuid c7a5fdbd-edaf-9455-926a-d65c16db1809 \
> +-display none \
> +-no-user-config \
> +-nodefaults \
> +-chardev socket,id=charmonitor,fd=1729,server=on,wait=off \
> +-mon chardev=charmonitor,id=monitor,mode=control \
> +-rtc base=utc \
> +-no-shutdown \
> +-no-acpi \
> +-boot strict=on \
> +-usb \
> +-add-fd set=0,fd=1732,opaque=libvirt-1-storage-vdpa \
> +-blockdev '{"driver":"virtio-blk-vhost-vdpa","path":"/dev/fdset/0","node-name":"libvirt-1-storage","cache":{"direct":true,"no-flush":false},"auto-read-only":true,"discard":"unmap"}' \
> +-blockdev '{"node-name":"libvirt-1-format","read-only":false,"cache":{"direct":true,"no-flush":false},"driver":"raw","file":"libvirt-1-storage"}' \

IIUC the use of the 'raw' driver as an additional layer will prevent the
fast path working when it will eventually be implemented in qemu.

There are multiple options how we could eliminate that, but I think I
should excavate my patches for:

https://bugzilla.redhat.com/show_bug.cgi?id=1838189

which asks for removal of the dummy layer also for other cases when it
is not needed.

Alternative ways would require that we limit vdpa to be the only layer
and disallow blockjobs, as both of those cases expect the format layer
to be present.

> +-device virtio-blk-pci,bus=pci.0,addr=0x2,drive=libvirt-1-format,id=virtio-disk0,bootindex=1,write-cache=on \
> +-audiodev '{"id":"audio1","driver":"none"}' \
> +-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
> +-msg timestamp=on



> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c
> index d914d8cbea..928375c173 100644
> --- a/tests/qemuxml2argvtest.c
> +++ b/tests/qemuxml2argvtest.c
> @@ -1224,6 +1224,8 @@ mymain(void)
>      DO_TEST_CAPS_VER("disk-vhostuser-numa", "4.2.0");
>      DO_TEST_CAPS_LATEST("disk-vhostuser-numa");
>      DO_TEST_CAPS_LATEST("disk-vhostuser");
> +    DO_TEST("disk-vhostvdpa",
> +            QEMU_CAPS_DEVICE_VIRTIO_BLK_VHOST_VDPA);

NACK to fake-caps test. I'll regenerate the qemu caps with newer
libblkio and you can then use DO_TEST_CAPS_LATEST here.

Apart from the above the patch looks good.

I'll have my final word after I consider all the blockjob code paths and
snapshots (added by patch 1).


More information about the libvir-list mailing list