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:   Thu, 14 Dec 2017 09:05:33 +0800
From:   Wanpeng Li <kernellwp@...il.com>
To:     Paolo Bonzini <pbonzini@...hat.com>
Cc:     "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        kvm <kvm@...r.kernel.org>, Wanpeng Li <wanpeng.li@...mail.com>
Subject: Re: [PATCH] KVM: x86: avoid unnecessary XSETBV on guest entry

2017-12-13 20:51 GMT+08:00 Paolo Bonzini <pbonzini@...hat.com>:
> xsetbv can be expensive when running on nested virtualization, try to
> avoid it.
>
> Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>

Reviewed-by: Wanpeng Li <wanpeng.li@...mail.com>

> ---
>  arch/x86/kvm/x86.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 0f82e2cbf64c..daa1918031df 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -702,7 +702,8 @@ static void kvm_load_guest_xcr0(struct kvm_vcpu *vcpu)
>         if (kvm_read_cr4_bits(vcpu, X86_CR4_OSXSAVE) &&
>                         !vcpu->guest_xcr0_loaded) {
>                 /* kvm_set_xcr() also depends on this */
> -               xsetbv(XCR_XFEATURE_ENABLED_MASK, vcpu->arch.xcr0);
> +               if (vcpu->arch.xcr0 != host_xcr0)
> +                       xsetbv(XCR_XFEATURE_ENABLED_MASK, vcpu->arch.xcr0);
>                 vcpu->guest_xcr0_loaded = 1;
>         }
>  }
> --
> 1.8.3.1
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ