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

Re: [Xen-devel] [PATCH][RFC] FPU LWP 2/5: add mask option to xsave/xrsto

To: "Wei Huang" <wei.huang2@xxxxxxx>
Subject: Re: [Xen-devel] [PATCH][RFC] FPU LWP 2/5: add mask option to xsave/xrstor
From: "Jan Beulich" <JBeulich@xxxxxxxxxx>
Date: Fri, 15 Apr 2011 10:11:58 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Fri, 15 Apr 2011 02:11:50 -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
>>> On 14.04.11 at 22:38, Wei Huang <wei.huang2@xxxxxxx> wrote:
> This patch adds a mask option to xsave/xrstor. This mask is used by 
> xsave and xrstor instructions to selectively save/restore memory area.
> 
> Signed-off-by: Wei Huang <wei.huang2@xxxxxxx>

This

>-static void xsave(struct vcpu *v)
>+static void xsave(struct vcpu *v, uint64_t mask)
> {
>     struct xsave_struct *ptr = v->arch.xsave_area;
>+    uint32_t hmask = mask >> 32;
>+    uint32_t lmask = mask;
> 
>     asm volatile (
>         ".byte " REX_PREFIX "0x0f,0xae,0x27"
>         :
>-        : "a" (-1), "d" (-1), "D"(ptr)
>+        : "a" (lmask), "d" (hmask), "D"(ptr)
>         : "memory" );
> }
>... 
>@@ -185,7 +191,7 @@
>      * we set all supported feature mask before doing save/restore.
>      */
>     set_xcr0(v->arch.xcr0_accum);
>-    xrstor(v);
>+    xrstor(v, XCNTXT_MASK);
>     set_xcr0(v->arch.xcr0);
> }
> 

(and similarly in other functions) isn't forward compatible anymore.
The mask had all bits set previously, but now only is

>+#define XCNTXT_MASK         (XSTATE_FP | XSTATE_SSE | XSTATE_YMM | XSTATE_LWP)

My understanding of xsave and its cpuid leaf is that it is meant to be
possible to have new hardware features added without OSes
constantly needing modification to make them available to user
mode software.

LWP not fitting into the lazy restore picture is rather unfortunate
here, and I wonder whether it was a good decision to have its
save/restore done via xsave... Does native Linux already have
LWP support (can't seem to spot it in 3.6.39-rc3)? If so, how is
this being addressed there?

Jan


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>