Wei Huang
2011-Apr-14 20:38 UTC
[Xen-devel] [PATCH][RFC] FPU LWP 2/5: add mask option to xsave/xrstor
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@amd.com> _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Jan Beulich
2011-Apr-15 09:11 UTC
Re: [Xen-devel] [PATCH][RFC] FPU LWP 2/5: add mask option to xsave/xrstor
>>> On 14.04.11 at 22:38, Wei Huang <wei.huang2@amd.com> 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@amd.com>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@lists.xensource.com http://lists.xensource.com/xen-devel