On 09/21/2012 11:47 AM, Hao, Xudong wrote: > > -----Original Message----- > > From: Avi Kivity [mailto:avi@xxxxxxxxxx] > > Sent: Thursday, September 20, 2012 5:20 PM > > To: Hao, Xudong > > Cc: Marcelo Tosatti; kvm@xxxxxxxxxxxxxxx; Zhang, Xiantao > > Subject: Re: [PATCH v3] kvm/fpu: Enable fully eager restore kvm FPU > > >> >> On guest entry: > > >> >> if (!lazy_fpu_allowed(vcpu)) > > >> >> kvm_x86_ops->fpu_activate(vcpu); > > >> > > > >> > > >> But we already have that: > > >> > > >> if (vcpu->fpu_active) > > >> kvm_load_guest_fpu(vcpu); > > >> > > >> so why not manage fpu_active to be always set when needed? I don't > > want > > >> more checks in the entry path. > > >> > > > I means add fpu_active() in kvm_set_xcr(), not in guest entry. Then the > > fpu_active will be set always when guest initialize xstate. > > > > > > @@ -574,6 +574,9 @@ int kvm_set_xcr(struct kvm_vcpu *vcpu, u32 index, > > u64 xcr) > > > kvm_inject_gp(vcpu, 0); > > > return 1; > > > } > > > + if (!lazy_fpu_allowed(vcpu)) > > > + kvm_x86_ops->fpu_activate(vcpu); > > > return 0; > > > > > > > And of course on cr4 update. So a function update_lazy_fpu() to be > > called from both places is needed. > > > > Complete consideration, thanks. > > So I will define a function update_lazy_fpu(), insert it into kvm_set_xcr() and handle_cr(). Comments? Sounds good. -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain. -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html