aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/xstate.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@suse.com>2013-07-02 08:41:28 +0200
committerJan Beulich <jbeulich@suse.com>2013-07-02 08:41:28 +0200
commitf9755488bf17c056111d1e442be394cfb63d7788 (patch)
tree224e860b016512cac04f1d67503ad30ea1f391a2 /xen/arch/x86/xstate.c
parent7b62e6bd2fcc862360c741cf64d2cbce7825402b (diff)
downloadxen-f9755488bf17c056111d1e442be394cfb63d7788.tar.gz
xen-f9755488bf17c056111d1e442be394cfb63d7788.tar.bz2
xen-f9755488bf17c056111d1e442be394cfb63d7788.zip
x86/xsave: adjust state management
The initial state for a vCPU is using default values, so there's no need to force the XRSTOR to read the state from memory. This saves a couple of thousand restores from memory just during boot of Linux on my Sandy Bridge system (I didn't try to make further measurements). The above requires that arch_set_info_guest() updates the state flags in the save area when valid floating point state got passed in, but that would really have been needed even before in case XSAVE{,OPT} decided to clear one or both of the FP and SSE bits. Furthermore, hvm_vcpu_reset_state() shouldn't just clear out the FPU/ SSE area, but needs to re-initialized MXCSR and FCW. Signed-off-by: Jan Beulich <jbeulich@suse.com> Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/xstate.c')
-rw-r--r--xen/arch/x86/xstate.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/xen/arch/x86/xstate.c b/xen/arch/x86/xstate.c
index d52dbd715c..608accfe48 100644
--- a/xen/arch/x86/xstate.c
+++ b/xen/arch/x86/xstate.c
@@ -204,9 +204,13 @@ int xstate_alloc_save_area(struct vcpu *v)
if ( save_area == NULL )
return -ENOMEM;
+ /*
+ * Set the memory image to default values, but don't force the context
+ * to be loaded from memory (i.e. keep save_area->xsave_hdr.xstate_bv
+ * clear).
+ */
save_area->fpu_sse.fcw = FCW_DEFAULT;
save_area->fpu_sse.mxcsr = MXCSR_DEFAULT;
- save_area->xsave_hdr.xstate_bv = XSTATE_FP_SSE;
v->arch.xsave_area = save_area;
v->arch.xcr0 = XSTATE_FP_SSE;