|
|
9119d9 |
From 43c846034c4316cf53d193f52c59f4f9df484fe5 Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <43c846034c4316cf53d193f52c59f4f9df484fe5@dist-git>
|
|
|
9119d9 |
From: Martin Kletzander <mkletzan@redhat.com>
|
|
|
9119d9 |
Date: Thu, 15 Jan 2015 15:03:49 +0100
|
|
|
9119d9 |
Subject: [PATCH] qemu: Fix hotplugging cpus with strict memory pinning
|
|
|
9119d9 |
|
|
|
9119d9 |
When hot-plugging a VCPU into the guest, kvm needs to allocate some data
|
|
|
9119d9 |
from the DMA zone, which might be in a memory node that's not allowed in
|
|
|
9119d9 |
cpuset.mems. Basically the same problem as there was with starting the
|
|
|
9119d9 |
domain and due to which commit 7e72ac787848b7434c9359a57c1e2789d92350f8
|
|
|
9119d9 |
exists. This patch just extends it to hotplugging as well.
|
|
|
9119d9 |
|
|
|
9119d9 |
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=1161540
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
9119d9 |
(cherry picked from commit e3435caf6af41748204e542dee13ede8441d88c0)
|
|
|
9119d9 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/qemu/qemu_driver.c | 29 +++++++++++++++++++++++++++++
|
|
|
9119d9 |
1 file changed, 29 insertions(+)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
index ea9368d..afcf326 100644
|
|
|
9119d9 |
--- a/src/qemu/qemu_driver.c
|
|
|
9119d9 |
+++ b/src/qemu/qemu_driver.c
|
|
|
9119d9 |
@@ -97,6 +97,7 @@
|
|
|
9119d9 |
#include "virhostdev.h"
|
|
|
9119d9 |
#include "domain_capabilities.h"
|
|
|
9119d9 |
#include "vircgroup.h"
|
|
|
9119d9 |
+#include "virnuma.h"
|
|
|
9119d9 |
|
|
|
9119d9 |
#define VIR_FROM_THIS VIR_FROM_QEMU
|
|
|
9119d9 |
|
|
|
9119d9 |
@@ -4641,6 +4642,11 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
|
|
9119d9 |
int ncpuinfo;
|
|
|
9119d9 |
qemuDomainObjPrivatePtr priv;
|
|
|
9119d9 |
size_t i;
|
|
|
9119d9 |
+ virCgroupPtr cgroup_temp = NULL;
|
|
|
9119d9 |
+ char *mem_mask = NULL;
|
|
|
9119d9 |
+ char *all_nodes_str = NULL;
|
|
|
9119d9 |
+ virBitmapPtr all_nodes = NULL;
|
|
|
9119d9 |
+ virErrorPtr err = NULL;
|
|
|
9119d9 |
|
|
|
9119d9 |
virCheckFlags(VIR_DOMAIN_AFFECT_LIVE |
|
|
|
9119d9 |
VIR_DOMAIN_AFFECT_CONFIG |
|
|
|
9119d9 |
@@ -4666,9 +4672,22 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
|
|
9119d9 |
|
|
|
9119d9 |
priv = vm->privateData;
|
|
|
9119d9 |
|
|
|
9119d9 |
+ if (virCgroupNewEmulator(priv->cgroup, false, &cgroup_temp) < 0)
|
|
|
9119d9 |
+ goto cleanup;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ if (!(all_nodes = virNumaGetHostNodeset()))
|
|
|
9119d9 |
+ goto cleanup;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
+ if (!(all_nodes_str = virBitmapFormat(all_nodes)))
|
|
|
9119d9 |
+ goto cleanup;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
if (qemuDomainObjBeginJob(driver, vm, QEMU_JOB_MODIFY) < 0)
|
|
|
9119d9 |
goto cleanup;
|
|
|
9119d9 |
|
|
|
9119d9 |
+ if (virCgroupGetCpusetMems(cgroup_temp, &mem_mask) < 0 ||
|
|
|
9119d9 |
+ virCgroupSetCpusetMems(cgroup_temp, all_nodes_str) < 0)
|
|
|
9119d9 |
+ goto endjob;
|
|
|
9119d9 |
+
|
|
|
9119d9 |
maximum = (flags & VIR_DOMAIN_VCPU_MAXIMUM) != 0;
|
|
|
9119d9 |
flags &= ~VIR_DOMAIN_VCPU_MAXIMUM;
|
|
|
9119d9 |
|
|
|
9119d9 |
@@ -4778,6 +4797,12 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
|
|
9119d9 |
ret = 0;
|
|
|
9119d9 |
|
|
|
9119d9 |
endjob:
|
|
|
9119d9 |
+ if (mem_mask) {
|
|
|
9119d9 |
+ err = virSaveLastError();
|
|
|
9119d9 |
+ virCgroupSetCpusetMems(cgroup_temp, mem_mask);
|
|
|
9119d9 |
+ virSetError(err);
|
|
|
9119d9 |
+ }
|
|
|
9119d9 |
+
|
|
|
9119d9 |
if (!qemuDomainObjEndJob(driver, vm))
|
|
|
9119d9 |
vm = NULL;
|
|
|
9119d9 |
|
|
|
9119d9 |
@@ -4786,6 +4811,10 @@ qemuDomainSetVcpusFlags(virDomainPtr dom, unsigned int nvcpus,
|
|
|
9119d9 |
virObjectUnlock(vm);
|
|
|
9119d9 |
virObjectUnref(caps);
|
|
|
9119d9 |
VIR_FREE(cpuinfo);
|
|
|
9119d9 |
+ VIR_FREE(mem_mask);
|
|
|
9119d9 |
+ VIR_FREE(all_nodes_str);
|
|
|
9119d9 |
+ virBitmapFree(all_nodes);
|
|
|
9119d9 |
+ virCgroupFree(&cgroup_temp);
|
|
|
9119d9 |
virObjectUnref(cfg);
|
|
|
9119d9 |
return ret;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.2.1
|
|
|
9119d9 |
|