x86/xsaves: Save xstate to task's xsave area in __save_fpu during booting time
authorFenghua Yu <fenghua.yu@intel.com>
Thu, 29 May 2014 18:12:41 +0000 (11:12 -0700)
committerH. Peter Anvin <hpa@linux.intel.com>
Thu, 29 May 2014 21:33:04 +0000 (14:33 -0700)
__save_fpu() can be called during early booting time when cpu caps are not
enabled and alternative can not be used yet. Therefore, it calls
xsave_state_booting() during booting time to save xstate to task's xsave area.

Signed-off-by: Fenghua Yu <fenghua.yu@intel.com>
Link: http://lkml.kernel.org/r/1401387164-43416-14-git-send-email-fenghua.yu@intel.com
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
arch/x86/include/asm/fpu-internal.h

index cea1c76d49bf5b04344bb17c353bab35869cf01a..6099c0e5b62e91a71f8ff5334e5f2690c83f59e4 100644 (file)
@@ -508,9 +508,12 @@ static inline void user_fpu_begin(void)
 
 static inline void __save_fpu(struct task_struct *tsk)
 {
-       if (use_xsave())
-               xsave_state(&tsk->thread.fpu.state->xsave, -1);
-       else
+       if (use_xsave()) {
+               if (unlikely(system_state == SYSTEM_BOOTING))
+                       xsave_state_booting(&tsk->thread.fpu.state->xsave, -1);
+               else
+                       xsave_state(&tsk->thread.fpu.state->xsave, -1);
+       } else
                fpu_fxsave(&tsk->thread.fpu);
 }