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, 23 Jul 2019 14:28:18 -0700
From:   Krish Sadhukhan <krish.sadhukhan@...cle.com>
To:     luferry@....com, Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>
Cc:     "H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
        kvm@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] KVM: x86: init x2apic_enabled() once



On 07/23/2019 06:06 AM, luferry@....com wrote:
> From: luferry <luferry@....com>
>
> x2apic_eanbled() costs about 200 cycles
> when guest trigger halt pretty high, pi ops in hotpath
>
> Signed-off-by: luferry <luferry@....com>
> ---
>   arch/x86/kvm/vmx/vmx.c | 10 +++++++---
>   1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/arch/x86/kvm/vmx/vmx.c b/arch/x86/kvm/vmx/vmx.c
> index d98eac371c0a..e17dbf011e47 100644
> --- a/arch/x86/kvm/vmx/vmx.c
> +++ b/arch/x86/kvm/vmx/vmx.c
> @@ -186,6 +186,8 @@ static DEFINE_STATIC_KEY_FALSE(vmx_l1d_should_flush);
>   static DEFINE_STATIC_KEY_FALSE(vmx_l1d_flush_cond);
>   static DEFINE_MUTEX(vmx_l1d_flush_mutex);
>   
> +static int __read_mostly host_x2apic_enabled;
> +
>   /* Storage for pre module init parameter parsing */
>   static enum vmx_l1d_flush_state __read_mostly vmentry_l1d_flush_param = VMENTER_L1D_FLUSH_AUTO;
>   
> @@ -1204,7 +1206,7 @@ static void vmx_vcpu_pi_load(struct kvm_vcpu *vcpu, int cpu)
>   
>   		dest = cpu_physical_id(cpu);
>   
> -		if (x2apic_enabled())
> +		if (host_x2apic_enabled)
>   			new.ndst = dest;
>   		else
>   			new.ndst = (dest << 8) & 0xFF00;
> @@ -7151,7 +7153,7 @@ static void __pi_post_block(struct kvm_vcpu *vcpu)
>   
>   		dest = cpu_physical_id(vcpu->cpu);
>   
> -		if (x2apic_enabled())
> +		if (host_x2apic_enabled)
>   			new.ndst = dest;
>   		else
>   			new.ndst = (dest << 8) & 0xFF00;
> @@ -7221,7 +7223,7 @@ static int pi_pre_block(struct kvm_vcpu *vcpu)
>   		 */
>   		dest = cpu_physical_id(vcpu->pre_pcpu);
>   
> -		if (x2apic_enabled())
> +		if (host_x2apic_enabled)
>   			new.ndst = dest;
>   		else
>   			new.ndst = (dest << 8) & 0xFF00;
> @@ -7804,6 +7806,8 @@ static int __init vmx_init(void)
>   	}
>   #endif
>   
> +	host_x2apic_enabled = x2apic_enabled();
> +
>   	r = kvm_init(&vmx_x86_ops, sizeof(struct vcpu_vmx),
>   		     __alignof__(struct vcpu_vmx), THIS_MODULE);
>   	if (r)

Reviewed-by: Krish Sadhukhan <krish.sadhukhan@...cle.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ