9119d9
From 9cdd161539582fb5262a98d2e8d0ce3645b308f9 Mon Sep 17 00:00:00 2001
9119d9
Message-Id: <9cdd161539582fb5262a98d2e8d0ce3645b308f9@dist-git>
9119d9
From: Zhou yimin <zhouyimin@huawei.com>
9119d9
Date: Thu, 4 Dec 2014 14:28:26 +0100
9119d9
Subject: [PATCH] qemu: move setting emulatorpin ahead of monitor showing up
9119d9
9119d9
https://bugzilla.redhat.com/show_bug.cgi?id=1170484
9119d9
9119d9
If VM is configured with many devices(including passthrough devices)
9119d9
and large memory, libvirtd will take seconds(in the worst case) to
9119d9
wait for monitor. In this period the qemu process may run on any
9119d9
PCPU though I intend to pin emulator to the specified PCPU in xml
9119d9
configuration.
9119d9
9119d9
Actually qemu process takes high cpu usage during vm startup.
9119d9
So this is not the strict CPU isolation in this case.
9119d9
9119d9
Signed-off-by: Zhou yimin <zhouyimin@huawei.com>
9119d9
(cherry picked from commit 411cea638f6ec8503b7142a31e58b1cd85dbeaba)
9119d9
Signed-off-by: Martin Kletzander <mkletzan@redhat.com>
9119d9
Signed-off-by: Jiri Denemark <jdenemar@redhat.com>
9119d9
---
9119d9
 src/qemu/qemu_process.c | 16 ++++++++--------
9119d9
 1 file changed, 8 insertions(+), 8 deletions(-)
9119d9
9119d9
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
9119d9
index 904af95..3d275a3 100644
9119d9
--- a/src/qemu/qemu_process.c
9119d9
+++ b/src/qemu/qemu_process.c
9119d9
@@ -4681,6 +4681,14 @@ int qemuProcessStart(virConnectPtr conn,
9119d9
     if (ret == -1) /* The VM failed to start */
9119d9
         goto cleanup;
9119d9
 
9119d9
+    VIR_DEBUG("Setting cgroup for emulator (if required)");
9119d9
+    if (qemuSetupCgroupForEmulator(driver, vm, nodemask) < 0)
9119d9
+        goto cleanup;
9119d9
+
9119d9
+    VIR_DEBUG("Setting affinity of emulator threads");
9119d9
+    if (qemuProcessSetEmulatorAffinity(vm) < 0)
9119d9
+        goto cleanup;
9119d9
+
9119d9
     VIR_DEBUG("Waiting for monitor to show up");
9119d9
     if (qemuProcessWaitForMonitor(driver, vm, asyncJob, priv->qemuCaps, pos) < 0)
9119d9
         goto cleanup;
9119d9
@@ -4716,10 +4724,6 @@ int qemuProcessStart(virConnectPtr conn,
9119d9
     if (qemuSetupCgroupForVcpu(vm) < 0)
9119d9
         goto cleanup;
9119d9
 
9119d9
-    VIR_DEBUG("Setting cgroup for emulator (if required)");
9119d9
-    if (qemuSetupCgroupForEmulator(driver, vm, nodemask) < 0)
9119d9
-        goto cleanup;
9119d9
-
9119d9
     VIR_DEBUG("Setting cgroup for each IOThread (if required)");
9119d9
     if (qemuSetupCgroupForIOThreads(vm) < 0)
9119d9
         goto cleanup;
9119d9
@@ -4728,10 +4732,6 @@ int qemuProcessStart(virConnectPtr conn,
9119d9
     if (qemuProcessSetVcpuAffinities(vm) < 0)
9119d9
         goto cleanup;
9119d9
 
9119d9
-    VIR_DEBUG("Setting affinity of emulator threads");
9119d9
-    if (qemuProcessSetEmulatorAffinity(vm) < 0)
9119d9
-        goto cleanup;
9119d9
-
9119d9
     VIR_DEBUG("Setting affinity of IOThread threads");
9119d9
     if (qemuProcessSetIOThreadsAffinity(vm) < 0)
9119d9
         goto cleanup;
9119d9
-- 
9119d9
2.2.0
9119d9