aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86_64/kernel/process.c
diff options
context:
space:
mode:
authorAndi Kleen <ak@suse.de>2006-10-05 12:47:22 -0400
committerAndi Kleen <andi@basil.nowhere.org>2006-10-05 12:47:22 -0400
commit0a5ace2ab08d45cd78d7ef0067cdcd5c812ac54f (patch)
treea4da5e79010de2391ee92d6a71b2a7217ed68d61 /arch/x86_64/kernel/process.c
parent51ec28e1b2cb267a09a0b8eac1ccf8d61b7268bf (diff)
[PATCH] x86-64: Fix FPU corruption
This reverts an earlier patch that was found to cause FPU state corruption. I think the corruption happens because unlazy_fpu() can cause FPU exceptions and when it happens after the current switch some processing would affect the state in the wrong process. Thanks to Douglas Crosher and Tom Hughes for testing. Cc: jbeulich@novell.com Signed-off-by: Andi Kleen <ak@suse.de>
Diffstat (limited to 'arch/x86_64/kernel/process.c')
-rw-r--r--arch/x86_64/kernel/process.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/x86_64/kernel/process.c b/arch/x86_64/kernel/process.c
index de10cb8a2c97..5e95b257ee26 100644
--- a/arch/x86_64/kernel/process.c
+++ b/arch/x86_64/kernel/process.c
@@ -615,6 +615,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
615 prev->gsindex = gsindex; 615 prev->gsindex = gsindex;
616 } 616 }
617 617
618 /* Must be after DS reload */
619 unlazy_fpu(prev_p);
620
618 /* 621 /*
619 * Switch the PDA and FPU contexts. 622 * Switch the PDA and FPU contexts.
620 */ 623 */
@@ -622,10 +625,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
622 write_pda(oldrsp, next->userrsp); 625 write_pda(oldrsp, next->userrsp);
623 write_pda(pcurrent, next_p); 626 write_pda(pcurrent, next_p);
624 627
625 /* This must be here to ensure both math_state_restore() and
626 kernel_fpu_begin() work consistently.
627 And the AMD workaround requires it to be after DS reload. */
628 unlazy_fpu(prev_p);
629 write_pda(kernelstack, 628 write_pda(kernelstack,
630 (unsigned long)task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET); 629 (unsigned long)task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET);
631#ifdef CONFIG_CC_STACKPROTECTOR 630#ifdef CONFIG_CC_STACKPROTECTOR