Commit ff5c16c4 authored by Andi Kleen's avatar Andi Kleen Committed by Chris Wright

[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: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarChris Wright <chrisw@sous-sol.org>
parent 4c52d9e3
......@@ -571,6 +571,9 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
prev->gsindex = gsindex;
}
/* Must be after DS reload */
unlazy_fpu(prev_p);
/*
* Switch the PDA and FPU contexts.
*/
......@@ -578,10 +581,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
write_pda(oldrsp, next->userrsp);
write_pda(pcurrent, next_p);
/* This must be here to ensure both math_state_restore() and
kernel_fpu_begin() work consistently.
And the AMD workaround requires it to be after DS reload. */
unlazy_fpu(prev_p);
write_pda(kernelstack,
task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment