From patchwork Thu Feb 11 20:19:19 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 8284851 Return-Path: X-Original-To: patchwork-qemu-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 30315BEEE5 for ; Thu, 11 Feb 2016 20:19:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6ACA220364 for ; Thu, 11 Feb 2016 20:19:57 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 934162035D for ; Thu, 11 Feb 2016 20:19:56 +0000 (UTC) Received: from localhost ([::1]:53268 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTxiV-00041I-M8 for patchwork-qemu-devel@patchwork.kernel.org; Thu, 11 Feb 2016 15:19:55 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:59648) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTxiO-000414-Ba for qemu-devel@nongnu.org; Thu, 11 Feb 2016 15:19:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aTxiK-00030v-UG for qemu-devel@nongnu.org; Thu, 11 Feb 2016 15:19:48 -0500 Received: from mailhub.sw.ru ([195.214.232.25]:13366 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aTxiK-0002uR-I6 for qemu-devel@nongnu.org; Thu, 11 Feb 2016 15:19:44 -0500 Received: from irbis.sw.ru ([10.30.2.139]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id u1BIBlK2017136; Thu, 11 Feb 2016 21:11:48 +0300 (MSK) From: "Denis V. Lunev" To: Date: Thu, 11 Feb 2016 23:19:19 +0300 Message-Id: <1455221959-22728-1-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.1.4 MIME-Version: 1.0 X-MIME-Autoconverted: from 8bit to quoted-printable by relay.sw.ru id u1BIBlK2017136 X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Cc: Eduardo Habkost , qemu-devel@nongnu.org, Paolo Bonzini , "Alexey V. Kostyushko" , "Denis V. Lunev" , =?UTF-8?q?Andreas=20F=C3=A4rber?= , Richard Henderson Subject: [Qemu-devel] [PATCH 1/1] hyperv: cpu hotplug fix with HyperV enabled X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Alexey V. Kostyushko" 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 Signed-off-by: Denis V. Lunev CC: Paolo Bonzini CC: Richard Henderson CC: Eduardo Habkost CC: "Andreas Färber" --- 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; }