xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
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: Thu, 05 May 2011 08:13:42 +0100	[thread overview]
Message-ID: <4DC26A46020000780003FC3E@vpn.id2.novell.com> (raw)
In-Reply-To: <4DC17FF3.5080706@amd.com>

>>> On 04.05.11 at 18:33, Wei Huang <wei.huang2@amd.com> wrote:
> Checking whether there is a non-lazy state to save is architectural 
> specific and very messy. For instance, we need to read LWP_CBADDR to 
> confirm LWP's dirty state. This MSR is AMD specific and we don't want to 
> add it here. Plus reading data from LWP_CBADDR MSR might be as expensive 
> as clts/stts.
> 
> My previous email showed that the overhead with LWP is around 1%-2% of 
> __context_switch(). For non lwp-capable CPU, this overhead should be 
> much smaller (only clts and stts) because xfeature_mask[LWP] is 0.

I wasn't talking about determining whether LWP state is dirty, but
much rather about LWP not being in use at all.

> Yes, clts() and stts() don't have to called every time. How about this one?
> 
> /* Restore FPU state whenever VCPU is schduled in. */
> void vcpu_restore_fpu_eager(struct vcpu *v)
> {
>      ASSERT(!is_idle_vcpu(v));
> 
> 
>      /* save the nonlazy extended state which is not tracked by CR0.TS bit */
>      if ( xsave_enabled(v) )
>      {
>          /* Avoid recursion */
>          clts();
>          fpu_xrstor(v, XSTATE_NONLAZY);
>          stts();
>      }

That's certainly better, but I'd still like to see the xsave_enabled()
check to be replaced by some form of lwp_enabled() or
lazy_xsave_needed() or some such (which will at once exclude all
pv guests until you care to add support for them).

Jan

  reply	other threads:[~2011-05-05  7:13 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
2011-05-04 16:33   ` Wei Huang
2011-05-05  7:13     ` Jan Beulich [this message]
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=4DC26A46020000780003FC3E@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).