]> xenbits.xensource.com Git - libvirt.git/commitdiff
qemu_hotplug: Temporarily allow emulator thread to access other NUMA nodes during...
authorMichal Privoznik <mprivozn@redhat.com>
Mon, 22 May 2023 13:55:10 +0000 (15:55 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Tue, 23 May 2023 15:21:16 +0000 (17:21 +0200)
Again, this fixes the same problem as one of previous commits,
but this time for memory hotplug. Long story short, if there's a
domain running and the emulator thread is restricted to a subset
of host NUMA nodes, but the memory that's about to be hotplugged
requires memory from a host NUMA node that's not in the set we
need to allow emulator thread to access the node, temporarily.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Martin Kletzander <mkletzan@redhat.com>
src/qemu/qemu_hotplug.c
src/qemu/qemu_process.c
src/qemu/qemu_process.h

index d5148f581543d5a1e2fe892b00a2c241f75936bf..972df572a7b5301a87c78223cf2a713a5cabca92 100644 (file)
@@ -2247,6 +2247,7 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
     bool teardownlabel = false;
     bool teardowncgroup = false;
     bool teardowndevice = false;
+    bool restoreemulatorcgroup = false;
     g_autoptr(virJSONValue) props = NULL;
     virObjectEvent *event;
     int id;
@@ -2294,6 +2295,10 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
     if (qemuDomainAdjustMaxMemLock(vm) < 0)
         goto removedef;
 
+    if (qemuProcessSetupEmulator(vm, true) < 0)
+        goto removedef;
+    restoreemulatorcgroup = true;
+
     qemuDomainObjEnterMonitor(vm);
     if (qemuMonitorAddObject(priv->mon, &props, NULL) < 0)
         goto exit_monitor;
@@ -2333,6 +2338,9 @@ qemuDomainAttachMemory(virQEMUDriver *driver,
             qemuDomainReleaseMemoryDeviceSlot(vm, mem);
     }
 
+    if (restoreemulatorcgroup)
+        qemuProcessSetupEmulator(vm, false);
+
     virDomainMemoryDefFree(mem);
     return ret;
 
index ee11c72016f3f5a61859063ca68bd1592727eeb7..730e59eb7eca3bdc4dec61e81c5f141700ef20cd 100644 (file)
@@ -2701,7 +2701,7 @@ qemuProcessSetupPid(virDomainObj *vm,
 }
 
 
-static int
+int
 qemuProcessSetupEmulator(virDomainObj *vm,
                          bool unionMems)
 {
index e0cbafda1d24b582409e62a4536218a83169420c..1c4c0678ab5c3bb40158beb13554c35dde24c2ba 100644 (file)
@@ -235,3 +235,6 @@ void qemuProcessCleanupMigrationJob(virQEMUDriver *driver,
 
 void qemuProcessRefreshDiskProps(virDomainDiskDef *disk,
                                  struct qemuDomainDiskInfo *info);
+
+int qemuProcessSetupEmulator(virDomainObj *vm,
+                             bool unionMems);