import libvirt-8.0.0-8.1.el9_0

This commit is contained in:
CentOS Sources 2022-06-28 04:30:07 -04:00 committed by Stepan Oksanichenko
parent acb0b4afe5
commit 931aa4ca3a
5 changed files with 589 additions and 1 deletions

View File

@ -0,0 +1,155 @@
From 0d42a491f2f0d9ccb9c3119b082d0e2ae90758eb Mon Sep 17 00:00:00 2001
Message-Id: <0d42a491f2f0d9ccb9c3119b082d0e2ae90758eb@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 21 Mar 2022 16:49:25 +0100
Subject: [PATCH] conf: Introduce memory allocation threads
Since its v5.0.0 release QEMU is capable of specifying number of
threads used to allocate memory. It defaults to 1, which may be
too low for humongous guests with gigantic pages.
In general, on QEMU cmd line level it is possible to use
different number of threads per each memory-backend-* object, in
practical terms it's not useful. Therefore, use <memoryBacking/>
to set guest wide value and let all memory devices 'inherit' it,
silently. IOW, don't introduce per device knob because that would
only complicate things for a little or no benefit.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit ba7f98126fa84d354ce72929b77cc111a9a557a9)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2075628
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
docs/formatdomain.rst | 8 +++++---
docs/schemas/domaincommon.rng | 19 +++++++++++++------
src/conf/domain_conf.c | 15 ++++++++++++++-
src/conf/domain_conf.h | 1 +
tests/qemuxml2argvdata/memfd-memory-numa.xml | 2 +-
5 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/docs/formatdomain.rst b/docs/formatdomain.rst
index 8128e43da4..17e89a0c0d 100644
--- a/docs/formatdomain.rst
+++ b/docs/formatdomain.rst
@@ -977,7 +977,7 @@ Memory Backing
<locked/>
<source type="file|anonymous|memfd"/>
<access mode="shared|private"/>
- <allocation mode="immediate|ondemand"/>
+ <allocation mode="immediate|ondemand" threads='8'/>
<discard/>
</memoryBacking>
...
@@ -1026,8 +1026,10 @@ influence how virtual memory pages are backed by host pages.
Using the ``mode`` attribute, specify if the memory is to be "shared" or
"private". This can be overridden per numa node by ``memAccess``.
``allocation``
- Using the ``mode`` attribute, specify when to allocate the memory by
- supplying either "immediate" or "ondemand".
+ Using the optional ``mode`` attribute, specify when to allocate the memory by
+ supplying either "immediate" or "ondemand". :since:`Since 8.2.0` it is
+ possible to set the number of threads that hypervisor uses to allocate
+ memory via ``threads`` attribute.
``discard``
When set and supported by hypervisor the memory content is discarded just
before guest shuts down (or when DIMM module is unplugged). Please note that
diff --git a/docs/schemas/domaincommon.rng b/docs/schemas/domaincommon.rng
index 7fa5c2b8b5..c9c1529979 100644
--- a/docs/schemas/domaincommon.rng
+++ b/docs/schemas/domaincommon.rng
@@ -745,12 +745,19 @@
</optional>
<optional>
<element name="allocation">
- <attribute name="mode">
- <choice>
- <value>immediate</value>
- <value>ondemand</value>
- </choice>
- </attribute>
+ <optional>
+ <attribute name="mode">
+ <choice>
+ <value>immediate</value>
+ <value>ondemand</value>
+ </choice>
+ </attribute>
+ </optional>
+ <optional>
+ <attribute name="threads">
+ <ref name="unsignedInt"/>
+ </attribute>
+ </optional>
</element>
</optional>
<optional>
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index 5691b8d2d5..805a15848e 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -19095,6 +19095,13 @@ virDomainDefParseMemory(virDomainDef *def,
VIR_FREE(tmp);
}
+ if (virXPathUInt("string(./memoryBacking/allocation/@threads)",
+ ctxt, &def->mem.allocation_threads) == -2) {
+ virReportError(VIR_ERR_XML_ERROR, "%s",
+ _("Failed to parse memory allocation threads"));
+ return -1;
+ }
+
if (virXPathNode("./memoryBacking/hugepages", ctxt)) {
/* hugepages will be used */
if ((n = virXPathNodeSet("./memoryBacking/hugepages/page", ctxt, &nodes)) < 0) {
@@ -27639,6 +27646,7 @@ virDomainMemorybackingFormat(virBuffer *buf,
const virDomainMemtune *mem)
{
g_auto(virBuffer) childBuf = VIR_BUFFER_INIT_CHILD(buf);
+ g_auto(virBuffer) allocAttrBuf = VIR_BUFFER_INITIALIZER;
if (mem->nhugepages)
virDomainHugepagesFormat(&childBuf, mem->hugepages, mem->nhugepages);
@@ -27653,8 +27661,13 @@ virDomainMemorybackingFormat(virBuffer *buf,
virBufferAsprintf(&childBuf, "<access mode='%s'/>\n",
virDomainMemoryAccessTypeToString(mem->access));
if (mem->allocation)
- virBufferAsprintf(&childBuf, "<allocation mode='%s'/>\n",
+ virBufferAsprintf(&allocAttrBuf, " mode='%s'",
virDomainMemoryAllocationTypeToString(mem->allocation));
+ if (mem->allocation_threads > 0)
+ virBufferAsprintf(&allocAttrBuf, " threads='%u'", mem->allocation_threads);
+
+ virXMLFormatElement(&childBuf, "allocation", &allocAttrBuf, NULL);
+
if (mem->discard)
virBufferAddLit(&childBuf, "<discard/>\n");
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 144ba4dd12..10af94e2e4 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2677,6 +2677,7 @@ struct _virDomainMemtune {
int source; /* enum virDomainMemorySource */
int access; /* enum virDomainMemoryAccess */
int allocation; /* enum virDomainMemoryAllocation */
+ unsigned int allocation_threads;
virTristateBool discard;
};
diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.xml b/tests/qemuxml2argvdata/memfd-memory-numa.xml
index 1ebcee8939..1ac87e3aef 100644
--- a/tests/qemuxml2argvdata/memfd-memory-numa.xml
+++ b/tests/qemuxml2argvdata/memfd-memory-numa.xml
@@ -10,7 +10,7 @@
</hugepages>
<source type='memfd'/>
<access mode='shared'/>
- <allocation mode='immediate'/>
+ <allocation mode='immediate' threads='8'/>
</memoryBacking>
<vcpu placement='static'>8</vcpu>
<numatune>
--
2.35.1

View File

@ -0,0 +1,318 @@
From 8596bdcb9c849185cb519def6ed0ce4611c45856 Mon Sep 17 00:00:00 2001
Message-Id: <8596bdcb9c849185cb519def6ed0ce4611c45856@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 21 Mar 2022 16:55:05 +0100
Subject: [PATCH] qemu_capabilities: Detect memory-backend-*.prealloc-threads
property
The prealloc-threads is property of memory-backend class which is
parent to the other three classes memory-backend-{ram,file,memfd}.
Therefore the property is present for all, or none if QEMU is
older than v5.0.0-rc0~75^2~1^2~3 which introduced the property.
Anyway, the .reserve property is the same story, and we chose
memory-backend-file to detect it, so stick with our earlier
decision and use the same backend to detect this new property.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit a30dac15dcdb7a6c7a3e9b6cfc5cd77bae185081)
Conflicts:
src/qemu/qemu_capabilities.c: Context
src/qemu/qemu_capabilities.h
tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml
tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml
tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml
tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml
tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml
tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml
tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml
tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
tests/qemucapabilitiesdata/caps_7.0.0.ppc64.xml
tests/qemucapabilitiesdata/caps_7.0.0.x86_64.xml
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2075628
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_capabilities.c | 4 ++++
src/qemu/qemu_capabilities.h | 3 +++
tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml | 1 +
tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml | 1 +
tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml | 1 +
tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml | 1 +
tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml | 1 +
tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml | 1 +
20 files changed, 25 insertions(+)
diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 5f1eb5014c..c5bebf567b 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -654,6 +654,9 @@ VIR_ENUM_IMPL(virQEMUCaps,
"rbd-encryption", /* QEMU_CAPS_RBD_ENCRYPTION */
"sev-guest-kernel-hashes", /* QEMU_CAPS_SEV_GUEST_KERNEL_HASHES */
"sev-inject-launch-secret", /* QEMU_CAPS_SEV_INJECT_LAUNCH_SECRET */
+
+ /* 420 */
+ "memory-backend-file.prealloc-threads", /* QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS */
);
@@ -1709,6 +1712,7 @@ static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsMemoryBackendFile[] =
* released qemu versions. */
{ "x-use-canonical-path-for-ramblock-id", QEMU_CAPS_X_USE_CANONICAL_PATH_FOR_RAMBLOCK_ID },
{ "reserve", QEMU_CAPS_MEMORY_BACKEND_RESERVE },
+ { "prealloc-threads", QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS },
};
static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsMemoryBackendMemfd[] = {
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index e3a3ab4445..1730299a96 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -634,6 +634,9 @@ typedef enum { /* virQEMUCapsFlags grouping marker for syntax-check */
QEMU_CAPS_SEV_GUEST_KERNEL_HASHES, /* sev-guest.kernel-hashes= */
QEMU_CAPS_SEV_INJECT_LAUNCH_SECRET, /* 'sev-inject-launch-secret' qmp command present */
+ /* 420 */
+ QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS, /* -object memory-backend-*.prealloc-threads */
+
QEMU_CAPS_LAST /* this must always be the last item */
} virQEMUCapsFlags;
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml
index bb6a7d5ee7..3b18f160db 100644
--- a/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.aarch64.xml
@@ -179,6 +179,7 @@
<flag name='input-linux'/>
<flag name='query-display-options'/>
<flag name='virtio-blk.queue-size'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>5000000</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 f8317c1117..c90f2be296 100644
--- a/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.ppc64.xml
@@ -187,6 +187,7 @@
<flag name='input-linux'/>
<flag name='query-display-options'/>
<flag name='virtio-blk.queue-size'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>5000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900241</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml
index 58c7eb6651..8fbe8f114f 100644
--- a/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.riscv64.xml
@@ -171,6 +171,7 @@
<flag name='input-linux'/>
<flag name='query-display-options'/>
<flag name='virtio-blk.queue-size'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>5000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>0</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
index 69f49020e7..b76c4346a4 100644
--- a/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.0.0.x86_64.xml
@@ -221,6 +221,7 @@
<flag name='input-linux'/>
<flag name='query-display-options'/>
<flag name='virtio-blk.queue-size'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>5000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100241</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml b/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml
index 58af90b29f..7de7c291f5 100644
--- a/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml
+++ b/tests/qemucapabilitiesdata/caps_5.1.0.sparc.xml
@@ -90,6 +90,7 @@
<flag name='rotation-rate'/>
<flag name='input-linux'/>
<flag name='query-display-options'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>5001000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>0</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml
index 578e16e8b0..9b5cb3cd7a 100644
--- a/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.1.0.x86_64.xml
@@ -224,6 +224,7 @@
<flag name='query-display-options'/>
<flag name='virtio-blk.queue-size'/>
<flag name='virtio-mem-pci'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>5001000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml
index b943eaedaf..020c04c1c4 100644
--- a/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.aarch64.xml
@@ -184,6 +184,7 @@
<flag name='query-display-options'/>
<flag name='virtio-blk.queue-size'/>
<flag name='query-dirty-rate'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>5002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>61700243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
index ec64e1cacf..5346b1552c 100644
--- a/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.ppc64.xml
@@ -190,6 +190,7 @@
<flag name='query-display-options'/>
<flag name='virtio-blk.queue-size'/>
<flag name='query-dirty-rate'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>5002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml
index a11d15f91a..9f6974f85d 100644
--- a/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.riscv64.xml
@@ -174,6 +174,7 @@
<flag name='query-display-options'/>
<flag name='virtio-blk.queue-size'/>
<flag name='query-dirty-rate'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>5002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>0</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml b/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml
index 552e1d43c9..44753b64c3 100644
--- a/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.s390x.xml
@@ -141,6 +141,7 @@
<flag name='query-display-options'/>
<flag name='virtio-blk.queue-size'/>
<flag name='query-dirty-rate'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>5002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>39100243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml
index bcc262551a..db11c99739 100644
--- a/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_5.2.0.x86_64.xml
@@ -227,6 +227,7 @@
<flag name='virtio-mem-pci'/>
<flag name='piix4.acpi-root-pci-hotplug'/>
<flag name='query-dirty-rate'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>5002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml
index 0fefe64537..5f9a97df43 100644
--- a/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.0.0.aarch64.xml
@@ -192,6 +192,7 @@
<flag name='set-action'/>
<flag name='virtio-blk.queue-size'/>
<flag name='query-dirty-rate'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>6000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>61700242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml
index 61685066b8..46bd1d3d2d 100644
--- a/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml
+++ b/tests/qemucapabilitiesdata/caps_6.0.0.s390x.xml
@@ -149,6 +149,7 @@
<flag name='set-action'/>
<flag name='virtio-blk.queue-size'/>
<flag name='query-dirty-rate'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>6000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>39100242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
index 0d6763e9a3..99bbb6e237 100644
--- a/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.0.0.x86_64.xml
@@ -236,6 +236,7 @@
<flag name='piix4.acpi-root-pci-hotplug'/>
<flag name='query-dirty-rate'/>
<flag name='sev-inject-launch-secret'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>6000000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100242</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml
index 228f397c67..ff0715e605 100644
--- a/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.1.0.x86_64.xml
@@ -240,6 +240,7 @@
<flag name='query-dirty-rate'/>
<flag name='rbd-encryption'/>
<flag name='sev-inject-launch-secret'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>6001000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100243</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
index 6bf9933bc5..dd6f0e6919 100644
--- a/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.aarch64.xml
@@ -203,6 +203,7 @@
<flag name='memory-backend-file.reserve'/>
<flag name='query-dirty-rate'/>
<flag name='rbd-encryption'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>6001050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>61700244</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
index 06cd7fb396..2646cdf88f 100644
--- a/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.ppc64.xml
@@ -199,6 +199,7 @@
<flag name='piix4.acpi-root-pci-hotplug'/>
<flag name='query-dirty-rate'/>
<flag name='rbd-encryption'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>6001050</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>42900244</microcodeVersion>
diff --git a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
index 75aaeed03c..f25ec1b84a 100644
--- a/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
+++ b/tests/qemucapabilitiesdata/caps_6.2.0.x86_64.xml
@@ -241,6 +241,7 @@
<flag name='rbd-encryption'/>
<flag name='sev-guest-kernel-hashes'/>
<flag name='sev-inject-launch-secret'/>
+ <flag name='memory-backend-file.prealloc-threads'/>
<version>6002000</version>
<kvmVersion>0</kvmVersion>
<microcodeVersion>43100244</microcodeVersion>
--
2.35.1

View File

@ -0,0 +1,66 @@
From 73439e9284f4c7101721ee081d5ca6249d284ed0 Mon Sep 17 00:00:00 2001
Message-Id: <73439e9284f4c7101721ee081d5ca6249d284ed0@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 21 Mar 2022 17:10:15 +0100
Subject: [PATCH] qemu_command: Generate prealloc-threads property
Let's generate prealloc-threads property onto the cmd line if
domain configuration requests so.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit b8d6ecc70c8a8e9c90bab48b6829b42d8b77c748)
Conflicts:
tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args:
Upstream has moved some cmd line arguments
(v8.0.0-260-gaf23241cfe) but that is not backported.
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2075628
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_command.c | 5 ++++-
tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args | 4 ++--
2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/src/qemu/qemu_command.c b/src/qemu/qemu_command.c
index ee0e611513..9166317895 100644
--- a/src/qemu/qemu_command.c
+++ b/src/qemu/qemu_command.c
@@ -3856,7 +3856,10 @@ qemuBuildMemoryBackendProps(virJSONValue **backendProps,
return -1;
} else {
if (!priv->memPrealloc &&
- virJSONValueObjectAdd(&props, "B:prealloc", prealloc, NULL) < 0)
+ virJSONValueObjectAdd(&props,
+ "B:prealloc", prealloc,
+ "p:prealloc-threads", def->mem.allocation_threads,
+ NULL) < 0)
return -1;
}
diff --git a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args b/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
index 04a320d469..9b2e6086c3 100644
--- a/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
+++ b/tests/qemuxml2argvdata/memfd-memory-numa.x86_64-latest.args
@@ -16,7 +16,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-instance-00000092/.config \
-m size=14680064k,slots=16,maxmem=1099511627776k \
-overcommit mem-lock=off \
-smp 8,sockets=1,dies=1,cores=8,threads=1 \
--object '{"qom-type":"memory-backend-memfd","id":"ram-node0","hugetlb":true,"hugetlbsize":2097152,"share":true,"prealloc":true,"size":15032385536,"host-nodes":[3],"policy":"preferred"}' \
+-object '{"qom-type":"memory-backend-memfd","id":"ram-node0","hugetlb":true,"hugetlbsize":2097152,"share":true,"prealloc":true,"prealloc-threads":8,"size":15032385536,"host-nodes":[3],"policy":"preferred"}' \
-numa node,nodeid=0,cpus=0-7,memdev=ram-node0 \
-uuid 126f2720-6f8e-45ab-a886-ec9277079a67 \
-display none \
@@ -29,7 +29,7 @@ XDG_CONFIG_HOME=/tmp/lib/domain--1-instance-00000092/.config \
-no-acpi \
-boot strict=on \
-device piix3-usb-uhci,id=usb,bus=pci.0,addr=0x1.0x2 \
--object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":true,"prealloc":true,"size":536870912,"host-nodes":[3],"policy":"preferred"}' \
+-object '{"qom-type":"memory-backend-file","id":"memnvdimm0","mem-path":"/tmp/nvdimm","share":true,"prealloc":true,"prealloc-threads":8,"size":536870912,"host-nodes":[3],"policy":"preferred"}' \
-device nvdimm,node=0,memdev=memnvdimm0,id=nvdimm0,slot=0 \
-audiodev '{"id":"audio1","driver":"none"}' \
-device virtio-balloon-pci,id=balloon0,bus=pci.0,addr=0x3 \
--
2.35.1

View File

@ -0,0 +1,39 @@
From 38e3785cc76842f5a00c9f744f3a581a65b2a73a Mon Sep 17 00:00:00 2001
Message-Id: <38e3785cc76842f5a00c9f744f3a581a65b2a73a@dist-git>
From: Michal Privoznik <mprivozn@redhat.com>
Date: Mon, 21 Mar 2022 17:09:40 +0100
Subject: [PATCH] qemu_validate: Validate prealloc threads against qemuCpas
Only fairly new QEMUs are capable of user provided number of
preallocation threads. Validate this assumption.
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
(cherry picked from commit 75a4e0165ef199809974e97b507d3953e1de01d1)
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2075628
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
src/qemu/qemu_validate.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/qemu/qemu_validate.c b/src/qemu/qemu_validate.c
index 3a69733f81..7bc14293d6 100644
--- a/src/qemu/qemu_validate.c
+++ b/src/qemu/qemu_validate.c
@@ -739,6 +739,13 @@ qemuValidateDomainDefMemory(const virDomainDef *def,
return -1;
}
+ if (mem->allocation_threads > 0 &&
+ !virQEMUCapsGet(qemuCaps, QEMU_CAPS_MEMORY_BACKEND_PREALLOC_THREADS)) {
+ virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
+ _("preallocation threads are unsupported with this QEMU"));
+ return -1;
+ }
+
if (mem->source == VIR_DOMAIN_MEMORY_SOURCE_ANONYMOUS) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("hugepages are not allowed with anonymous "
--
2.35.1

View File

@ -228,7 +228,7 @@
Summary: Library providing a simple virtualization API
Name: libvirt
Version: 8.0.0
Release: 8%{?dist}%{?extra_release}
Release: 8.1%{?dist}%{?extra_release}
License: LGPLv2+
URL: https://libvirt.org/
@ -254,6 +254,10 @@ Patch13: libvirt-nwfilter-hold-filter-update-lock-when-creating-deleting-binding
Patch14: libvirt-qemu-lxc-remove-use-to-nwfilter-update-lock.patch
Patch15: libvirt-qemu-support-multiqueue-for-vdpa-net-device.patch
Patch16: libvirt-qemu-fix-hotplug-for-multiqueue-vdpa-net-device.patch
Patch17: libvirt-conf-Introduce-memory-allocation-threads.patch
Patch18: libvirt-qemu_capabilities-Detect-memory-backend-.prealloc-threads-property.patch
Patch19: libvirt-qemu_validate-Validate-prealloc-threads-against-qemuCpas.patch
Patch20: libvirt-qemu_command-Generate-prealloc-threads-property.patch
Requires: libvirt-daemon = %{version}-%{release}
Requires: libvirt-daemon-config-network = %{version}-%{release}
@ -2145,6 +2149,12 @@ exit 0
%changelog
* Wed Apr 27 2022 Jiri Denemark <jdenemar@redhat.com> - 8.0.0-8.1.el9_0
- conf: Introduce memory allocation threads (rhbz#2075628)
- qemu_capabilities: Detect memory-backend-*.prealloc-threads property (rhbz#2075628)
- qemu_validate: Validate prealloc threads against qemuCpas (rhbz#2075628)
- qemu_command: Generate prealloc-threads property (rhbz#2075628)
* Thu Mar 31 2022 Jiri Denemark <jdenemar@redhat.com> - 8.0.0-8
- qemu: fix hotplug for multiqueue vdpa net device (rhbz#2024406)