|
|
c480ed |
From 607f70a5d24d2df9c63861434c4ba1991226ee34 Mon Sep 17 00:00:00 2001
|
|
|
c480ed |
Message-Id: <607f70a5d24d2df9c63861434c4ba1991226ee34@dist-git>
|
|
|
c480ed |
From: Andrea Bolognani <abologna@redhat.com>
|
|
|
c480ed |
Date: Tue, 11 Jun 2019 10:55:03 +0200
|
|
|
c480ed |
Subject: [PATCH] qemu: Fix qemuProcessInitCpuAffinity()
|
|
|
c480ed |
MIME-Version: 1.0
|
|
|
c480ed |
Content-Type: text/plain; charset=UTF-8
|
|
|
c480ed |
Content-Transfer-Encoding: 8bit
|
|
|
c480ed |
|
|
|
c480ed |
Ever since the feature was introduced with commit 0f8e7ae33ace,
|
|
|
c480ed |
it has contained a logic error in that it attempted to use a NUMA
|
|
|
c480ed |
node map where a CPU map was expected.
|
|
|
c480ed |
|
|
|
c480ed |
Because of that, guests using <numatune> might fail to start:
|
|
|
c480ed |
|
|
|
c480ed |
# virsh start guest
|
|
|
c480ed |
error: Failed to start domain guest
|
|
|
c480ed |
error: cannot set CPU affinity on process 40055: Invalid argument
|
|
|
c480ed |
|
|
|
c480ed |
This was particularly easy to trigger on POWER 8 machines, where
|
|
|
c480ed |
secondary threads always show up as offline in the host: having
|
|
|
c480ed |
|
|
|
c480ed |
<numatune>
|
|
|
c480ed |
<memory mode='strict' placement='static' nodeset='1'/>
|
|
|
c480ed |
</numatune>
|
|
|
c480ed |
|
|
|
c480ed |
in the guest configuration, for example, would result in libvirt
|
|
|
c480ed |
trying to set the process affinity so that it would prefer
|
|
|
c480ed |
running on CPU 1, but since that's a secondary thread and thus
|
|
|
c480ed |
shows up as offline, the operation would fail, and so would
|
|
|
c480ed |
starting the guest.
|
|
|
c480ed |
|
|
|
c480ed |
Use the newly introduced virNumaNodesetToCPUset() to convert the
|
|
|
c480ed |
NUMA node map to a CPU map, which in the example above would be
|
|
|
c480ed |
48,56,64,72,80,88 - a valid input for virProcessSetAffinity().
|
|
|
c480ed |
|
|
|
c480ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1703661
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
(cherry picked from commit 5f2212c062c720716b7701fa0a5511311dc6e906)
|
|
|
c480ed |
|
|
|
c480ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1716908
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
c480ed |
Message-Id: <20190611085506.12564-4-abologna@redhat.com>
|
|
|
c480ed |
Reviewed-by: Ján Tomko <jtomko@redhat.com>
|
|
|
c480ed |
---
|
|
|
c480ed |
src/qemu/qemu_process.c | 7 ++++++-
|
|
|
c480ed |
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
|
c480ed |
index 8b05cef80c..a3b71354e1 100644
|
|
|
c480ed |
--- a/src/qemu/qemu_process.c
|
|
|
c480ed |
+++ b/src/qemu/qemu_process.c
|
|
|
c480ed |
@@ -2382,11 +2382,16 @@ qemuProcessInitCpuAffinity(virDomainObjPtr vm)
|
|
|
c480ed |
if (virDomainNumaGetNodeCount(vm->def->numa) <= 1 &&
|
|
|
c480ed |
virDomainNumatuneGetMode(vm->def->numa, -1, &mem_mode) == 0 &&
|
|
|
c480ed |
mem_mode == VIR_DOMAIN_NUMATUNE_MEM_STRICT) {
|
|
|
c480ed |
+ virBitmapPtr nodeset = NULL;
|
|
|
c480ed |
+
|
|
|
c480ed |
if (virDomainNumatuneMaybeGetNodeset(vm->def->numa,
|
|
|
c480ed |
priv->autoNodeset,
|
|
|
c480ed |
- &cpumapToSet,
|
|
|
c480ed |
+ &nodeset,
|
|
|
c480ed |
-1) < 0)
|
|
|
c480ed |
goto cleanup;
|
|
|
c480ed |
+
|
|
|
c480ed |
+ if (virNumaNodesetToCPUset(nodeset, &cpumapToSet) < 0)
|
|
|
c480ed |
+ goto cleanup;
|
|
|
c480ed |
} else if (vm->def->cputune.emulatorpin) {
|
|
|
c480ed |
cpumapToSet = vm->def->cputune.emulatorpin;
|
|
|
c480ed |
} else {
|
|
|
c480ed |
--
|
|
|
c480ed |
2.22.0
|
|
|
c480ed |
|