From: Avi Kivity <avi@redhat.com>
To: "Hao, Xudong" <xudong.hao@intel.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"Zhang, Xiantao" <xiantao.zhang@intel.com>
Subject: Re: [PATCH v3] kvm/fpu: Enable fully eager restore kvm FPU
Date: Thu, 20 Sep 2012 12:19:56 +0300 [thread overview]
Message-ID: <505ADFBC.3080109@redhat.com> (raw)
In-Reply-To: <403610A45A2B5242BD291EDAE8B37D300FEC46D8@SHSMSX102.ccr.corp.intel.com>
On 09/20/2012 04:43 AM, Hao, Xudong wrote:
>> -----Original Message-----
>> From: Avi Kivity [mailto:avi@redhat.com]
>> Sent: Wednesday, September 19, 2012 6:24 PM
>> To: Hao, Xudong
>> Cc: Marcelo Tosatti; kvm@vger.kernel.org; Zhang, Xiantao
>> Subject: Re: [PATCH v3] kvm/fpu: Enable fully eager restore kvm FPU
>> > That may be:
>> >
>> > static bool lazy_fpu_allowed()
>> > {
>> > return !(vcpu->arch.xcr0 & ~((u64)KVM_XSTATE_LAZY));
>> > }
>>
>> Shouldn't it depend on cr4.osxsave as well?
>>
>
> It do need to check cr4.osxsave due to a separate function.
>
> static bool lazy_fpu_allowed(struct kvm_vcpu *vcpu)
> {
> return !kvm_read_cr4_bits(vcpu, X86_CR4_OSXSAVE) ||
> !(vcpu->arch.xcr0 & ~((u64)KVM_XSTATE_LAZY));
> }
Yes.
>
>> >
>> >> 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.
--
error compiling committee.c: too many arguments to function
next prev parent reply other threads:[~2012-09-20 9:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-12 8:10 [PATCH v3] kvm/fpu: Enable fully eager restore kvm FPU Xudong Hao
2012-09-13 16:26 ` Marcelo Tosatti
2012-09-13 16:29 ` Marcelo Tosatti
2012-09-13 16:40 ` Avi Kivity
2012-09-17 2:07 ` Hao, Xudong
2012-09-17 13:30 ` Marcelo Tosatti
2012-09-18 1:08 ` Hao, Xudong
2012-09-19 10:23 ` Avi Kivity
2012-09-20 1:43 ` Hao, Xudong
2012-09-20 9:19 ` Avi Kivity [this message]
2012-09-21 8:47 ` Hao, Xudong
2012-09-23 9:03 ` Avi Kivity
2012-09-14 8:54 ` Hao, Xudong
2012-09-14 9:35 ` Marcelo Tosatti
2012-09-13 16:38 ` Avi Kivity
2012-09-14 8:52 ` Hao, Xudong
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=505ADFBC.3080109@redhat.com \
--to=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mtosatti@redhat.com \
--cc=xiantao.zhang@intel.com \
--cc=xudong.hao@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.