From mboxrd@z Thu Jan 1 00:00:00 1970 From: Paolo Bonzini Subject: Re: [PATCH 3/5] x86/kvm: Convert some slow-path static_cpu_has() callers to boot_cpu_has() Date: Sun, 31 Mar 2019 16:20:11 +0200 Message-ID: <2f71cb35-46b2-9ed5-28b3-c6eb5e647b46@redhat.com> References: <20190330112022.28888-1-bp@alien8.de> <20190330112022.28888-4-bp@alien8.de> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: Nadav Amit , Andy Lutomirski , Peter Zijlstra , "H. Peter Anvin" , Ingo Molnar , Joerg Roedel , kvm@vger.kernel.org, =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Thomas Gleixner , x86@kernel.org To: Borislav Petkov , LKML Return-path: In-Reply-To: <20190330112022.28888-4-bp@alien8.de> Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 30/03/19 12:20, Borislav Petkov wrote: > @@ -2252,7 +2252,7 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu) > for (i = 0; i < NR_HOST_SAVE_USER_MSRS; i++) > rdmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]); > > - if (static_cpu_has(X86_FEATURE_TSCRATEMSR)) { > + if (boot_cpu_has(X86_FEATURE_TSCRATEMSR)) { > u64 tsc_ratio = vcpu->arch.tsc_scaling_ratio; > if (tsc_ratio != __this_cpu_read(current_tsc_ratio)) { > __this_cpu_write(current_tsc_ratio, tsc_ratio); > @@ -2260,7 +2260,7 @@ static void svm_vcpu_load(struct kvm_vcpu *vcpu, int cpu) > } > } > /* This assumes that the kernel never uses MSR_TSC_AUX */ > - if (static_cpu_has(X86_FEATURE_RDTSCP)) > + if (boot_cpu_has(X86_FEATURE_RDTSCP)) > wrmsrl(MSR_TSC_AUX, svm->tsc_aux); > > if (sd->current_vmcb != svm->vmcb) { > diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c > index c73375e01ab8..0cb0d26564ca 100644 > --- a/arch/x86/kvm/vmx/vmx.c > +++ b/arch/x86/kvm/vmx/vmx.c > @@ -6423,7 +6423,7 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) > if (vcpu->guest_debug & KVM_GUESTDBG_SINGLESTEP) > vmx_set_interrupt_shadow(vcpu, 0); > > - if (static_cpu_has(X86_FEATURE_PKU) && > + if (boot_cpu_has(X86_FEATURE_PKU) && > kvm_read_cr4_bits(vcpu, X86_CR4_PKE) && > vcpu->arch.pkru != vmx->host_pkru) > __write_pkru(vcpu->arch.pkru); > @@ -6512,7 +6512,7 @@ static void vmx_vcpu_run(struct kvm_vcpu *vcpu) > * back on host, so it is safe to read guest PKRU from current > * XSAVE. > */ > - if (static_cpu_has(X86_FEATURE_PKU) && > + if (boot_cpu_has(X86_FEATURE_PKU) && > kvm_read_cr4_bits(vcpu, X86_CR4_PKE)) { > vcpu->arch.pkru = __read_pkru(); These are not slow path. Paolo