]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
qemu: move setting emulatorpin ahead of monitor showing up
authorZhou yimin <zhouyimin@huawei.com>
Thu, 16 Oct 2014 14:18:48 +0000 (22:18 +0800)
committerDaniel P. Berrange <berrange@redhat.com>
Wed, 22 Apr 2015 17:54:30 +0000 (18:54 +0100)
If VM is configured with many devices(including passthrough devices)
and large memory, libvirtd will take seconds(in the worst case) to
wait for monitor. In this period the qemu process may run on any
PCPU though I intend to pin emulator to the specified PCPU in xml
configuration.

Actually qemu process takes high cpu usage during vm startup.
So this is not the strict CPU isolation in this case.

Signed-off-by: Zhou yimin <zhouyimin@huawei.com>
(cherry picked from commit 411cea638f6ec8503b7142a31e58b1cd85dbeaba)

src/qemu/qemu_process.c

index a1f9c53b1a8df30fd2c9ff84fc8f5cd70ed122ef..a6e615330f26c5f4d22a8444a07d17b00c5a691a 100644 (file)
@@ -4527,6 +4527,14 @@ int qemuProcessStart(virConnectPtr conn,
     if (ret == -1) /* The VM failed to start */
         goto cleanup;
 
+    VIR_DEBUG("Setting cgroup for emulator (if required)");
+    if (qemuSetupCgroupForEmulator(driver, vm, nodemask) < 0)
+        goto cleanup;
+
+    VIR_DEBUG("Setting affinity of emulator threads");
+    if (qemuProcessSetEmulatorAffinity(vm) < 0)
+        goto cleanup;
+
     VIR_DEBUG("Waiting for monitor to show up");
     if (qemuProcessWaitForMonitor(driver, vm, asyncJob, priv->qemuCaps, pos) < 0)
         goto cleanup;
@@ -4562,10 +4570,6 @@ int qemuProcessStart(virConnectPtr conn,
     if (qemuSetupCgroupForVcpu(vm) < 0)
         goto cleanup;
 
-    VIR_DEBUG("Setting cgroup for emulator (if required)");
-    if (qemuSetupCgroupForEmulator(driver, vm, nodemask) < 0)
-        goto cleanup;
-
     VIR_DEBUG("Setting cgroup for each IOThread (if required)");
     if (qemuSetupCgroupForIOThreads(vm) < 0)
         goto cleanup;
@@ -4574,10 +4578,6 @@ int qemuProcessStart(virConnectPtr conn,
     if (qemuProcessSetVcpuAffinities(vm) < 0)
         goto cleanup;
 
-    VIR_DEBUG("Setting affinity of emulator threads");
-    if (qemuProcessSetEmulatorAffinity(vm) < 0)
-        goto cleanup;
-
     VIR_DEBUG("Setting affinity of IOThread threads");
     if (qemuProcessSetIOThreadsAffinity(vm) < 0)
         goto cleanup;