Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1352939 > unrolled thread

[PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX XSAVE features

Started byPaolo Bonzini <pbonzini@redhat.com>
First post2016-03-08 12:50 +0100
Last post2016-03-10 18:40 +0100
Articles 6 — 3 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX XSAVE features Paolo Bonzini <pbonzini@redhat.com> - 2016-03-08 12:50 +0100
    [PATCH 2/2] KVM: x86: remove eager_fpu field of struct kvm_vcpu_arch Paolo Bonzini <pbonzini@redhat.com> - 2016-03-08 12:50 +0100
    Re: [PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX  XSAVE features Xiao Guangrong <guangrong.xiao@linux.intel.com> - 2016-03-10 13:30 +0100
      Re: [PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX  XSAVE features Paolo Bonzini <pbonzini@redhat.com> - 2016-03-10 13:40 +0100
        Re: [PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX  XSAVE features Ingo Molnar <mingo@kernel.org> - 2016-03-10 18:40 +0100
          Re: [PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX  XSAVE features Paolo Bonzini <pbonzini@redhat.com> - 2016-03-10 18:40 +0100

#1352939 — [PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX XSAVE features

FromPaolo Bonzini <pbonzini@redhat.com>
Date2016-03-08 12:50 +0100
Subject[PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX XSAVE features
Message-ID<raojg-hv-9@gated-at.bofh.it>
Patch 1 ensures that all aspects of MPX are disabled when eager FPU
is disabled on the host.  Patch 2 is just a cleanup.

Paolo Bonzini (2):
  KVM: x86: disable MPX if host did not enable MPX XSAVE features
  KVM: x86: remove eager_fpu field of struct kvm_vcpu_arch

 arch/x86/include/asm/kvm_host.h |  1 -
 arch/x86/kvm/cpuid.c            | 14 ++++++++++----
 arch/x86/kvm/cpuid.h            |  9 +--------
 arch/x86/kvm/vmx.c              | 13 ++++++-------
 arch/x86/kvm/x86.c              |  2 +-
 5 files changed, 18 insertions(+), 21 deletions(-)

-- 
1.8.3.1

[toc] | [next] | [standalone]


#1352940 — [PATCH 2/2] KVM: x86: remove eager_fpu field of struct kvm_vcpu_arch

FromPaolo Bonzini <pbonzini@redhat.com>
Date2016-03-08 12:50 +0100
Subject[PATCH 2/2] KVM: x86: remove eager_fpu field of struct kvm_vcpu_arch
Message-ID<raoji-hv-51@gated-at.bofh.it>
In reply to#1352939
It is now equal to use_eager_fpu(), which simply tests a cpufeature bit.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 arch/x86/include/asm/kvm_host.h | 1 -
 arch/x86/kvm/cpuid.c            | 3 +--
 arch/x86/kvm/x86.c              | 2 +-
 3 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h
index d110dc44d6c2..01c8b501cb6d 100644
--- a/arch/x86/include/asm/kvm_host.h
+++ b/arch/x86/include/asm/kvm_host.h
@@ -503,7 +503,6 @@ struct kvm_vcpu_arch {
 	struct kvm_mmu_memory_cache mmu_page_header_cache;
 
 	struct fpu guest_fpu;
-	bool eager_fpu;
 	u64 xcr0;
 	u64 guest_supported_xcr0;
 	u32 guest_xstate_size;
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c
index 00aadec50ba3..0b3ed0b27d64 100644
--- a/arch/x86/kvm/cpuid.c
+++ b/arch/x86/kvm/cpuid.c
@@ -97,8 +97,7 @@ int kvm_update_cpuid(struct kvm_vcpu *vcpu)
 	if (best && (best->eax & (F(XSAVES) | F(XSAVEC))))
 		best->ebx = xstate_required_size(vcpu->arch.xcr0, true);
 
-	vcpu->arch.eager_fpu = use_eager_fpu();
-	if (vcpu->arch.eager_fpu)
+	if (use_eager_fpu())
 		kvm_x86_ops->fpu_activate(vcpu);
 
 	/*
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8daaa0e0830f..08752b8c935c 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -7330,7 +7330,7 @@ void kvm_put_guest_fpu(struct kvm_vcpu *vcpu)
 	 * 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 (!vcpu->arch.eager_fpu) {
+	if (!use_eager_fpu()) {
 		if (++vcpu->fpu_counter < 5)
 			kvm_make_request(KVM_REQ_DEACTIVATE_FPU, vcpu);
 	}
-- 
1.8.3.1

[toc] | [prev] | [next] | [standalone]


#1355083 — Re: [PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX XSAVE features

FromXiao Guangrong <guangrong.xiao@linux.intel.com>
Date2016-03-10 13:30 +0100
SubjectRe: [PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX XSAVE features
Message-ID<rb7T4-6WL-17@gated-at.bofh.it>
In reply to#1352939

On 03/08/2016 07:44 PM, Paolo Bonzini wrote:
> Patch 1 ensures that all aspects of MPX are disabled when eager FPU
> is disabled on the host.  Patch 2 is just a cleanup.

It looks good to me.

Reviewed-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>

Now, more and more features depend on eger xsave, e.g, fpu, mpx and
protection-key, maybe it is the time to rename eager-fpu to eager-xsave?

[toc] | [prev] | [next] | [standalone]


#1355087 — Re: [PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX XSAVE features

FromPaolo Bonzini <pbonzini@redhat.com>
Date2016-03-10 13:40 +0100
SubjectRe: [PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX XSAVE features
Message-ID<rb82J-71L-7@gated-at.bofh.it>
In reply to#1355083

On 10/03/2016 13:28, Xiao Guangrong wrote:
> 
>> Patch 1 ensures that all aspects of MPX are disabled when eager FPU
>> is disabled on the host.  Patch 2 is just a cleanup.
> 
> It looks good to me.
> 
> Reviewed-by: Xiao Guangrong <guangrong.xiao@linux.intel.com>

Thanks very much!

> Now, more and more features depend on eger xsave, e.g, fpu, mpx and
> protection-key, maybe it is the time to rename eager-fpu to eager-xsave?

Yeah, that could be possible.  You can propose it to Ingo Molnar (CCed).
 If you change it in the general purpose kernel code, KVM will of course
follow suit.

Paolo

[toc] | [prev] | [next] | [standalone]


#1355279 — Re: [PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX XSAVE features

FromIngo Molnar <mingo@kernel.org>
Date2016-03-10 18:40 +0100
SubjectRe: [PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX XSAVE features
Message-ID<rbcJ3-1SN-7@gated-at.bofh.it>
In reply to#1355087
* Paolo Bonzini <pbonzini@redhat.com> wrote:

> > Now, more and more features depend on eger xsave, e.g, fpu, mpx and 
> > protection-key, maybe it is the time to rename eager-fpu to eager-xsave?
> 
> Yeah, that could be possible.  You can propose it to Ingo Molnar (CCed).
>  If you change it in the general purpose kernel code, KVM will of course follow 
> suit.

So we have this queued up for v4.6:

  58122bf1d856 x86/fpu: Default eagerfpu=on on all CPUs

and if all goes fine with that then the plan for v4.7 is to remove the lazy FPU 
restore code altogether.

Thanks,

	Ingo

[toc] | [prev] | [next] | [standalone]


#1355284 — Re: [PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX XSAVE features

FromPaolo Bonzini <pbonzini@redhat.com>
Date2016-03-10 18:40 +0100
SubjectRe: [PATCH 0/2] KVM: x86: disable MPX if host did not enable MPX XSAVE features
Message-ID<rbcJ4-1SN-29@gated-at.bofh.it>
In reply to#1355279

On 10/03/2016 18:35, Ingo Molnar wrote:
> So we have this queued up for v4.6:
> 
>   58122bf1d856 x86/fpu: Default eagerfpu=on on all CPUs
> 
> and if all goes fine with that then the plan for v4.7 is to remove the lazy FPU 
> restore code altogether.

Whoa.  Unexpected, but I cannot say I'm not happy. :)

Paolo

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web