xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
	Keir Fraser <keir@xen.org>,
	Donald D Dugger <donald.d.dugger@intel.com>,
	Jun Nakajima <jun.nakajima@intel.com>
Subject: Re: XSAVE save/restore shortcomings
Date: Fri, 30 Aug 2013 14:47:27 +0100	[thread overview]
Message-ID: <5220A26F.6000607@citrix.com> (raw)
In-Reply-To: <52208BD602000078000EFACC@nat28.tlf.novell.com>

On 30/08/13 11:11, Jan Beulich wrote:
>>>> On 30.08.13 at 11:55, "Jan Beulich" <JBeulich@suse.com> wrote:
>> Next both HVM and PV save code needed tweaking to not always save the
>> full state supported by the underlying hardware, but just the parts
>> that the guest actually used. Similarly the restore code should bail
>> not just on state being restored that the hardware cannot handle, but
>> also on inconsistent save state (inconsistent XCR0 settings or size of
>> saved state not in line with XCR0).
>>
>> And finally the PV extended context get/set code needs to use slightly
>> different logic than the HVM one, as here we can't just key off of
>> xsave_enabled() (i.e. avoid doing anything if a guest doesn't use
>> xsave) because the tools use this function to determine host
>> capabilities as well as read/write vCPU state. The set operation in
>> particular needs to be capable of cleanly dealing with input that
>> consists of only the xcr0 and xcr0_accum values (if they're both zero
>> then no further data is required).
> I'd like to make clear that the change presented is going to handle
> only the most trivial cases (where any new xsave state addition
> adds to the end of the save area). This is an effect of a more
> fundamental flaw in the original design (which the patch doesn't try
> to revise, as it's not clear to me yet what the best approach here is):
> While the XSAVE hardware specification allows for each piece to be
> individually savable/restorable, both PV and HVM save/restore
> assume a single monolithic blob. Which is already going to be a
> problem: AVX-512 as well as MPX conflict with LWP. And obviously
> it can't be excluded that we'll see CPUs supporting AVX-512 but not
> MPX as well as guests using the former but not the latter, and
> neither can be dealt with under the current design.
>
> I therefore think that we'll need to start over from scratch with
> how save/restore is to be implemented, breaking up the current
> monolithic block into individual pieces. But before working on a
> proposal, I'd first like to hear whether others can see better (and
> namely less intrusive) ways of dealing with the problem.
>
> Jan

Yikes that's a big patch.  I think I need to read it a few more times.

XenServer has xsave disabled by default, not least because support in
Xen was buggy until very recently.  Getting it working is on my todo
list (behind some other integration issues), but I admit I had not
realised that migration was this broken.  I will see about testing the
patch, particularly to do with migrating between one Xen with the fix
and one without, but I cant guarantee to get around to it any time soon.

I think that breaking the save/restore it into pieces is the only
tenable solution going forward.  I cant spot a less intrusive method,
but even if there is, hacking around this broken design now might be the
easy solution but will be more work in the future as new extensions
appear in the future.

~Andrew

  reply	other threads:[~2013-08-30 13:47 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   ` Andrew Cooper [this message]
2013-09-05 10:53   ` XSAVE save/restore shortcomings 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
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=5220A26F.6000607@citrix.com \
    --to=andrew.cooper3@citrix.com \
    --cc=JBeulich@suse.com \
    --cc=donald.d.dugger@intel.com \
    --cc=jun.nakajima@intel.com \
    --cc=keir@xen.org \
    --cc=xen-devel@lists.xenproject.org \
    /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).