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