From: "Jan Beulich" <JBeulich@novell.com>
To: Wei Huang <wei.huang2@amd.com>
Cc: "xen-devel@lists.xensource.com" <xen-devel@lists.xensource.com>,
KeirFraser <keir@xen.org>
Subject: Re: [PATCH] FPU LWP 6/8: create lazy and non-lazy FPU restore functions
Date: Wed, 04 May 2011 08:09:42 +0100 [thread overview]
Message-ID: <4DC117D6020000780003F9CB@vpn.id2.novell.com> (raw)
In-Reply-To: <4DC062ED.3070802@amd.com>
>>> On 03.05.11 at 22:17, Wei Huang <wei.huang2@amd.com> wrote:
Again as pointed out earlier, ...
>--- a/xen/arch/x86/domain.c Tue May 03 13:49:27 2011 -0500
>+++ b/xen/arch/x86/domain.c Tue May 03 13:59:37 2011 -0500
>@@ -1578,6 +1578,7 @@
> memcpy(stack_regs, &n->arch.user_regs, CTXT_SWITCH_STACK_BYTES);
> if ( xsave_enabled(n) && n->arch.xcr0 != get_xcr0() )
> set_xcr0(n->arch.xcr0);
>+ vcpu_restore_fpu_eager(n);
... this call is unconditional, ...
> n->arch.ctxt_switch_to(n);
> }
>
>--- a/xen/arch/x86/i387.c Tue May 03 13:49:27 2011 -0500
>+++ b/xen/arch/x86/i387.c Tue May 03 13:59:37 2011 -0500
>@@ -160,10 +160,25 @@
> /*******************************/
> /* VCPU FPU Functions */
> /*******************************/
>+/* Restore FPU state whenever VCPU is schduled in. */
>+void vcpu_restore_fpu_eager(struct vcpu *v)
>+{
>+ ASSERT(!is_idle_vcpu(v));
>+
>+ /* Avoid recursion */
>+ clts();
>+
>+ /* save the nonlazy extended state which is not tracked by CR0.TS bit */
>+ if ( xsave_enabled(v) )
>+ fpu_xrstor(v, XSTATE_NONLAZY);
>+
>+ stts();
... while here you do an unconditional clts followed by an xrstor only
checking whether xsave is enabled (but not checking whether there's
any non-lazy state to be restored) and, possibly the most expensive
of all, an unconditional write of CR0.
Jan
>+}
>+
> /*
> * Restore FPU state when #NM is triggered.
> */
>-void vcpu_restore_fpu(struct vcpu *v)
>+void vcpu_restore_fpu_lazy(struct vcpu *v)
> {
> ASSERT(!is_idle_vcpu(v));
>
next prev parent reply other threads:[~2011-05-04 7:09 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-05-03 20:17 [PATCH] FPU LWP 6/8: create lazy and non-lazy FPU restore functions Wei Huang
2011-05-04 7:09 ` Jan Beulich [this message]
2011-05-04 16:33 ` Wei Huang
2011-05-05 7:13 ` Jan Beulich
2011-05-05 21:41 ` Wei Huang
2011-05-06 7:49 ` Jan Beulich
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=4DC117D6020000780003F9CB@vpn.id2.novell.com \
--to=jbeulich@novell.com \
--cc=keir@xen.org \
--cc=wei.huang2@amd.com \
--cc=xen-devel@lists.xensource.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).