From patchwork Sat Jul 25 09:55:42 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 37314 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6P9u7v2000901 for ; Sat, 25 Jul 2009 09:56:07 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752086AbZGYJzt (ORCPT ); Sat, 25 Jul 2009 05:55:49 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752138AbZGYJzt (ORCPT ); Sat, 25 Jul 2009 05:55:49 -0400 Received: from fmmailgate02.web.de ([217.72.192.227]:34859 "EHLO fmmailgate02.web.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752086AbZGYJzs (ORCPT ); Sat, 25 Jul 2009 05:55:48 -0400 Received: from smtp07.web.de (fmsmtp07.dlan.cinetic.de [172.20.5.215]) by fmmailgate02.web.de (Postfix) with ESMTP id 8276110D942A6; Sat, 25 Jul 2009 11:55:47 +0200 (CEST) Received: from [88.66.122.138] (helo=[192.168.1.10]) by smtp07.web.de with asmtp (TLSv1:AES256-SHA:256) (WEB.DE 4.110 #277) id 1MUdyl-0008NT-00; Sat, 25 Jul 2009 11:55:47 +0200 Message-ID: <4A6AD69E.7030201@web.de> Date: Sat, 25 Jul 2009 11:55:42 +0200 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: Avi Kivity CC: Gregory Haskins , kvm-devel , RT , "Yang, Sheng" Subject: Re: Host latency peaks due to kvm-intel References: <4A68A6E5.6010808@siemens.com> <4A68BD5D.1070302@gmail.com> <4A6981B0.3000008@siemens.com> <4A6ABF28.1010602@redhat.com> In-Reply-To: <4A6ABF28.1010602@redhat.com> X-Enigmail-Version: 0.95.7 X-Sender: jan.kiszka@web.de X-Provags-ID: V01U2FsdGVkX1/atuNrtrhgjMjeQOTCIorUuiKJyLeLDxrhlLN1 VE4F6BK0PB1zzvLdjuQOJhQEzxjDFHEy2D2JO7EOgfRdZYnitS c8sY5r920= Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org Avi Kivity wrote: > On 07/24/2009 12:41 PM, Jan Kiszka wrote: >> I vaguely recall that someone promised to add a feature reporting >> facility for all those nice things, modern VM-extensions may or may not >> support (something like or even an extension of /proc/cpuinfo). What is >> the state of this plan? Would be specifically interesting for Intel CPUs >> as there seem to be many of them out there with restrictions for special >> use cases - like real-time. >> > > Newer kernels do report some vmx features (like flexpriority) in > /proc/cpuinfo but not all. > Ah, nice. Then we just need this? ------------> From: Jan Kiszka Subject: [PATCH] x86: Report VMX feature vwbinvd Not all VMX-capable CPUs support guest exists on wbinvd execution. If this is not supported, the instruction will run natively on behalf of the guest. This can cause multi-millisecond latencies to the host which is very problematic in real-time scenarios. Report the wbinvd trapping feature along with other VMX feature flags, calling it 'vwbinvd' ('virtual wbinvd'). Signed-off-by: Jan Kiszka Acked-by: H. Peter Anvin --- arch/x86/include/asm/cpufeature.h | 1 + arch/x86/kernel/cpu/intel.c | 4 ++++ 2 files changed, 5 insertions(+), 0 deletions(-) diff --git a/arch/x86/include/asm/cpufeature.h b/arch/x86/include/asm/cpufeature.h index 4a28d22..8647524 100644 --- a/arch/x86/include/asm/cpufeature.h +++ b/arch/x86/include/asm/cpufeature.h @@ -165,6 +165,7 @@ #define X86_FEATURE_FLEXPRIORITY (8*32+ 2) /* Intel FlexPriority */ #define X86_FEATURE_EPT (8*32+ 3) /* Intel Extended Page Table */ #define X86_FEATURE_VPID (8*32+ 4) /* Intel Virtual Processor ID */ +#define X86_FEATURE_VWBINVD (8*32+ 5) /* Guest Exiting on WBINVD */ #if defined(__KERNEL__) && !defined(__ASSEMBLY__) diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c index 3260ab0..2d921b0 100644 --- a/arch/x86/kernel/cpu/intel.c +++ b/arch/x86/kernel/cpu/intel.c @@ -297,6 +297,7 @@ static void __cpuinit detect_vmx_virtcap(struct cpuinfo_x86 *c) #define X86_VMX_FEATURE_PROC_CTLS2_VIRT_APIC 0x00000001 #define X86_VMX_FEATURE_PROC_CTLS2_EPT 0x00000002 #define X86_VMX_FEATURE_PROC_CTLS2_VPID 0x00000020 +#define X86_VMX_FEATURE_PROC_CTLS2_VWBINVD 0x00000040 u32 vmx_msr_low, vmx_msr_high, msr_ctl, msr_ctl2; @@ -305,6 +306,7 @@ static void __cpuinit detect_vmx_virtcap(struct cpuinfo_x86 *c) clear_cpu_cap(c, X86_FEATURE_FLEXPRIORITY); clear_cpu_cap(c, X86_FEATURE_EPT); clear_cpu_cap(c, X86_FEATURE_VPID); + clear_cpu_cap(c, X86_FEATURE_VWBINVD); rdmsr(MSR_IA32_VMX_PROCBASED_CTLS, vmx_msr_low, vmx_msr_high); msr_ctl = vmx_msr_high | vmx_msr_low; @@ -323,6 +325,8 @@ static void __cpuinit detect_vmx_virtcap(struct cpuinfo_x86 *c) set_cpu_cap(c, X86_FEATURE_EPT); if (msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_VPID) set_cpu_cap(c, X86_FEATURE_VPID); + if (msr_ctl2 & X86_VMX_FEATURE_PROC_CTLS2_VWBINVD) + set_cpu_cap(c, X86_FEATURE_VWBINVD); } }