All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: "Zhang, Yang Z" <yang.z.zhang@intel.com>
Cc: KeirFraser <keir@xen.org>, Jan Beulich <JBeulich@suse.com>,
	"Dugger, Donald D" <donald.d.dugger@intel.com>,
	"Nakajima, Jun" <jun.nakajima@intel.com>,
	xen-devel <xen-devel@lists.xenproject.org>,
	"H. Peter Anvin" <hpa@linux.intel.com>
Subject: Re: XSAVE save/restore shortcomings
Date: Fri, 06 Sep 2013 13:57:26 +0200	[thread overview]
Message-ID: <5229C326.8050009@redhat.com> (raw)
In-Reply-To: <A9667DDFB95DB7438FA9D7D576C3D87E0A8F8BE3@SHSMSX104.ccr.corp.intel.com>

[adding H. Peter Anvin... the context is whether the layout of the
XSAVE/XRSTOR area is fixed, including the offset of each separate
Ext_SAVE_Area].

Il 06/09/2013 09:45, Zhang, Yang Z ha scritto:
>>>> >>> So here we are: Paolo quotes the doc stating that the layout is
>>>> >>> fixed
>>> >> Layout is not equal to the offset.
>> > 
>> > Sorry, I don't follow. What does "The layout of the XSAVE/XRSTOR save
>> > area is fixed" mean to you then?
> My understanding is that "fixed" means "the first area always is
> FPU/SSE(offset 0, size 512), the second area always is header(offset
> 512, size64) and for other areas, you must check the CPUID to know the
> details". Not the offset of each feature is fixed.

The sentence is "The XSAVE/XRSTOR save area is not compacted if some
features are not saved or are not supported by the processor and/or by
system software".  This means four things:

- the XSAVE/XRSTOR save area is not compacted if some features are not
saved by the processor (my guess: this is for XSAVEOPT)

- the XSAVE/XRSTOR save area is not compacted if some features are not
saved by system software (my guess: bits are not set in EDX:EAX)

- the the XSAVE/XRSTOR save area is not compacted if some features are
not supported by system software (my guess: bits are not set in XCR0)

- the the XSAVE/XRSTOR save area is not compacted if some features are
not supported by the processor (???)

I cannot give any sensible interpretation to the last case except "the
offsets are fixed".  In theory the lengths may vary, I suppose, though
that would not make much sense.

BTW, in my copy of the manual (325383-045US, January 2013) the
Ext_SaveAreas are in consecutive order in "Figure 13-2. Future Layout of
XSAVE/XRSTOR Area and XSTATE_BV with Five Sets of Processor State
Extensions".

And in the AVX-512/MPX manual, the vector states in Ext_SAVE_Area_2 to 7
have documented (thus fixed) offsets, while the MPX states in
Ext_SAVE_Area_3 and 4 do not have documented offsets.  And MPX is
exactly where documented offsets would be most handy, since BNDCFGU and
BNDSTATUS are only accessible via XSAVE/XRSTOR.

Linux publishes the XSAVE blob to userspace as an NT_X86_XSTATE note in
core dumps, but does not include CPUID data.  If offsets change, it will
not be possible to examine a core dump without knowing the processor on
which it was produced.

For our beloved hypervisors, if offsets can change it will be
_impossible_ to migrate from a machine to another if they have different
offsets.  It will be impossible (lest you disable XSAVE and thus all
processor features starting with AVX) to have clusters of heterogeneous
virtualization hosts.  This is because (a) the guest might have stored
XSAVE areas at arbitrary places in the source, and the destination will
not be able to restore them; (b) there are no vmexits for
XSAVE/XSAVEOPT/XRSTOR, and anyway they would be too slow.

So please Intel, pretty please do not modify the XSAVE offsets, and
clarify this as soon as possible.

Paolo


> See the Table 4-20 in Intel SDM volume 2, it even puts the area3 behind area4.
> 

  reply	other threads:[~2013-09-06 11:57 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-30  9:55 [PATCH] x86/xsave: fix migration from xsave-capable to xsave-incapable host Jan Beulich
2013-08-30 10:11 ` XSAVE save/restore shortcomings (was: [PATCH] x86/xsave: fix migration from xsave-capable to xsave-incapable host) Jan Beulich
2013-08-30 13:47   ` XSAVE save/restore shortcomings Andrew Cooper
2013-09-05 10:53   ` Paolo Bonzini
2013-09-05 12:01     ` Jan Beulich
2013-09-05 13:58       ` Paolo Bonzini
2013-09-05 14:34         ` Jan Beulich
2013-09-06  3:03           ` Zhang, Yang Z
2013-09-06  6:59             ` Jan Beulich
2013-09-06  7:20               ` Zhang, Yang Z
2013-09-06  7:31                 ` Jan Beulich
2013-09-06  7:45                   ` Zhang, Yang Z
2013-09-06 11:57                     ` Paolo Bonzini [this message]
2013-09-06 12:35                       ` Jan Beulich
2013-09-06 12:38                         ` Paolo Bonzini
2013-09-06 12:39                         ` Andrew Cooper
2013-09-06 14:44                       ` H. Peter Anvin
2013-09-06 15:03                         ` Paolo Bonzini
2013-09-06 15:04                           ` H. Peter Anvin
2013-09-03  5:47 ` [PATCH] x86/xsave: fix migration from xsave-capable to xsave-incapable host Zhang, Yang Z
2013-09-09 11:16 ` Keir Fraser

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=5229C326.8050009@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=JBeulich@suse.com \
    --cc=donald.d.dugger@intel.com \
    --cc=hpa@linux.intel.com \
    --cc=jun.nakajima@intel.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    --cc=yang.z.zhang@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.