lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Wed, 25 Mar 2020 12:25:09 +0100
From:   Vitaly Kuznetsov <vkuznets@...hat.com>
To:     Sean Christopherson <sean.j.christopherson@...el.com>,
        Paolo Bonzini <pbonzini@...hat.com>
Cc:     Wanpeng Li <wanpengli@...cent.com>,
        Jim Mattson <jmattson@...gle.com>,
        Joerg Roedel <joro@...tes.org>, kvm@...r.kernel.org,
        linux-kernel@...r.kernel.org, Ben Gardon <bgardon@...gle.com>,
        Junaid Shahid <junaids@...gle.com>,
        Liran Alon <liran.alon@...cle.com>,
        Boris Ostrovsky <boris.ostrovsky@...cle.com>,
        John Haxby <john.haxby@...cle.com>,
        Miaohe Lin <linmiaohe@...wei.com>,
        Tom Lendacky <thomas.lendacky@....com>
Subject: Re: [PATCH v3 18/37] KVM: VMX: Move vmx_flush_tlb() to vmx.c

Sean Christopherson <sean.j.christopherson@...el.com> writes:

> Move vmx_flush_tlb() to vmx.c and make it non-inline static now that all
> its callers live in vmx.c.
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <sean.j.christopherson@...el.com>
> ---
>  arch/x86/kvm/vmx/vmx.c | 25 +++++++++++++++++++++++++
>  arch/x86/kvm/vmx/vmx.h | 25 -------------------------
>  2 files changed, 25 insertions(+), 25 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index 477bdbc52ed0..c6affaaef138 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -2849,6 +2849,31 @@ static void exit_lmode(struct kvm_vcpu *vcpu)
>  
>  #endif
>  
> +static void vmx_flush_tlb(struct kvm_vcpu *vcpu)
> +{
> +	struct vcpu_vmx *vmx = to_vmx(vcpu);
> +
> +	/*
> +	 * Flush all EPTP/VPID contexts, as the TLB flush _may_ have been
> +	 * invoked via kvm_flush_remote_tlbs().  Flushing remote TLBs requires
> +	 * all contexts to be flushed, not just the active context.
> +	 *
> +	 * Note, this also ensures a deferred TLB flush with VPID enabled and
> +	 * EPT disabled invalidates the "correct" VPID, by nuking both L1 and
> +	 * L2's VPIDs.
> +	 */
> +	if (enable_ept) {
> +		ept_sync_global();
> +	} else if (enable_vpid) {
> +		if (cpu_has_vmx_invvpid_global()) {
> +			vpid_sync_vcpu_global();
> +		} else {
> +			vpid_sync_vcpu_single(vmx->vpid);
> +			vpid_sync_vcpu_single(vmx->nested.vpid02);
> +		}
> +	}
> +}
> +
>  static void vmx_flush_tlb_gva(struct kvm_vcpu *vcpu, gva_t addr)
>  {
>  	/*
> diff --git a/arch/x86/kvm/vmx/vmx.h b/arch/x86/kvm/vmx/vmx.h
> index bab5d62ad964..571249e18bb6 100644
> --- a/arch/x86/kvm/vmx/vmx.h
> +++ b/arch/x86/kvm/vmx/vmx.h
> @@ -503,31 +503,6 @@ static inline struct vmcs *alloc_vmcs(bool shadow)
>  
>  u64 construct_eptp(struct kvm_vcpu *vcpu, unsigned long root_hpa);
>  
> -static inline void vmx_flush_tlb(struct kvm_vcpu *vcpu)
> -{
> -	struct vcpu_vmx *vmx = to_vmx(vcpu);
> -
> -	/*
> -	 * Flush all EPTP/VPID contexts, as the TLB flush _may_ have been
> -	 * invoked via kvm_flush_remote_tlbs().  Flushing remote TLBs requires
> -	 * all contexts to be flushed, not just the active context.
> -	 *
> -	 * Note, this also ensures a deferred TLB flush with VPID enabled and
> -	 * EPT disabled invalidates the "correct" VPID, by nuking both L1 and
> -	 * L2's VPIDs.
> -	 */
> -	if (enable_ept) {
> -		ept_sync_global();
> -	} else if (enable_vpid) {
> -		if (cpu_has_vmx_invvpid_global()) {
> -			vpid_sync_vcpu_global();
> -		} else {
> -			vpid_sync_vcpu_single(vmx->vpid);
> -			vpid_sync_vcpu_single(vmx->nested.vpid02);
> -		}
> -	}
> -}
> -
>  static inline void decache_tsc_multiplier(struct vcpu_vmx *vmx)
>  {
>  	vmx->current_tsc_ratio = vmx->vcpu.arch.tsc_scaling_ratio;

Reviewed-by: Vitaly Kuznetsov <vkuznets@...hat.com>

-- 
Vitaly

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ