All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Fitzhardinge <jeremy@goop.org>
To: Haitao Shan <maillists.shan@gmail.com>
Cc: xen-devel@lists.xensource.com,
	Ian Jackson <Ian.Jackson@eu.citrix.com>,
	Keir Fraser <keir.fraser@eu.citrix.com>
Subject: Re: [Patch] Allowing PV-OPS kernel to detect whether XSAVE is supported
Date: Tue, 09 Nov 2010 16:41:50 -0800	[thread overview]
Message-ID: <4CD9EA4E.2040805@goop.org> (raw)
In-Reply-To: <AANLkTimeXpoC08=RLGxsQZSrf4EjR2vvCFHtuhjr+eNb@mail.gmail.com>

On 11/09/2010 04:15 PM, Haitao Shan wrote:
>
> I think that is not possible. If usermode does not use native CPUID
> instruction, or CPUID can be virtualized any way, this won't happen.
> Otherwise, usermode will either see both are set or unset. Since on a
> NON-XSAVE processor, you can not set CR4.OSXSAVE and won't be
> reflected to CPUID.

I see.

> If user mode sees both are set, they can use it actually. So we
> initially set FP and SSE in XCR0 for guest. If user mode wants to use
> it, guest kernel still can manage the state using traditional FPU
> save/restore mechanism. If user mode wants to access more extended
> states, it has to acquire kernel's support for turning on related bit
> in XCR0, which is finally controlled by Xen now.

Are you saying that usermode can use XSAVE, AVX and other instruction
set extensions successfully if Xen supports them, even if the guest OS
doesn't?  That sounds unlikely - what happens when, for example, an old
Linux wants to context switch from one Linux task to another on a VCPU? 
How will the task's context get saved/reloaded properly?

Your kernel changes seem fine, and should allow a modern kernel to
support XSAVE and all the CPU features that go along with it.  But I'm
really concerned that your Xen changes will cause previously working
usermode programs to start erroneously using XSAVE when the guest kernel
cannot support it.

> I have a few AVX test programs running both inside PV guest and HVM.
> However, I have to admit that my aim is to test Xen's fpu context
> switching using Xsave and guest save/restore.
>

Could you make them available for testing?

IanJ: It looks like it would be useful to add some tests to the suite to
make sure all this extended context is save/restored properly...

Thanks,
    J

  parent reply	other threads:[~2010-11-10  0:41 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-09  6:22 [Patch] Allowing PV-OPS kernel to detect whether XSAVE is supported Haitao Shan
2010-11-09 10:43 ` Ian Campbell
2010-11-09 10:51   ` Jan Beulich
2010-11-09 10:54     ` Ian Campbell
2010-11-09 11:26       ` Jan Beulich
2010-11-09 15:12       ` Haitao Shan
2010-11-09 19:55 ` Jeremy Fitzhardinge
2010-11-10  0:15   ` Haitao Shan
2010-11-10  0:18     ` Haitao Shan
2010-11-10  0:41     ` Jeremy Fitzhardinge [this message]
2010-11-10  1:45       ` Haitao Shan
2010-11-10  2:15         ` Jeremy Fitzhardinge
2010-11-19 18:17           ` Ian Jackson

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=4CD9EA4E.2040805@goop.org \
    --to=jeremy@goop.org \
    --cc=Ian.Jackson@eu.citrix.com \
    --cc=keir.fraser@eu.citrix.com \
    --cc=maillists.shan@gmail.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 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.