From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bandan Das Subject: Re: [PATCH v2] KVM: nVMX: Add support for rdtscp Date: Mon, 23 Mar 2015 14:18:12 -0400 Message-ID: References: <55102AB6.5060409@web.de> <55102EAA.4000502@web.de> <55105765.2080405@web.de> Mime-Version: 1.0 Content-Type: text/plain Cc: kvm , Marcelo Tosatti , Paolo Bonzini To: Jan Kiszka Return-path: Received: from mx1.redhat.com ([209.132.183.28]:55499 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752465AbbCWSSQ (ORCPT ); Mon, 23 Mar 2015 14:18:16 -0400 In-Reply-To: <55105765.2080405@web.de> (Jan Kiszka's message of "Mon, 23 Mar 2015 19:11:49 +0100") Sender: kvm-owner@vger.kernel.org List-ID: Jan Kiszka writes: > On 2015-03-23 18:01, Bandan Das wrote: >> Jan Kiszka writes: >> ... >>> --- a/arch/x86/kvm/vmx.c >>> +++ b/arch/x86/kvm/vmx.c >>> @@ -2467,6 +2467,7 @@ static void nested_vmx_setup_ctls_msrs(struct vcpu_vmx *vmx) >>> vmx->nested.nested_vmx_secondary_ctls_low = 0; >>> vmx->nested.nested_vmx_secondary_ctls_high &= >>> SECONDARY_EXEC_VIRTUALIZE_APIC_ACCESSES | >>> + SECONDARY_EXEC_RDTSCP | >>> SECONDARY_EXEC_VIRTUALIZE_X2APIC_MODE | >>> SECONDARY_EXEC_APIC_REGISTER_VIRT | >>> SECONDARY_EXEC_VIRTUAL_INTR_DELIVERY | >>> @@ -7510,7 +7511,7 @@ static bool nested_vmx_exit_handled(struct kvm_vcpu *vcpu) >>> return nested_cpu_has(vmcs12, CPU_BASED_INVLPG_EXITING); >>> case EXIT_REASON_RDPMC: >>> return nested_cpu_has(vmcs12, CPU_BASED_RDPMC_EXITING); >>> - case EXIT_REASON_RDTSC: >>> + case EXIT_REASON_RDTSC: case EXIT_REASON_RDTSCP: >>> return nested_cpu_has(vmcs12, CPU_BASED_RDTSC_EXITING); >>> case EXIT_REASON_VMCALL: case EXIT_REASON_VMCLEAR: >>> case EXIT_REASON_VMLAUNCH: case EXIT_REASON_VMPTRLD: >>> @@ -8517,6 +8518,9 @@ static void vmx_cpuid_update(struct kvm_vcpu *vcpu) >>> exec_control); >>> } >>> } >>> + if (!vmx->rdtscp_enabled) >>> + vmx->nested.nested_vmx_secondary_ctls_high &= >>> + ~SECONDARY_EXEC_RDTSCP; >> No need to do this if nested is not enabled ? Or just >> a "if (nested)" in the prior if else loop should be enough I think. > > I can add this - but this is far away from being a hotpath. What would > be the benefit? Right, definitely not a hotpath, just seems unnecessary if nested is not enabled. Bandan > Thanks, > Jan