WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

[Xen-devel] [RFC] xsave/xrstor: changes to the struct vcpu_guest_context

To: Keir Fraser <keir.fraser@xxxxxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxxxx>, Chris Wright <chrisw@xxxxxxxxxx>
Subject: [Xen-devel] [RFC] xsave/xrstor: changes to the struct vcpu_guest_context
From: "Cui, Dexuan" <dexuan.cui@xxxxxxxxx>
Date: Tue, 11 Aug 2009 18:07:22 +0800
Accept-language: zh-CN, en-US
Acceptlanguage: zh-CN, en-US
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>, "Zhai, Edwin" <edwin.zhai@xxxxxxxxx>
Delivery-date: Tue, 11 Aug 2009 03:07:09 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: Acoaa4TYa0uqLDNATfWeKo015oZaaw==
Thread-topic: [RFC] xsave/xrstor: changes to the struct vcpu_guest_context
Hi all,
I'm working to add the xsave/xrstor support for Xen.
The related Intel SDMs are at http://www.intel.com/products/processor/manuals/
And AVX programming reference is at http://software.intel.com/en-us/avx/

After enabling xsave/xrstor in xen, with respect to guest save/restore(S/R) we 
need to save more cpu-related states besides FPU/SSE, e.g., we need to save the 
xsave_bv_header, and a new state like YMM state, and even more new states in 
the future.
To not break guest S/R and keep the compatibility, I think we should make the 
changes to the struct vcpu_guest_context as the attached example patch does:

The changes:
1)  define a new struct vcpu_guest_context_new: its first feild is the legacy 
struct vcpu_guest_context and the other is the new xsave field;
2) add a new flag (a new bit definition) VGCF_xsave_valid to the existing 
'flags' field;

My proposal:
During guest S/R, when we transfer the struct between tools and xen, we *will 
always* use the new expanded struct vcpu_guest_context_new:
        3.1) in tools
                3.1.1) when restore:  first we only read the leading part of 
the struct (namely, the legacy struct vcpu_guest_context); if VGCF_xsave_valid 
is set, we further read the new xsave field;
                3.1.2) when save:  if VGCF_xsave_valid is set, we save the 
whole expanded struct vcpu_guest_context_new; else, we only save the legacy 
part;
        3.2) in xen
                3.2.1) when restore: if VGCF_xsave_valid is set, use the whole 
expaned struct vcpu_guest_context_new; else, only use the legacy part;
                3.2.2) when save: if the host supports xsave and the guest 
enables xsave, xen sets VGCF_xsave_valid and fills the whole expanded struct 
vcpu_guest_context_new;

In this way:
1) guest img saved in old xen, e.g. xen-3.2
        1.1) can be restored in xen-3.2 on xsave-{capable and incapble} host;
        1.2) can be restored in xen-unstable on xsave-{capable and incapble} 
host;

2) guest img saved in xen-unstable
        2.1) if the host doesn't support xsave, the saved img can be restored 
in xen-3.2 or 'older' xen-unstable (namely, before the xsave patches are 
checked in) on xsave-{capable and incapable} hosts;
        2.2) if the host does support xsave
                2.2.1) if guest doesn't use xsave, the saved img can be 
restored in xen-3.2 or older xen-unstable on xsave-{capable and incapable} 
hosts;
                2.2.2) if guest does use xsave, the saved img can NOT be 
restored in xen-3.2 or older xen-unstable, and the saved image can NOT be 
restored in the new xen-unstable (namely, after the xsave patches are checked 
in) on xsave-incapable host.


BTW, for live migration: the rule and handling should be the same.

Could you please comment on this?  Thanks!

-- Dexuan 

Attachment: vcpu_guest_context.patch
Description: vcpu_guest_context.patch

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel
<Prev in Thread] Current Thread [Next in Thread>