]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: leave restricting cpuset.mems after initialization
authorMartin Kletzander <mkletzan@redhat.com>
Tue, 8 Jul 2014 07:59:49 +0000 (09:59 +0200)
committerMartin Kletzander <mkletzan@redhat.com>
Wed, 16 Jul 2014 18:15:46 +0000 (20:15 +0200)
When domain is started with numatune memory mode strict and the
nodeset does not include host NUMA node with DMA and DMA32 zones, KVM
initialization fails.  This is because cgroup restrict even kernel
allocations.  We are already doing numa_set_membind() which does the
same thing, only it does not restrict kernel allocations.

This patch leaves the userspace numa_set_membind() in place and moves
the cpuset.mems setting after the point where monitor comes up, but
before vcpu and emulator sub-groups are created.

Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/qemu_cgroup.c
src/qemu/qemu_cgroup.h
src/qemu/qemu_process.c

index e95ad17ddc92b27dd5b43132f86f5c92db1380ff..62a8f8183b0f26c93654c84ec51e44b1abd22d6c 100644 (file)
@@ -627,9 +627,6 @@ qemuSetupCpusetCgroup(virDomainObjPtr vm,
     if (!virCgroupHasController(priv->cgroup, VIR_CGROUP_CONTROLLER_CPUSET))
         return 0;
 
-    if (qemuSetupCpusetMems(vm, nodemask) < 0)
-        goto cleanup;
-
     if (vm->def->cpumask ||
         (vm->def->placement_mode == VIR_DOMAIN_CPU_PLACEMENT_MODE_AUTO)) {
 
@@ -825,6 +822,13 @@ qemuSetupCgroup(virQEMUDriverPtr driver,
     return ret;
 }
 
+int
+qemuSetupCgroupPostInit(virDomainObjPtr vm,
+                        virBitmapPtr nodemask)
+{
+    return qemuSetupCpusetMems(vm, nodemask);
+}
+
 int
 qemuSetupCgroupVcpuBW(virCgroupPtr cgroup,
                       unsigned long long period,
index 732860e27e9b81c0c8745c55800cf9a6104ac988..73949694222cbcbc82759afb453e1429554714e5 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * qemu_cgroup.h: QEMU cgroup management
  *
- * Copyright (C) 2006-2007, 2009-2013 Red Hat, Inc.
+ * Copyright (C) 2006-2007, 2009-2014 Red Hat, Inc.
  * Copyright (C) 2006 Daniel P. Berrange
  *
  * This library is free software; you can redistribute it and/or
@@ -47,6 +47,8 @@ int qemuConnectCgroup(virQEMUDriverPtr driver,
 int qemuSetupCgroup(virQEMUDriverPtr driver,
                     virDomainObjPtr vm,
                     virBitmapPtr nodemask);
+int qemuSetupCgroupPostInit(virDomainObjPtr vm,
+                            virBitmapPtr nodemask);
 int qemuSetupCgroupVcpuBW(virCgroupPtr cgroup,
                           unsigned long long period,
                           long long quota);
index 4c57f15a20c8a083f2b1f50825ebe89b8122e4ea..8a6b38485b7a1c875fbb5aacd3d01e0aba15ee97 100644 (file)
@@ -4155,6 +4155,10 @@ int qemuProcessStart(virConnectPtr conn,
     if (!qemuProcessVerifyGuestCPU(driver, vm))
         goto cleanup;
 
+    VIR_DEBUG("Setting up post-init cgroup restrictions");
+    if (qemuSetupCgroupPostInit(vm, nodemask) < 0)
+        goto cleanup;
+
     VIR_DEBUG("Detecting VCPU PIDs");
     if (qemuProcessDetectVcpuPIDs(driver, vm) < 0)
         goto cleanup;