From: Paolo Bonzini Date: Wed, 20 May 2015 09:46:12 +0000 (+0200) Subject: Merge branch 'kvm-master' into kvm-next X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=a9b4fb7e79e7624c97c55e9c7562e3fe866ce70f;p=linux-beck.git Merge branch 'kvm-master' into kvm-next Grab MPX bugfix, and fix conflicts against Rik's adaptive FPU deactivation patch. Signed-off-by: Paolo Bonzini --- a9b4fb7e79e7624c97c55e9c7562e3fe866ce70f diff --cc arch/x86/kvm/cpuid.c index 59b69f6a2844,1d08ad3582d0..92a74a0428aa --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@@ -95,6 -97,8 +97,8 @@@ int kvm_update_cpuid(struct kvm_vcpu *v if (best && (best->eax & (F(XSAVES) | F(XSAVEC)))) best->ebx = xstate_required_size(vcpu->arch.xcr0, true); - vcpu->arch.eager_fpu = guest_cpuid_has_mpx(vcpu); ++ vcpu->arch.eager_fpu = use_eager_fpu() || guest_cpuid_has_mpx(vcpu); + /* * The existing code assumes virtual address is 48-bit in the canonical * address checks; exit if it is ever changed. diff --cc arch/x86/kvm/x86.c index 457b908244f2,ea306adbbc13..d42d8ace90f1 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@@ -7149,16 -7060,9 +7151,16 @@@ void kvm_put_guest_fpu(struct kvm_vcpu fpu_save_init(&vcpu->arch.guest_fpu); __kernel_fpu_end(); ++vcpu->stat.fpu_reload; - if (!vcpu->arch.eager_fpu) - kvm_make_request(KVM_REQ_DEACTIVATE_FPU, vcpu); - + /* + * If using eager FPU mode, or if the guest is a frequent user + * of the FPU, just leave the FPU active for next time. + * Every 255 times fpu_counter rolls over to 0; a guest that uses + * the FPU in bursts will revert to loading it on demand. + */ - if (!use_eager_fpu()) { ++ if (!vcpu->arch.eager_fpu) { + if (++vcpu->fpu_counter < 5) + kvm_make_request(KVM_REQ_DEACTIVATE_FPU, vcpu); + } trace_kvm_fpu(0); }