qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 1/1] hyperv: cpu hotplug fix with HyperV enabled


From: Denis V. Lunev
Subject: [Qemu-devel] [PATCH 1/1] hyperv: cpu hotplug fix with HyperV enabled
Date: Thu, 11 Feb 2016 23:19:19 +0300

From: "Alexey V. Kostyushko" <address@hidden>

With Hyper-V enabled CPU hotplug stops working. The CPU appears in device
manager on Windows but does not appear in peformance monitor and control
panel.

The root of the problem is the following. Windows checks
HV_X64_CPU_DYNAMIC_PARTITIONING_AVAILABLE bit in CPUID. The presence of
this bit is enough to cure the situation.

Add option 'hv-cpuhotplug' to control this behavior.

Signed-off-by: Alexey V. Kostyushko <address@hidden>
Signed-off-by: Denis V. Lunev <address@hidden>
CC: Paolo Bonzini <address@hidden>
CC: Richard Henderson <address@hidden>
CC: Eduardo Habkost <address@hidden>
CC: "Andreas Färber" <address@hidden>
---
 target-i386/cpu-qom.h | 1 +
 target-i386/cpu.c     | 1 +
 target-i386/kvm.c     | 6 +++++-
 3 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h
index 5f9d960..4aec616 100644
--- a/target-i386/cpu-qom.h
+++ b/target-i386/cpu-qom.h
@@ -96,6 +96,7 @@ typedef struct X86CPU {
     bool hyperv_runtime;
     bool hyperv_synic;
     bool hyperv_stimer;
+    bool hyperv_cpuhotplug;
     bool check_cpuid;
     bool enforce_cpuid;
     bool expose_kvm;
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index b255644..32c38ae 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -3172,6 +3172,7 @@ static Property x86_cpu_properties[] = {
     DEFINE_PROP_BOOL("hv-runtime", X86CPU, hyperv_runtime, false),
     DEFINE_PROP_BOOL("hv-synic", X86CPU, hyperv_synic, false),
     DEFINE_PROP_BOOL("hv-stimer", X86CPU, hyperv_stimer, false),
+    DEFINE_PROP_BOOL("hv-cpuhotplug", X86CPU, hyperv_cpuhotplug, false),
     DEFINE_PROP_BOOL("check", X86CPU, check_cpuid, true),
     DEFINE_PROP_BOOL("enforce", X86CPU, enforce_cpuid, false),
     DEFINE_PROP_BOOL("kvm", X86CPU, expose_kvm, true),
diff --git a/target-i386/kvm.c b/target-i386/kvm.c
index 94024bc..f4692b9 100644
--- a/target-i386/kvm.c
+++ b/target-i386/kvm.c
@@ -529,7 +529,8 @@ static bool hyperv_enabled(X86CPU *cpu)
             cpu->hyperv_vpindex ||
             cpu->hyperv_runtime ||
             cpu->hyperv_synic ||
-            cpu->hyperv_stimer);
+            cpu->hyperv_stimer ||
+            cpu->hyperv_cpuhotplug);
 }
 
 static int kvm_arch_set_tsc_khz(CPUState *cs)
@@ -636,6 +637,9 @@ int kvm_arch_init_vcpu(CPUState *cs)
             c->eax |= 0x200;
             has_msr_hv_tsc = true;
         }
+        if (cpu->hyperv_cpuhotplug) {
+            c->edx |= HV_X64_CPU_DYNAMIC_PARTITIONING_AVAILABLE;
+        }
         if (cpu->hyperv_crash && has_msr_hv_crash) {
             c->edx |= HV_X64_GUEST_CRASH_MSR_AVAILABLE;
         }
-- 
2.1.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]