|
|
9119d9 |
From 3dfa22b502f065f5171475b6459a4cc18d74c125 Mon Sep 17 00:00:00 2001
|
|
|
9119d9 |
Message-Id: <3dfa22b502f065f5171475b6459a4cc18d74c125@dist-git>
|
|
|
9119d9 |
From: Wang Rui <moon.wangrui@huawei.com>
|
|
|
9119d9 |
Date: Fri, 28 Nov 2014 14:36:26 +0100
|
|
|
9119d9 |
Subject: [PATCH] qemu: fix domain startup failing with 'strict' mode in
|
|
|
9119d9 |
numatune
|
|
|
9119d9 |
|
|
|
9119d9 |
https://bugzilla.redhat.com/show_bug.cgi?id=1168866
|
|
|
9119d9 |
|
|
|
9119d9 |
If the memory mode is specified as 'strict' and with one node, we
|
|
|
9119d9 |
get the following error when starting domain.
|
|
|
9119d9 |
|
|
|
9119d9 |
error: Unable to write to '$cgroup_path/cpuset.mems': Device or resource busy
|
|
|
9119d9 |
|
|
|
9119d9 |
XML is configured with numatune as follows:
|
|
|
9119d9 |
<numatune>
|
|
|
9119d9 |
<memory mode='strict' nodeset='0'/>
|
|
|
9119d9 |
</numatune>
|
|
|
9119d9 |
|
|
|
9119d9 |
It's broken by Commit 411cea638f6ec8503b7142a31e58b1cd85dbeaba
|
|
|
9119d9 |
which moved qemuSetupCgroupForEmulator() before setting cpuset.mems
|
|
|
9119d9 |
in qemuSetupCgroupPostInit.
|
|
|
9119d9 |
|
|
|
9119d9 |
Directory '$cgroup_path/emulator/' is created in qemuSetupCgroupForEmulator.
|
|
|
9119d9 |
But '$cgroup_path/emulator/cpuset.mems' it not set and has a default value
|
|
|
9119d9 |
(all nodes, such as 0-1). Then we setup '$cgroup_path/cpuset.mems' to the
|
|
|
9119d9 |
nodemask (in this case it's '0') in qemuSetupCgroupPostInit. It must fail.
|
|
|
9119d9 |
|
|
|
9119d9 |
This patch makes '$cgroup_path/emulator/cpuset.mems' is set before
|
|
|
9119d9 |
'$cgroup_path/cpuset.mems'. The action is similar with that in
|
|
|
9119d9 |
qemuDomainSetNumaParamsLive.
|
|
|
9119d9 |
|
|
|
9119d9 |
Signed-off-by: Wang Rui <moon.wangrui@huawei.com>
|
|
|
9119d9 |
(cherry picked from commit c6e90248676126c209b3b6017ad27cf6c6a0ab8f)
|
|
|
9119d9 |
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
|
|
|
9119d9 |
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
|
|
|
9119d9 |
---
|
|
|
9119d9 |
src/qemu/qemu_cgroup.c | 10 +++++++---
|
|
|
9119d9 |
1 file changed, 7 insertions(+), 3 deletions(-)
|
|
|
9119d9 |
|
|
|
9119d9 |
diff --git a/src/qemu/qemu_cgroup.c b/src/qemu/qemu_cgroup.c
|
|
|
9119d9 |
index bd22b7f..7609c0f 100644
|
|
|
9119d9 |
--- a/src/qemu/qemu_cgroup.c
|
|
|
9119d9 |
+++ b/src/qemu/qemu_cgroup.c
|
|
|
9119d9 |
@@ -611,6 +611,7 @@ static int
|
|
|
9119d9 |
qemuSetupCpusetMems(virDomainObjPtr vm,
|
|
|
9119d9 |
virBitmapPtr nodemask)
|
|
|
9119d9 |
{
|
|
|
9119d9 |
+ virCgroupPtr cgroup_temp = NULL;
|
|
|
9119d9 |
qemuDomainObjPrivatePtr priv = vm->privateData;
|
|
|
9119d9 |
char *mem_mask = NULL;
|
|
|
9119d9 |
int ret = -1;
|
|
|
9119d9 |
@@ -623,13 +624,16 @@ qemuSetupCpusetMems(virDomainObjPtr vm,
|
|
|
9119d9 |
&mem_mask, -1) < 0)
|
|
|
9119d9 |
goto cleanup;
|
|
|
9119d9 |
|
|
|
9119d9 |
- if (mem_mask &&
|
|
|
9119d9 |
- virCgroupSetCpusetMems(priv->cgroup, mem_mask) < 0)
|
|
|
9119d9 |
- goto cleanup;
|
|
|
9119d9 |
+ if (mem_mask)
|
|
|
9119d9 |
+ if (virCgroupNewEmulator(priv->cgroup, false, &cgroup_temp) < 0 ||
|
|
|
9119d9 |
+ virCgroupSetCpusetMems(cgroup_temp, mem_mask) < 0 ||
|
|
|
9119d9 |
+ virCgroupSetCpusetMems(priv->cgroup, mem_mask) < 0)
|
|
|
9119d9 |
+ goto cleanup;
|
|
|
9119d9 |
|
|
|
9119d9 |
ret = 0;
|
|
|
9119d9 |
cleanup:
|
|
|
9119d9 |
VIR_FREE(mem_mask);
|
|
|
9119d9 |
+ virCgroupFree(&cgroup_temp);
|
|
|
9119d9 |
return ret;
|
|
|
9119d9 |
}
|
|
|
9119d9 |
|
|
|
9119d9 |
--
|
|
|
9119d9 |
2.1.3
|
|
|
9119d9 |
|