diff options
author | Suresh Siddha <suresh.b.siddha@intel.com> | 2008-07-29 13:29:20 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-07-30 13:49:24 -0400 |
commit | b359e8a434cc3d09847010fc4aeccf48d69740e4 (patch) | |
tree | 8911c299dc1768c78d5452a1e7e0efd2fc8d5abb /arch | |
parent | dc1e35c6e95e8923cf1d3510438b63c600fee1e2 (diff) |
x86, xsave: context switch support using xsave/xrstor
Uses xsave/xrstor (instead of traditional fxsave/fxrstor) in context switch
when available.
Introduces TS_XSAVE flag, which determine the need to use xsave/xrstor
instructions during context switch instead of the legacy fxsave/fxrstor
instructions. Thread-synchronous status word is already in L1 cache during
this code patch and thus minimizes the performance penality compared to
(cpu_has_xsave) checks.
Signed-off-by: Suresh Siddha <suresh.b.siddha@intel.com>
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/kernel/cpu/common.c | 5 | ||||
-rw-r--r-- | arch/x86/kernel/i387.c | 5 | ||||
-rw-r--r-- | arch/x86/kernel/traps_64.c | 2 |
3 files changed, 9 insertions, 3 deletions
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c index fabbcb7020fb..6c2b9e756db2 100644 --- a/arch/x86/kernel/cpu/common.c +++ b/arch/x86/kernel/cpu/common.c | |||
@@ -709,7 +709,10 @@ void __cpuinit cpu_init(void) | |||
709 | /* | 709 | /* |
710 | * Force FPU initialization: | 710 | * Force FPU initialization: |
711 | */ | 711 | */ |
712 | current_thread_info()->status = 0; | 712 | if (cpu_has_xsave) |
713 | current_thread_info()->status = TS_XSAVE; | ||
714 | else | ||
715 | current_thread_info()->status = 0; | ||
713 | clear_used_math(); | 716 | clear_used_math(); |
714 | mxcsr_feature_mask_init(); | 717 | mxcsr_feature_mask_init(); |
715 | 718 | ||
diff --git a/arch/x86/kernel/i387.c b/arch/x86/kernel/i387.c index e22a9a9dce8a..b778e17e4b01 100644 --- a/arch/x86/kernel/i387.c +++ b/arch/x86/kernel/i387.c | |||
@@ -97,7 +97,10 @@ void __cpuinit fpu_init(void) | |||
97 | 97 | ||
98 | mxcsr_feature_mask_init(); | 98 | mxcsr_feature_mask_init(); |
99 | /* clean state in init */ | 99 | /* clean state in init */ |
100 | current_thread_info()->status = 0; | 100 | if (cpu_has_xsave) |
101 | current_thread_info()->status = TS_XSAVE; | ||
102 | else | ||
103 | current_thread_info()->status = 0; | ||
101 | clear_used_math(); | 104 | clear_used_math(); |
102 | } | 105 | } |
103 | #endif /* CONFIG_X86_64 */ | 106 | #endif /* CONFIG_X86_64 */ |
diff --git a/arch/x86/kernel/traps_64.c b/arch/x86/kernel/traps_64.c index 3580a7938a2e..38eb76156a47 100644 --- a/arch/x86/kernel/traps_64.c +++ b/arch/x86/kernel/traps_64.c | |||
@@ -1134,7 +1134,7 @@ asmlinkage void math_state_restore(void) | |||
1134 | /* | 1134 | /* |
1135 | * Paranoid restore. send a SIGSEGV if we fail to restore the state. | 1135 | * Paranoid restore. send a SIGSEGV if we fail to restore the state. |
1136 | */ | 1136 | */ |
1137 | if (unlikely(restore_fpu_checking(&me->thread.xstate->fxsave))) { | 1137 | if (unlikely(restore_fpu_checking(me))) { |
1138 | stts(); | 1138 | stts(); |
1139 | force_sig(SIGSEGV, me); | 1139 | force_sig(SIGSEGV, me); |
1140 | return; | 1140 | return; |