Message ID | 570E15B9.5070205@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
On 13/04/2016 11:47, Yang Zhang wrote: > On 2016/3/24 21:07, Paolo Bonzini wrote: >> >> >> On 24/03/2016 14:06, Yang Zhang wrote: >>> >>> I mean why not keep the old way that only activate the eager_fpu while >>> guest sees the MPX bit in CPUID, like: >>> >>> vcpu->arch.eager_fpu = use_eager_fpu() && guest_cpuid_has_mpx(vcpu); >> >> If the host uses eager FPU you can assume that it's faster than lazy FPU. >> >> Paolo >> >>> Besides, vmx_fpu_activate is called when do vcpu_reset. So it seems no >>> need to call fpu_activate() here again. > > Hi Paolo > > The check in kvm_update_cpuid of fpu is strange since nothing relies on > cpuid now. How about the following change? Ok, please post it generated by git-format-patch and with a commit message. Thanks, Paolo > diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c > index bbbaa80..da4e6ad 100644 > --- a/arch/x86/kvm/cpuid.c > +++ b/arch/x86/kvm/cpuid.c > @@ -114,9 +114,6 @@ 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); > > - if (use_eager_fpu()) > - kvm_x86_ops->fpu_activate(vcpu); > - > /* > * The existing code assumes virtual address is 48-bit in the > canonical > * address checks; exit if it is ever changed. > diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c > index 9b7798c..8f57335 100644 > --- a/arch/x86/kvm/x86.c > +++ b/arch/x86/kvm/x86.c > @@ -7453,6 +7453,9 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool > init_event) > vcpu->arch.regs_avail = ~0; > vcpu->arch.regs_dirty = ~0; > > + if (use_eager_fpu()) > + kvm_x86_ops->fpu_activate(vcpu); > + > kvm_x86_ops->vcpu_reset(vcpu, init_event); > } > > -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
diff --git a/arch/x86/kvm/cpuid.c b/arch/x86/kvm/cpuid.c index bbbaa80..da4e6ad 100644 --- a/arch/x86/kvm/cpuid.c +++ b/arch/x86/kvm/cpuid.c @@ -114,9 +114,6 @@ 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); - if (use_eager_fpu()) - kvm_x86_ops->fpu_activate(vcpu); - /* * The existing code assumes virtual address is 48-bit in the canonical * address checks; exit if it is ever changed. diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c index 9b7798c..8f57335 100644 --- a/arch/x86/kvm/x86.c +++ b/arch/x86/kvm/x86.c @@ -7453,6 +7453,9 @@ void kvm_vcpu_reset(struct kvm_vcpu *vcpu, bool init_event) vcpu->arch.regs_avail = ~0; vcpu->arch.regs_dirty = ~0; + if (use_eager_fpu()) + kvm_x86_ops->fpu_activate(vcpu); + kvm_x86_ops->vcpu_reset(vcpu, init_event); }