|
|
119c2d |
From 68b294cf8e9c5e0f0f14b14e63178b2bf7a9f7e2 Mon Sep 17 00:00:00 2001
|
|
|
119c2d |
Message-Id: <68b294cf8e9c5e0f0f14b14e63178b2bf7a9f7e2@dist-git>
|
|
|
119c2d |
From: Jonathon Jongsma <jjongsma@redhat.com>
|
|
|
119c2d |
Date: Tue, 29 Mar 2022 14:24:36 -0500
|
|
|
119c2d |
Subject: [PATCH] qemu: fix hotplug for multiqueue vdpa net device
|
|
|
119c2d |
MIME-Version: 1.0
|
|
|
119c2d |
Content-Type: text/plain; charset=UTF-8
|
|
|
119c2d |
Content-Transfer-Encoding: 8bit
|
|
|
119c2d |
|
|
|
119c2d |
While commit a5e659f0 removed the restriction against multiple queues
|
|
|
119c2d |
for the vdpa net device, there were some missing pieces. Configuring a
|
|
|
119c2d |
device statically and then starting the domain worked as expected, but
|
|
|
119c2d |
hotplugging a device didn't have the expected multiqueue support
|
|
|
119c2d |
enabled. Add the missing bits.
|
|
|
119c2d |
|
|
|
119c2d |
Consider the following device xml:
|
|
|
119c2d |
<interface type="vdpa">
|
|
|
119c2d |
<mac address="00:11:22:33:44:03" />
|
|
|
119c2d |
<source dev="/dev/vhost-vdpa-0" />
|
|
|
119c2d |
<model type="virtio" />
|
|
|
119c2d |
<driver queues='2' />
|
|
|
119c2d |
</interface>
|
|
|
119c2d |
|
|
|
119c2d |
Without this patch, hotplugging the above XML description resulted in
|
|
|
119c2d |
the following:
|
|
|
119c2d |
{"execute":"netdev_add","arguments":{"type":"vhost-vdpa","vhostdev":"/dev/fdset/0","id":"hostnet1"},"id":"libvirt-392"}
|
|
|
119c2d |
{"execute":"device_add","arguments":{"driver":"virtio-net-pci","netdev":"hostnet1","id":"net1","mac":"00:11:22:33:44:03","bus":"pci.5","addr":"0x0"},"id":"libvirt-393"}
|
|
|
119c2d |
|
|
|
119c2d |
With the patch, hotplugging results in the following:
|
|
|
119c2d |
{"execute":"netdev_add","arguments":{"type":"vhost-vdpa","vhostdev":"/dev/fdset/0","queues":2,"id":"hostnet1"},"id":"libvirt-392"}
|
|
|
119c2d |
{"execute":"device_add","arguments":{"driver":"virtio-net-pci","mq":true,"vectors":6,"netdev":"hostnet1","id":"net1","mac":"00:11:22:33:44:03","bus":"pci.5","addr":"0x0"},"id":"libvirt-393"}
|
|
|
119c2d |
|
|
|
119c2d |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2024406
|
|
|
119c2d |
|
|
|
119c2d |
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
|
|
|
119c2d |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
119c2d |
|
|
|
119c2d |
(cherry picked from commit 3832db21084661d00438dfbb4bad865816157dd9)
|
|
|
119c2d |
Signed-off-by: Jonathon Jongsma <jjongsma@redhat.com>
|
|
|
119c2d |
---
|
|
|
119c2d |
src/qemu/qemu_command.c | 4 ++++
|
|
|
119c2d |
src/qemu/qemu_hotplug.c | 3 +++
|
|
|
119c2d |
tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args | 2 +-
|
|
|
119c2d |
3 files changed, 8 insertions(+), 1 deletion(-)
|
|
|
119c2d |
|
|
|
119c2d |
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
|
|
|
119c2d |
index 509bab08ef..ee0e611513 100644
|
|
|
119c2d |
--- a/src/qemu/qemu_command.c
|
|
|
119c2d |
+++ b/src/qemu/qemu_command.c
|
|
|
119c2d |
@@ -4349,6 +4349,10 @@ qemuBuildHostNetProps(virDomainNetDef *net,
|
|
|
119c2d |
if (virJSONValueObjectAdd(&netprops, "s:type", "vhost-vdpa", NULL) < 0 ||
|
|
|
119c2d |
virJSONValueObjectAppendString(netprops, "vhostdev", vdpadev) < 0)
|
|
|
119c2d |
return NULL;
|
|
|
119c2d |
+
|
|
|
119c2d |
+ if (net->driver.virtio.queues > 1 &&
|
|
|
119c2d |
+ virJSONValueObjectAppendNumberUlong(netprops, "queues", net->driver.virtio.queues) < 0)
|
|
|
119c2d |
+ return NULL;
|
|
|
119c2d |
break;
|
|
|
119c2d |
|
|
|
119c2d |
case VIR_DOMAIN_NET_TYPE_HOSTDEV:
|
|
|
119c2d |
diff --git a/src/qemu/qemu_hotplug.c b/src/qemu/qemu_hotplug.c
|
|
|
119c2d |
index 04c6600f26..c10493e212 100644
|
|
|
119c2d |
--- a/src/qemu/qemu_hotplug.c
|
|
|
119c2d |
+++ b/src/qemu/qemu_hotplug.c
|
|
|
119c2d |
@@ -1364,6 +1364,9 @@ qemuDomainAttachNetDevice(virQEMUDriver *driver,
|
|
|
119c2d |
break;
|
|
|
119c2d |
|
|
|
119c2d |
case VIR_DOMAIN_NET_TYPE_VDPA:
|
|
|
119c2d |
+ queueSize = net->driver.virtio.queues;
|
|
|
119c2d |
+ if (!queueSize)
|
|
|
119c2d |
+ queueSize = 1;
|
|
|
119c2d |
if (qemuDomainAdjustMaxMemLock(vm, false) < 0)
|
|
|
119c2d |
goto cleanup;
|
|
|
119c2d |
adjustmemlock = true;
|
|
|
119c2d |
diff --git a/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args b/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args
|
|
|
119c2d |
index 61ba85a847..3e45ab6870 100644
|
|
|
119c2d |
--- a/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args
|
|
|
119c2d |
+++ b/tests/qemuxml2argvdata/net-vdpa-multiqueue.x86_64-latest.args
|
|
|
119c2d |
@@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-QEMUGuest1/.config \
|
|
|
119c2d |
-boot strict=on \
|
|
|
119c2d |
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
|
|
|
119c2d |
-add-fd set=0,fd=1732,opaque=/dev/vhost-vdpa-0 \
|
|
|
119c2d |
--netdev vhost-vdpa,vhostdev=/dev/fdset/0,id=hostnet0 \
|
|
|
119c2d |
+-netdev vhost-vdpa,vhostdev=/dev/fdset/0,queues=2,id=hostnet0 \
|
|
|
119c2d |
-device virtio-net-pci,mq=on,vectors=6,netdev=hostnet0,id=net0,mac=52:54:00:95:db:c0,bus=pci.0,addr=0x2 \
|
|
|
119c2d |
-audiodev '{"id":"audio1","driver":"none"}' \
|
|
|
119c2d |
-sandbox on,obsolete=deny,elevateprivileges=deny,spawn=deny,resourcecontrol=deny \
|
|
|
119c2d |
--
|
|
|
119c2d |
2.35.1
|
|
|
119c2d |
|