[PATCH 0/4] support for virtio packed virtqueues

QEMU recently (86044b24e) introduced packed virtqueues for virtio that supposedly have better cache utilization and performance compared to the default split queues. So here's a patch set that expose the virtio parameter as a optional libvirt XML attribute to virtio-backed devices, e.g.: <interface type='user'> <mac address='00:11:22:33:44:55'/> <model type='virtio'/> <driver packed='on'/> </interface> The default value if the attribute is omitted is still 'off' and regular split virtqueues are used. Bjoern Walk (4): qemu: capabilities: add 'packed' capability conf: domain: support for virtio packed option qemu: command: support for virtio packed option docs: documentation for virtio packed option docs/formatdomain.html.in | 8 +++++ docs/schemas/domaincommon.rng | 5 +++ src/conf/domain_conf.c | 28 ++++++++++++++++ src/conf/domain_conf.h | 1 + src/qemu/qemu_capabilities.c | 6 ++++ src/qemu/qemu_capabilities.h | 1 + src/qemu/qemu_command.c | 10 ++++++ .../caps_4.2.0.aarch64.xml | 1 + .../caps_4.2.0.x86_64.xml | 1 + .../caps_5.0.0.aarch64.xml | 1 + .../qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 + .../caps_5.0.0.x86_64.xml | 1 + tests/qemuxml2argvdata/virtio-options.args | 32 ++++++++++--------- tests/qemuxml2argvdata/virtio-options.xml | 26 +++++++-------- tests/qemuxml2argvtest.c | 3 +- tests/qemuxml2xmltest.c | 3 +- 16 files changed, 98 insertions(+), 30 deletions(-) -- 2.24.1

Add the capability for QEMU's packed virtqueues for virtio that supposedly have better cache utilization and performance compared to the default split queues. Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- src/qemu/qemu_capabilities.c | 6 ++++++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 + 7 files changed, 12 insertions(+) diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index a95a60c3..3bc876d7 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -567,6 +567,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "query-named-block-nodes.flat", "blockdev-snapshot.allow-write-only-overlay", "blockdev-reopen", + "virtio.packed", ); @@ -1291,6 +1292,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = { { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY }, { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, + { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES }, }; static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBlk[] = { @@ -1304,6 +1306,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBlk[] = { { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, { "write-cache", QEMU_CAPS_DISK_WRITE_CACHE }, + { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES }, }; static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioNet[] = { @@ -1316,6 +1319,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioNet[] = { { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, { "failover", QEMU_CAPS_VIRTIO_NET_FAILOVER }, + { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES }, }; static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsSpaprPCIHostBridge[] = { @@ -1327,6 +1331,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioSCSI[] = { { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY }, { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, + { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES }, }; static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVfioPCI[] = { @@ -1395,6 +1400,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioGpu[] = { { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY }, { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, + { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES }, }; static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsICH9[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index f0961e27..21c09974 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -548,6 +548,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT, /* query-named-block-nodes supports the 'flat' option */ QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY, /* blockdev-snapshot has the 'allow-write-only-overlay' feature */ QEMU_CAPS_BLOCKDEV_REOPEN, /* 'blockdev-reopen' qmp command is supported */ + QEMU_CAPS_VIRTIO_PACKED_QUEUES, /* virtio packed virtqueue support */ QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index 640ce29c..f1b7fbbe 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -179,6 +179,7 @@ <flag name='rng-builtin'/> <flag name='virtio-net.failover'/> <flag name='vhost-user-fs'/> + <flag name='virtio.packed'/> <version>4001050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml index 83e804ea..15388967 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -223,6 +223,7 @@ <flag name='rng-builtin'/> <flag name='virtio-net.failover'/> <flag name='vhost-user-fs'/> + <flag name='virtio.packed'/> <version>4002000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml index e52c6060..9ef8564a 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml @@ -181,6 +181,7 @@ <flag name='virtio-net.failover'/> <flag name='cpu.kvm-no-adjvtime'/> <flag name='vhost-user-fs'/> + <flag name='virtio.packed'/> <version>4002050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml index 85fdb21c..a2d78ac0 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml @@ -189,6 +189,7 @@ <flag name='vhost-user-fs'/> <flag name='query-named-block-nodes.flat'/> <flag name='blockdev-snapshot.allow-write-only-overlay'/> + <flag name='virtio.packed'/> <version>4002050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml index d773f7e3..b6a6b3be 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml @@ -226,6 +226,7 @@ <flag name='vhost-user-fs'/> <flag name='query-named-block-nodes.flat'/> <flag name='blockdev-snapshot.allow-write-only-overlay'/> + <flag name='virtio.packed'/> <version>4002050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100241</microcodeVersion> -- 2.24.1

Bjoern Walk <bwalk@linux.ibm.com> [2020-03-26, 11:32AM +0100]:
Add the capability for QEMU's packed virtqueues for virtio that supposedly have better cache utilization and performance compared to the default split queues.
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- src/qemu/qemu_capabilities.c | 6 ++++++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 + 7 files changed, 12 insertions(+)
If this https://www.redhat.com/archives/libvir-list/2020-March/msg00979.html is accepted then we need to squash this in: diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml index e46259e669..61a34da2d8 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.s390x.xml @@ -144,6 +144,7 @@ <flag name='rng-builtin'/> <flag name='virtio-net.failover'/> <flag name='vhost-user-fs'/> + <flag name='packed'/> <version>4002000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>39100242</microcodeVersion>

Looks good... Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> On 3/26/20 11:32 AM, Bjoern Walk wrote:
Add the capability for QEMU's packed virtqueues for virtio that supposedly have better cache utilization and performance compared to the default split queues.
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- src/qemu/qemu_capabilities.c | 6 ++++++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 + 7 files changed, 12 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c index a95a60c3..3bc876d7 100644 --- a/src/qemu/qemu_capabilities.c +++ b/src/qemu/qemu_capabilities.c @@ -567,6 +567,7 @@ VIR_ENUM_IMPL(virQEMUCaps, "query-named-block-nodes.flat", "blockdev-snapshot.allow-write-only-overlay", "blockdev-reopen", + "virtio.packed", );
@@ -1291,6 +1292,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBalloon[] = { { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY }, { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, + { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES }, };
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBlk[] = { @@ -1304,6 +1306,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioBlk[] = { { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, { "write-cache", QEMU_CAPS_DISK_WRITE_CACHE }, + { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES }, };
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioNet[] = { @@ -1316,6 +1319,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioNet[] = { { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, { "failover", QEMU_CAPS_VIRTIO_NET_FAILOVER }, + { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES }, };
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsSpaprPCIHostBridge[] = { @@ -1327,6 +1331,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioSCSI[] = { { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY }, { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, + { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES }, };
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVfioPCI[] = { @@ -1395,6 +1400,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsVirtioGpu[] = { { "disable-legacy", QEMU_CAPS_VIRTIO_PCI_DISABLE_LEGACY }, { "iommu_platform", QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM }, { "ats", QEMU_CAPS_VIRTIO_PCI_ATS }, + { "packed", QEMU_CAPS_VIRTIO_PACKED_QUEUES }, };
static struct virQEMUCapsStringFlags virQEMUCapsDevicePropsICH9[] = { diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h index f0961e27..21c09974 100644 --- a/src/qemu/qemu_capabilities.h +++ b/src/qemu/qemu_capabilities.h @@ -548,6 +548,7 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */ QEMU_CAPS_QMP_QUERY_NAMED_BLOCK_NODES_FLAT, /* query-named-block-nodes supports the 'flat' option */ QEMU_CAPS_BLOCKDEV_SNAPSHOT_ALLOW_WRITE_ONLY, /* blockdev-snapshot has the 'allow-write-only-overlay' feature */ QEMU_CAPS_BLOCKDEV_REOPEN, /* 'blockdev-reopen' qmp command is supported */ + QEMU_CAPS_VIRTIO_PACKED_QUEUES, /* virtio packed virtqueue support */
QEMU_CAPS_LAST /* this must always be the last item */ } virQEMUCapsFlags; diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml index 640ce29c..f1b7fbbe 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml @@ -179,6 +179,7 @@ <flag name='rng-builtin'/> <flag name='virtio-net.failover'/> <flag name='vhost-user-fs'/> + <flag name='virtio.packed'/> <version>4001050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml index 83e804ea..15388967 100644 --- a/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml @@ -223,6 +223,7 @@ <flag name='rng-builtin'/> <flag name='virtio-net.failover'/> <flag name='vhost-user-fs'/> + <flag name='virtio.packed'/> <version>4002000</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100242</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml index e52c6060..9ef8564a 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml @@ -181,6 +181,7 @@ <flag name='virtio-net.failover'/> <flag name='cpu.kvm-no-adjvtime'/> <flag name='vhost-user-fs'/> + <flag name='virtio.packed'/> <version>4002050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>61700241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml index 85fdb21c..a2d78ac0 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml @@ -189,6 +189,7 @@ <flag name='vhost-user-fs'/> <flag name='query-named-block-nodes.flat'/> <flag name='blockdev-snapshot.allow-write-only-overlay'/> + <flag name='virtio.packed'/> <version>4002050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>42900241</microcodeVersion> diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml index d773f7e3..b6a6b3be 100644 --- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml +++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml @@ -226,6 +226,7 @@ <flag name='vhost-user-fs'/> <flag name='query-named-block-nodes.flat'/> <flag name='blockdev-snapshot.allow-write-only-overlay'/> + <flag name='virtio.packed'/> <version>4002050</version> <kvmVersion>0</kvmVersion> <microcodeVersion>43100241</microcodeVersion>
-- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On a Thursday in 2020, Bjoern Walk wrote:
Add the capability for QEMU's packed virtqueues for virtio that supposedly have better cache utilization and performance compared to the default split queues.
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- src/qemu/qemu_capabilities.c | 6 ++++++ src/qemu/qemu_capabilities.h | 1 + tests/qemucapabilitiesdata/caps_4.2.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_4.2.0.x86_64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 + tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 + 7 files changed, 12 insertions(+)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Expose the virtio parameter for packed virtqueues as a optional libvirt XML attribute to virtio-backed devices, e.g.: <interface type='user'> <mac address='00:11:22:33:44:55'/> <model type='virtio'/> <driver packed='on'/> </interface> If the attribute is omitted, the default value for this attribute is 'off' and regular split virtqueues are used. Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 28 ++++++++++++++++++++++++++++ src/conf/domain_conf.h | 1 + 3 files changed, 34 insertions(+) diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng index d79dee65..b6d7297b 100644 --- a/docs/schemas/domaincommon.rng +++ b/docs/schemas/domaincommon.rng @@ -5921,6 +5921,11 @@ <ref name="virOnOff"/> </attribute> </optional> + <optional> + <attribute name="packed"> + <ref name="virOnOff"/> + </attribute> + </optional> </define> <define name="usbmaster"> diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c index 27bc5a79..ca45a6a5 100644 --- a/src/conf/domain_conf.c +++ b/src/conf/domain_conf.c @@ -1505,6 +1505,16 @@ virDomainVirtioOptionsParseXML(xmlNodePtr driver, } res->ats = val; } + VIR_FREE(str); + + if ((str = virXMLPropString(driver, "packed"))) { + if ((val = virTristateSwitchTypeFromString(str)) <= 0) { + virReportError(VIR_ERR_XML_ERROR, "%s", + _("invalid packed value")); + return -1; + } + res->packed = val; + } return 0; } @@ -5084,6 +5094,12 @@ virDomainCheckVirtioOptions(virDomainVirtioOptionsPtr virtio) "for virtio devices")); return -1; } + if (virtio->packed != VIR_TRISTATE_SWITCH_ABSENT) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("packed driver option is only supported " + "for virtio devices")); + return -1; + } return 0; } @@ -7370,6 +7386,10 @@ virDomainVirtioOptionsFormat(virBufferPtr buf, virBufferAsprintf(buf, " ats='%s'", virTristateSwitchTypeToString(virtio->ats)); } + if (virtio->packed != VIR_TRISTATE_SWITCH_ABSENT) { + virBufferAsprintf(buf, " packed='%s'", + virTristateSwitchTypeToString(virtio->packed)); + } } @@ -22392,6 +22412,14 @@ virDomainVirtioOptionsCheckABIStability(virDomainVirtioOptionsPtr src, virTristateSwitchTypeToString(src->ats)); return false; } + if (src->packed != dst->packed) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, + _("Target device packed option '%s' does not " + "match source '%s'"), + virTristateSwitchTypeToString(dst->packed), + virTristateSwitchTypeToString(src->packed)); + return false; + } return true; } diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h index 33875d94..ef322593 100644 --- a/src/conf/domain_conf.h +++ b/src/conf/domain_conf.h @@ -2404,6 +2404,7 @@ struct _virDomainVsockDef { struct _virDomainVirtioOptions { virTristateSwitch iommu; virTristateSwitch ats; + virTristateSwitch packed; }; /* -- 2.24.1

On a Thursday in 2020, Bjoern Walk wrote:
Expose the virtio parameter for packed virtqueues as a optional libvirt XML
s/a optional/an optional/
attribute to virtio-backed devices, e.g.:
<interface type='user'> <mac address='00:11:22:33:44:55'/> <model type='virtio'/> <driver packed='on'/> </interface>
If the attribute is omitted, the default value for this attribute is 'off' and regular split virtqueues are used.
Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- docs/schemas/domaincommon.rng | 5 +++++ src/conf/domain_conf.c | 28 ++++++++++++++++++++++++++++ src/conf/domain_conf.h | 1 + 3 files changed, 34 insertions(+)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Pass the packed option on the QEMU command line of the capability for packed virtqueues is detected and the parameter is set explicitly. Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- src/qemu/qemu_command.c | 10 +++++++ tests/qemuxml2argvdata/virtio-options.args | 32 ++++++++++++---------- tests/qemuxml2argvdata/virtio-options.xml | 26 +++++++++--------- tests/qemuxml2argvtest.c | 3 +- tests/qemuxml2xmltest.c | 3 +- 5 files changed, 44 insertions(+), 30 deletions(-) diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d1b689df..81f089ba 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -614,6 +614,16 @@ qemuBuildVirtioOptionsStr(virBufferPtr buf, virBufferAsprintf(buf, ",ats=%s", virTristateSwitchTypeToString(virtio->ats)); } + if (virtio->packed != VIR_TRISTATE_SWITCH_ABSENT) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PACKED_QUEUES)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the packed setting is not supported with this " + "QEMU binary")); + return -1; + } + virBufferAsprintf(buf, ",packed=%s", + virTristateSwitchTypeToString(virtio->packed)); + } return 0; } diff --git a/tests/qemuxml2argvdata/virtio-options.args b/tests/qemuxml2argvdata/virtio-options.args index 33ecd8f4..8253a788 100644 --- a/tests/qemuxml2argvdata/virtio-options.args +++ b/tests/qemuxml2argvdata/virtio-options.args @@ -24,36 +24,38 @@ server,nowait \ -rtc base=utc \ -no-shutdown \ -no-acpi \ --device virtio-scsi-pci,iommu_platform=on,ats=on,id=scsi0,bus=pci.0,addr=0x8 \ --device virtio-serial-pci,id=virtio-serial0,iommu_platform=on,ats=on,bus=pci.0,\ -addr=0x9 \ +-device virtio-scsi-pci,iommu_platform=on,ats=on,packed=on,id=scsi0,bus=pci.0,\ +addr=0x8 \ +-device virtio-serial-pci,id=virtio-serial0,iommu_platform=on,ats=on,packed=on,\ +bus=pci.0,addr=0x9 \ -usb \ -drive file=/var/lib/libvirt/images/img1,format=raw,if=none,\ id=drive-virtio-disk0 \ --device virtio-blk-pci,iommu_platform=on,ats=on,bus=pci.0,addr=0xa,\ +-device virtio-blk-pci,iommu_platform=on,ats=on,packed=on,bus=pci.0,addr=0xa,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,iommu_platform=on,\ -ats=on,bus=pci.0,addr=0x3 \ +ats=on,packed=on,bus=pci.0,addr=0x3 \ -fsdev local,security_model=mapped,writeout=immediate,id=fsdev-fs1,\ path=/export/fs2 \ -device virtio-9p-pci,id=fs1,fsdev=fsdev-fs1,mount_tag=fs2,iommu_platform=on,\ -ats=on,bus=pci.0,addr=0x4 \ +ats=on,packed=on,bus=pci.0,addr=0x4 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:56:58:5a:5c,bus=pci.0,\ -addr=0x6,iommu_platform=on,ats=on \ --device virtio-mouse-pci,id=input0,bus=pci.0,addr=0xe,iommu_platform=on,ats=on \ +addr=0x6,iommu_platform=on,ats=on,packed=on \ +-device virtio-mouse-pci,id=input0,bus=pci.0,addr=0xe,iommu_platform=on,ats=on,\ +packed=on \ -device virtio-keyboard-pci,id=input1,bus=pci.0,addr=0x10,iommu_platform=on,\ -ats=on \ +ats=on,packed=on \ -device virtio-tablet-pci,id=input2,bus=pci.0,addr=0x11,iommu_platform=on,\ -ats=on \ +ats=on,packed=on \ -device virtio-input-host-pci,id=input3,evdev=/dev/input/event1234,bus=pci.0,\ -addr=0x12,iommu_platform=on,ats=on \ +addr=0x12,iommu_platform=on,ats=on,packed=on \ -chardev socket,id=chr-vu-video0,fd=1729 \ -device vhost-user-gpu-pci,id=video0,max_outputs=1,chardev=chr-vu-video0,\ -bus=pci.0,addr=0x2,iommu_platform=on,ats=on \ +bus=pci.0,addr=0x2,iommu_platform=on,ats=on,packed=on \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0xc,iommu_platform=on,\ -ats=on \ +ats=on,packed=on \ -object rng-random,id=objrng0,filename=/dev/random \ --device virtio-rng-pci,rng=objrng0,id=rng0,iommu_platform=on,ats=on,bus=pci.0,\ -addr=0xd +-device virtio-rng-pci,rng=objrng0,id=rng0,iommu_platform=on,ats=on,packed=on,\ +bus=pci.0,addr=0xd diff --git a/tests/qemuxml2argvdata/virtio-options.xml b/tests/qemuxml2argvdata/virtio-options.xml index dd9a4f4a..3ca27840 100644 --- a/tests/qemuxml2argvdata/virtio-options.xml +++ b/tests/qemuxml2argvdata/virtio-options.xml @@ -15,7 +15,7 @@ <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> <disk type='file' device='disk'> - <driver name='qemu' type='raw' iommu='on' ats='on'/> + <driver name='qemu' type='raw' iommu='on' ats='on' packed='on'/> <source file='/var/lib/libvirt/images/img1'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/> @@ -27,22 +27,22 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <controller type='scsi' index='0' model='virtio-scsi'> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </controller> <controller type='pci' index='0' model='pci-root'/> <controller type='virtio-serial' index='0'> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> </controller> <filesystem type='mount' accessmode='passthrough'> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <source dir='/export/fs1'/> <target dir='fs1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </filesystem> <filesystem type='mount' accessmode='mapped'> - <driver type='path' wrpolicy='immediate' iommu='on' ats='on'/> + <driver type='path' wrpolicy='immediate' iommu='on' ats='on' packed='on'/> <source dir='/export/fs2'/> <target dir='fs2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> @@ -50,30 +50,30 @@ <interface type='user'> <mac address='52:54:56:58:5a:5c'/> <model type='virtio'/> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </interface> <input type='mouse' bus='virtio'> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/> </input> <input type='keyboard' bus='virtio'> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/> </input> <input type='tablet' bus='virtio'> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/> </input> <input type='passthrough' bus='virtio'> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <source evdev='/dev/input/event1234'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/> </input> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <video> - <driver iommu='on' ats='on' name='vhostuser'/> + <driver iommu='on' ats='on' packed='on' name='vhostuser'/> <model type='virtio' heads='1' primary='yes'> <acceleration accel3d='yes' rendernode='/dev/dri/test'/> </model> @@ -81,11 +81,11 @@ </video> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> </memballoon> <rng model='virtio'> <backend model='random'>/dev/random</backend> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/> </rng> </devices> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 4d44286b..f66c9854 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2987,7 +2987,8 @@ mymain(void) QEMU_CAPS_OBJECT_RNG_RANDOM, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM, - QEMU_CAPS_VIRTIO_PCI_ATS); + QEMU_CAPS_VIRTIO_PCI_ATS, + QEMU_CAPS_VIRTIO_PACKED_QUEUES); DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_KVM); diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index a3c25b4a..5675957d 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1289,7 +1289,8 @@ mymain(void) QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM, QEMU_CAPS_VIRTIO_PCI_ATS, - QEMU_CAPS_DEVICE_VHOST_USER_GPU); + QEMU_CAPS_DEVICE_VHOST_USER_GPU, + QEMU_CAPS_VIRTIO_PACKED_QUEUES); DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_KVM); -- 2.24.1

Looks sane as well Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> On 3/26/20 11:32 AM, Bjoern Walk wrote:
Pass the packed option on the QEMU command line of the capability for packed virtqueues is detected and the parameter is set explicitly.
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- src/qemu/qemu_command.c | 10 +++++++ tests/qemuxml2argvdata/virtio-options.args | 32 ++++++++++++---------- tests/qemuxml2argvdata/virtio-options.xml | 26 +++++++++--------- tests/qemuxml2argvtest.c | 3 +- tests/qemuxml2xmltest.c | 3 +- 5 files changed, 44 insertions(+), 30 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c index d1b689df..81f089ba 100644 --- a/src/qemu/qemu_command.c +++ b/src/qemu/qemu_command.c @@ -614,6 +614,16 @@ qemuBuildVirtioOptionsStr(virBufferPtr buf, virBufferAsprintf(buf, ",ats=%s", virTristateSwitchTypeToString(virtio->ats)); } + if (virtio->packed != VIR_TRISTATE_SWITCH_ABSENT) { + if (!virQEMUCapsGet(qemuCaps, QEMU_CAPS_VIRTIO_PACKED_QUEUES)) { + virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", + _("the packed setting is not supported with this " + "QEMU binary")); + return -1; + } + virBufferAsprintf(buf, ",packed=%s", + virTristateSwitchTypeToString(virtio->packed)); + }
return 0; } diff --git a/tests/qemuxml2argvdata/virtio-options.args b/tests/qemuxml2argvdata/virtio-options.args index 33ecd8f4..8253a788 100644 --- a/tests/qemuxml2argvdata/virtio-options.args +++ b/tests/qemuxml2argvdata/virtio-options.args @@ -24,36 +24,38 @@ server,nowait \ -rtc base=utc \ -no-shutdown \ -no-acpi \ --device virtio-scsi-pci,iommu_platform=on,ats=on,id=scsi0,bus=pci.0,addr=0x8 \ --device virtio-serial-pci,id=virtio-serial0,iommu_platform=on,ats=on,bus=pci.0,\ -addr=0x9 \ +-device virtio-scsi-pci,iommu_platform=on,ats=on,packed=on,id=scsi0,bus=pci.0,\ +addr=0x8 \ +-device virtio-serial-pci,id=virtio-serial0,iommu_platform=on,ats=on,packed=on,\ +bus=pci.0,addr=0x9 \ -usb \ -drive file=/var/lib/libvirt/images/img1,format=raw,if=none,\ id=drive-virtio-disk0 \ --device virtio-blk-pci,iommu_platform=on,ats=on,bus=pci.0,addr=0xa,\ +-device virtio-blk-pci,iommu_platform=on,ats=on,packed=on,bus=pci.0,addr=0xa,\ drive=drive-virtio-disk0,id=virtio-disk0,bootindex=1 \ -fsdev local,security_model=passthrough,id=fsdev-fs0,path=/export/fs1 \ -device virtio-9p-pci,id=fs0,fsdev=fsdev-fs0,mount_tag=fs1,iommu_platform=on,\ -ats=on,bus=pci.0,addr=0x3 \ +ats=on,packed=on,bus=pci.0,addr=0x3 \ -fsdev local,security_model=mapped,writeout=immediate,id=fsdev-fs1,\ path=/export/fs2 \ -device virtio-9p-pci,id=fs1,fsdev=fsdev-fs1,mount_tag=fs2,iommu_platform=on,\ -ats=on,bus=pci.0,addr=0x4 \ +ats=on,packed=on,bus=pci.0,addr=0x4 \ -netdev user,id=hostnet0 \ -device virtio-net-pci,netdev=hostnet0,id=net0,mac=52:54:56:58:5a:5c,bus=pci.0,\ -addr=0x6,iommu_platform=on,ats=on \ --device virtio-mouse-pci,id=input0,bus=pci.0,addr=0xe,iommu_platform=on,ats=on \ +addr=0x6,iommu_platform=on,ats=on,packed=on \ +-device virtio-mouse-pci,id=input0,bus=pci.0,addr=0xe,iommu_platform=on,ats=on,\ +packed=on \ -device virtio-keyboard-pci,id=input1,bus=pci.0,addr=0x10,iommu_platform=on,\ -ats=on \ +ats=on,packed=on \ -device virtio-tablet-pci,id=input2,bus=pci.0,addr=0x11,iommu_platform=on,\ -ats=on \ +ats=on,packed=on \ -device virtio-input-host-pci,id=input3,evdev=/dev/input/event1234,bus=pci.0,\ -addr=0x12,iommu_platform=on,ats=on \ +addr=0x12,iommu_platform=on,ats=on,packed=on \ -chardev socket,id=chr-vu-video0,fd=1729 \ -device vhost-user-gpu-pci,id=video0,max_outputs=1,chardev=chr-vu-video0,\ -bus=pci.0,addr=0x2,iommu_platform=on,ats=on \ +bus=pci.0,addr=0x2,iommu_platform=on,ats=on,packed=on \ -device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0xc,iommu_platform=on,\ -ats=on \ +ats=on,packed=on \ -object rng-random,id=objrng0,filename=/dev/random \ --device virtio-rng-pci,rng=objrng0,id=rng0,iommu_platform=on,ats=on,bus=pci.0,\ -addr=0xd +-device virtio-rng-pci,rng=objrng0,id=rng0,iommu_platform=on,ats=on,packed=on,\ +bus=pci.0,addr=0xd diff --git a/tests/qemuxml2argvdata/virtio-options.xml b/tests/qemuxml2argvdata/virtio-options.xml index dd9a4f4a..3ca27840 100644 --- a/tests/qemuxml2argvdata/virtio-options.xml +++ b/tests/qemuxml2argvdata/virtio-options.xml @@ -15,7 +15,7 @@ <devices> <emulator>/usr/bin/qemu-system-x86_64</emulator> <disk type='file' device='disk'> - <driver name='qemu' type='raw' iommu='on' ats='on'/> + <driver name='qemu' type='raw' iommu='on' ats='on' packed='on'/> <source file='/var/lib/libvirt/images/img1'/> <target dev='vda' bus='virtio'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0a' function='0x0'/> @@ -27,22 +27,22 @@ <address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x1'/> </controller> <controller type='scsi' index='0' model='virtio-scsi'> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/> </controller> <controller type='pci' index='0' model='pci-root'/> <controller type='virtio-serial' index='0'> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x09' function='0x0'/> </controller> <filesystem type='mount' accessmode='passthrough'> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <source dir='/export/fs1'/> <target dir='fs1'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/> </filesystem> <filesystem type='mount' accessmode='mapped'> - <driver type='path' wrpolicy='immediate' iommu='on' ats='on'/> + <driver type='path' wrpolicy='immediate' iommu='on' ats='on' packed='on'/> <source dir='/export/fs2'/> <target dir='fs2'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/> @@ -50,30 +50,30 @@ <interface type='user'> <mac address='52:54:56:58:5a:5c'/> <model type='virtio'/> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/> </interface> <input type='mouse' bus='virtio'> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0e' function='0x0'/> </input> <input type='keyboard' bus='virtio'> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x10' function='0x0'/> </input> <input type='tablet' bus='virtio'> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x11' function='0x0'/> </input> <input type='passthrough' bus='virtio'> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <source evdev='/dev/input/event1234'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x12' function='0x0'/> </input> <input type='mouse' bus='ps2'/> <input type='keyboard' bus='ps2'/> <video> - <driver iommu='on' ats='on' name='vhostuser'/> + <driver iommu='on' ats='on' packed='on' name='vhostuser'/> <model type='virtio' heads='1' primary='yes'> <acceleration accel3d='yes' rendernode='/dev/dri/test'/> </model> @@ -81,11 +81,11 @@ </video> <memballoon model='virtio'> <address type='pci' domain='0x0000' bus='0x00' slot='0x0c' function='0x0'/> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> </memballoon> <rng model='virtio'> <backend model='random'>/dev/random</backend> - <driver iommu='on' ats='on'/> + <driver iommu='on' ats='on' packed='on'/> <address type='pci' domain='0x0000' bus='0x00' slot='0x0d' function='0x0'/> </rng> </devices> diff --git a/tests/qemuxml2argvtest.c b/tests/qemuxml2argvtest.c index 4d44286b..f66c9854 100644 --- a/tests/qemuxml2argvtest.c +++ b/tests/qemuxml2argvtest.c @@ -2987,7 +2987,8 @@ mymain(void) QEMU_CAPS_OBJECT_RNG_RANDOM, QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM, - QEMU_CAPS_VIRTIO_PCI_ATS); + QEMU_CAPS_VIRTIO_PCI_ATS, + QEMU_CAPS_VIRTIO_PACKED_QUEUES);
DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_KVM); diff --git a/tests/qemuxml2xmltest.c b/tests/qemuxml2xmltest.c index a3c25b4a..5675957d 100644 --- a/tests/qemuxml2xmltest.c +++ b/tests/qemuxml2xmltest.c @@ -1289,7 +1289,8 @@ mymain(void) QEMU_CAPS_DEVICE_VIDEO_PRIMARY, QEMU_CAPS_VIRTIO_PCI_IOMMU_PLATFORM, QEMU_CAPS_VIRTIO_PCI_ATS, - QEMU_CAPS_DEVICE_VHOST_USER_GPU); + QEMU_CAPS_DEVICE_VHOST_USER_GPU, + QEMU_CAPS_VIRTIO_PACKED_QUEUES);
DO_TEST("fd-memory-numa-topology", QEMU_CAPS_OBJECT_MEMORY_FILE, QEMU_CAPS_KVM);
-- Mit freundlichen Grüßen/Kind regards Boris Fiuczynski IBM Deutschland Research & Development GmbH Vorsitzender des Aufsichtsrats: Gregor Pillen Geschäftsführung: Dirk Wittkopp Sitz der Gesellschaft: Böblingen Registergericht: Amtsgericht Stuttgart, HRB 243294

On a Thursday in 2020, Bjoern Walk wrote:
Pass the packed option on the QEMU command line of the capability for packed virtqueues is detected and the parameter is set explicitly.
Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- src/qemu/qemu_command.c | 10 +++++++ tests/qemuxml2argvdata/virtio-options.args | 32 ++++++++++++---------- tests/qemuxml2argvdata/virtio-options.xml | 26 +++++++++--------- tests/qemuxml2argvtest.c | 3 +- tests/qemuxml2xmltest.c | 3 +- 5 files changed, 44 insertions(+), 30 deletions(-)
Reviewed-by: Ján Tomko <jtomko@redhat.com> Jano

Reviewed-by: Boris Fiuczynski <fiuczy@linux.ibm.com> Signed-off-by: Bjoern Walk <bwalk@linux.ibm.com> --- docs/formatdomain.html.in | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in index fb07d107..f8bfef7d 100644 --- a/docs/formatdomain.html.in +++ b/docs/formatdomain.html.in @@ -4321,6 +4321,14 @@ Possible values are <code>on</code> or <code>off</code>. <span class="since">Since 3.5.0</span> </p> + <p> + The attribute <code>packed</code> controls the usage of packed + virtqueues. Compared to regular split queues, packed queues consist of + only a single descriptor ring replacing available and used ring, index + and descriptor buffer. This can result in better cache utilization and + performance. Possible values are <code>on</code> or <code>off</code>. + <span class="since">Since 6.3.0 (QEMU and KVM only)</span> + </p> <h4><a id="elementsVirtioTransitional">Virtio transitional devices</a></h4> -- 2.24.1

On Thu, 26 Mar 2020 11:32:14 +0100 Bjoern Walk <bwalk@linux.ibm.com> wrote:
+ <p> + The attribute <code>packed</code> controls the usage of packed + virtqueues.
This reads to me, like if packed='on' is specified, then packed virtqueues are used (or the device fails); if packed='off' is specified is specified then split virtqueue format is used. But that statement is not always true. One might still end up using split despite of packed='on'. One example is a setup vhost-net setup. The in kernel implementation namely does not support packed queues, so F_RING_PACKED does not get offered by the device. Another reason why one could end up with F_RING_PACKED not getting negotiated is lack of guest support. Please note that this behavior is a little different than what we do for cpus (and cpu models). There one either gets what he asked for, or the VM won't get constructed. I believe, we should at least document this cleanly. Cc-ing Michael and Jason as hypervisor experts on these topics. Regards, Halil
Compared to regular split queues, packed queues consist of + only a single descriptor ring replacing available and used ring, index + and descriptor buffer. This can result in better cache utilization and + performance. Possible values are <code>on</code> or <code>off</code>. + <span class="since">Since 6.3.0 (QEMU and KVM only)</span> + </p>

On 2020/3/27 上午9:08, Halil Pasic wrote:
On Thu, 26 Mar 2020 11:32:14 +0100 Bjoern Walk <bwalk@linux.ibm.com> wrote:
+ <p> + The attribute <code>packed</code> controls the usage of packed + virtqueues. This reads to me, like if packed='on' is specified, then packed virtqueues are used (or the device fails); if packed='off' is specified is specified then split virtqueue format is used.
But that statement is not always true. One might still end up using split despite of packed='on'. One example is a setup vhost-net setup. The in kernel implementation namely does not support packed queues, so F_RING_PACKED does not get offered by the device.
Another reason why one could end up with F_RING_PACKED not getting negotiated is lack of guest support.
Please note that this behavior is a little different than what we do for cpus (and cpu models). There one either gets what he asked for, or the VM won't get constructed.
I believe, we should at least document this cleanly. Cc-ing Michael and Jason as hypervisor experts on these topics.
Regards, Halil
I think we need document that packed=on only enable the qemu support of packed ring, but whether it is actually enabled depends on the feature negotiation between qemu, vhost backends and guest drivers. Thanks
Compared to regular split queues, packed queues consist of + only a single descriptor ring replacing available and used ring, index + and descriptor buffer. This can result in better cache utilization and + performance. Possible values are <code>on</code> or <code>off</code>. + <span class="since">Since 6.3.0 (QEMU and KVM only)</span> + </p>

On Fri, Mar 27, 2020 at 02:08:48AM +0100, Halil Pasic wrote:
On Thu, 26 Mar 2020 11:32:14 +0100 Bjoern Walk <bwalk@linux.ibm.com> wrote:
+ <p> + The attribute <code>packed</code> controls the usage of packed + virtqueues.
This reads to me, like if packed='on' is specified, then packed virtqueues are used (or the device fails); if packed='off' is specified is specified then split virtqueue format is used.
But that statement is not always true. One might still end up using split despite of packed='on'. One example is a setup vhost-net setup. The in kernel implementation namely does not support packed queues, so F_RING_PACKED does not get offered by the device.
Another reason why one could end up with F_RING_PACKED not getting negotiated is lack of guest support.
Please note that this behavior is a little different than what we do for cpus (and cpu models). There one either gets what he asked for, or the VM won't get constructed.
I believe, we should at least document this cleanly. Cc-ing Michael and Jason as hypervisor experts on these topics.
Regards, Halil
Note that it's not very different from e.g. event index. It can't hurt to mention that this flag only affects QEMU as Jason suggested.
Compared to regular split queues, packed queues consist of + only a single descriptor ring replacing available and used ring, index + and descriptor buffer. This can result in better cache utilization and + performance. Possible values are <code>on</code> or <code>off</code>. + <span class="since">Since 6.3.0 (QEMU and KVM only)</span> + </p>
participants (6)
-
Bjoern Walk
-
Boris Fiuczynski
-
Halil Pasic
-
Jason Wang
-
Ján Tomko
-
Michael S. Tsirkin