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:   Tue, 12 Jun 2018 17:05:37 +0200
From:   Vitaly Kuznetsov <vkuznets@...hat.com>
To:     Tianyu Lan <Tianyu.Lan@...rosoft.com>
Cc:     "pbonzini\@redhat.com" <pbonzini@...hat.com>,
        "rkrcmar\@redhat.com" <rkrcmar@...hat.com>,
        "tglx\@linutronix.de" <tglx@...utronix.de>,
        "mingo\@redhat.com" <mingo@...hat.com>,
        "hpa\@zytor.com" <hpa@...or.com>,
        "x86\@kernel.org" <x86@...nel.org>,
        "kvm\@vger.kernel.org" <kvm@...r.kernel.org>,
        "linux-kernel\@vger.kernel.org" <linux-kernel@...r.kernel.org>,
        KY Srinivasan <kys@...rosoft.com>
Subject: Re: [RFC Patch 3/3] KVM/x86: Add tlb_remote_flush callback support for vmcs

Tianyu Lan <Tianyu.Lan@...rosoft.com> writes:

> Register tlb_remote_flush callback for vmcs when hyperv capability of
> nested guest mapping flush is detected. The interface can help to reduce
> overhead when flush ept table among vcpus for nested VM. The tradition way
> is to send IPIs to all affected vcpus and executes INVEPT on each vcpus.
> It will trigger several vmexits for IPI and INVEPT emulation. Hyperv provides
> such hypercall to do flush for all vcpus.
>
> Signed-off-by: Lan Tianyu <Tianyu.Lan@...rosoft.com>
> ---
>  arch/x86/kvm/vmx.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)
>
> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> index e50beb76d846..6cb241c05690 100644
> --- a/arch/x86/kvm/vmx.c
> +++ b/arch/x86/kvm/vmx.c
> @@ -4737,6 +4737,17 @@ static inline void __vmx_flush_tlb(struct kvm_vcpu *vcpu, int vpid,
>  	}
>  }
>
> +static int vmx_remote_flush_tlb(struct kvm *kvm)
> +{
> +	struct kvm_vcpu *vcpu = kvm_get_vcpu(kvm, 0);
> +
> +	if (!VALID_PAGE(vcpu->arch.mmu.root_hpa))
> +		return -1;
> +
> +	return hyperv_flush_guest_mapping(construct_eptp(vcpu,
> +		vcpu->arch.mmu.root_hpa));
> +}
> +
>  static void vmx_flush_tlb(struct kvm_vcpu *vcpu, bool invalidate_gpa)
>  {
>  	__vmx_flush_tlb(vcpu, to_vmx(vcpu)->vpid, invalidate_gpa);
> @@ -7495,6 +7506,10 @@ static __init int hardware_setup(void)
>  	if (enable_ept && !cpu_has_vmx_ept_2m_page())
>  		kvm_disable_largepages();
>
> +	if (ms_hyperv.nested_features & HV_X64_NESTED_GUSET_MAPPING_FLUSH
> +	    && enable_ept)
> +		kvm_x86_ops->tlb_remote_flush = vmx_remote_flush_tlb;
> +

You'll need to surround the above with #if IS_ENABLED(CONFIG_HYPERV) as
ms_hyperv is otherwise unavailable.

>  	if (!cpu_has_vmx_ple()) {
>  		ple_gap = 0;
>  		ple_window = 0;

-- 
  Vitaly

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ