|
|
c480ed |
From ac89574e251dfecf34606083e402194ded63dba2 Mon Sep 17 00:00:00 2001
|
|
|
c480ed |
Message-Id: <ac89574e251dfecf34606083e402194ded63dba2@dist-git>
|
|
|
c480ed |
From: Michal Privoznik <mprivozn@redhat.com>
|
|
|
c480ed |
Date: Wed, 5 Jun 2019 11:33:29 +0200
|
|
|
c480ed |
Subject: [PATCH] qemu: Set up EMULATOR thread and cpuset.mems before
|
|
|
c480ed |
exec()-ing qemu
|
|
|
c480ed |
|
|
|
c480ed |
It's funny how this went unnoticed for such a long time. Long
|
|
|
c480ed |
story short, if a domain is configured with
|
|
|
c480ed |
VIR_DOMAIN_NUMATUNE_MEM_STRICT libvirt doesn't really honour
|
|
|
c480ed |
that. This is because of 7e72ac787848 after which libvirt allowed
|
|
|
c480ed |
qemu to allocate memory just anywhere and only after that it used
|
|
|
c480ed |
some magic involving cpuset.memory_migrate and cpuset.mems to
|
|
|
c480ed |
move the memory to desired NUMA nodes. This was done in order to
|
|
|
c480ed |
work around some KVM bug where KVM would fail if there wasn't a
|
|
|
c480ed |
DMA zone available on the NUMA node. Well, while the work around
|
|
|
c480ed |
might stopped libvirt tickling the KVM bug it also caused a bug
|
|
|
c480ed |
on libvirt side: if there is not enough memory on configured NUMA
|
|
|
c480ed |
node(s) then any attempt to start a domain must fail. Because of
|
|
|
c480ed |
the way we play with guest memory domains can start just happily.
|
|
|
c480ed |
|
|
|
c480ed |
The solution is to move the child we've just forked into emulator
|
|
|
c480ed |
cgroup, set up cpuset.mems and exec() qemu only after that.
|
|
|
c480ed |
|
|
|
c480ed |
This basically reverts 7e72ac787848b7434c9 which was a workaround
|
|
|
c480ed |
for kernel bug. This bug was apparently fixed because I've tested
|
|
|
c480ed |
this successfully with recent kernel.
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
c480ed |
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
c480ed |
(cherry picked from commit 0eaa4716e1b8f6eb59d77049aed3735c3b5fbdd6)
|
|
|
c480ed |
|
|
|
c480ed |
https://bugzilla.redhat.com/show_bug.cgi?id=1716943
|
|
|
c480ed |
|
|
|
c480ed |
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
|
|
|
c480ed |
Message-Id: <fe479c5bad92778ec29f1c1bf4fb0c7b9049f3ab.1559727075.git.mprivozn@redhat.com>
|
|
|
c480ed |
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
|
|
|
c480ed |
---
|
|
|
c480ed |
src/qemu/qemu_process.c | 8 ++++----
|
|
|
c480ed |
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
c480ed |
|
|
|
c480ed |
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
|
|
|
c480ed |
index 6071b3ba3d..8b05cef80c 100644
|
|
|
c480ed |
--- a/src/qemu/qemu_process.c
|
|
|
c480ed |
+++ b/src/qemu/qemu_process.c
|
|
|
c480ed |
@@ -6442,6 +6442,10 @@ qemuProcessLaunch(virConnectPtr conn,
|
|
|
c480ed |
if (qemuProcessInitCpuAffinity(vm) < 0)
|
|
|
c480ed |
goto cleanup;
|
|
|
c480ed |
|
|
|
c480ed |
+ VIR_DEBUG("Setting emulator tuning/settings");
|
|
|
c480ed |
+ if (qemuProcessSetupEmulator(vm) < 0)
|
|
|
c480ed |
+ goto cleanup;
|
|
|
c480ed |
+
|
|
|
c480ed |
VIR_DEBUG("Setting cgroup for external devices (if required)");
|
|
|
c480ed |
if (qemuSetupCgroupForExtDevices(vm, driver) < 0)
|
|
|
c480ed |
goto cleanup;
|
|
|
c480ed |
@@ -6533,10 +6537,6 @@ qemuProcessLaunch(virConnectPtr conn,
|
|
|
c480ed |
if (qemuProcessDetectIOThreadPIDs(driver, vm, asyncJob) < 0)
|
|
|
c480ed |
goto cleanup;
|
|
|
c480ed |
|
|
|
c480ed |
- VIR_DEBUG("Setting emulator tuning/settings");
|
|
|
c480ed |
- if (qemuProcessSetupEmulator(vm) < 0)
|
|
|
c480ed |
- goto cleanup;
|
|
|
c480ed |
-
|
|
|
c480ed |
VIR_DEBUG("Setting global CPU cgroup (if required)");
|
|
|
c480ed |
if (qemuSetupGlobalCpuCgroup(vm) < 0)
|
|
|
c480ed |
goto cleanup;
|
|
|
c480ed |
--
|
|
|
c480ed |
2.22.0
|
|
|
c480ed |
|