diff options
author | Bobby Powers <bobbypowers@gmail.com> | 2015-04-27 11:10:41 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@kernel.org> | 2015-05-06 05:22:03 -0400 |
commit | c88d47480d300eaad80c213d50c9bf6077fc49bc (patch) | |
tree | 51a9a595a1fb7ab9eb665945536a46efb2f00666 /arch/x86/kernel/process.c | |
parent | c102cb097d9371c2c60049d041ab1f8bdca5ccc2 (diff) |
x86/fpu: Always restore_xinit_state() when use_eager_cpu()
The following commit:
f893959b0898 ("x86/fpu: Don't abuse drop_init_fpu() in flush_thread()")
removed drop_init_fpu() usage from flush_thread(). This seems to break
things for me - the Go 1.4 test suite fails all over the place with
floating point comparision errors (offending commit found through
bisection).
The functional change was that flush_thread() after this commit
only calls restore_init_xstate() when both use_eager_fpu() and
!used_math() are true. drop_init_fpu() (now fpu_reset_state()) calls
restore_init_xstate() regardless of whether current used_math() - apply
the same logic here.
Switch used_math() -> tsk_used_math(tsk) to consistently use the grabbed
tsk instead of current, like in the rest of flush_thread().
Tested-by: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: Bobby Powers <bobbypowers@gmail.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Cc: Andy Lutomirski <luto@amacapital.net>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Fenghua Yu <fenghua.yu@intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Pekka Riikonen <priikone@iki.fi>
Cc: Quentin Casasnovas <quentin.casasnovas@oracle.com>
Cc: Rik van Riel <riel@redhat.com>
Cc: Suresh Siddha <sbsiddha@gmail.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Fixes: f893959b ("x86/fpu: Don't abuse drop_init_fpu() in flush_thread()")
Link: http://lkml.kernel.org/r/1430147441-9820-1-git-send-email-bobbypowers@gmail.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/process.c')
-rw-r--r-- | arch/x86/kernel/process.c | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/arch/x86/kernel/process.c b/arch/x86/kernel/process.c index bfc99b3b6522..6e338e3b1dc0 100644 --- a/arch/x86/kernel/process.c +++ b/arch/x86/kernel/process.c | |||
@@ -156,11 +156,13 @@ void flush_thread(void) | |||
156 | /* FPU state will be reallocated lazily at the first use. */ | 156 | /* FPU state will be reallocated lazily at the first use. */ |
157 | drop_fpu(tsk); | 157 | drop_fpu(tsk); |
158 | free_thread_xstate(tsk); | 158 | free_thread_xstate(tsk); |
159 | } else if (!used_math()) { | 159 | } else { |
160 | /* kthread execs. TODO: cleanup this horror. */ | 160 | if (!tsk_used_math(tsk)) { |
161 | if (WARN_ON(init_fpu(tsk))) | 161 | /* kthread execs. TODO: cleanup this horror. */ |
162 | force_sig(SIGKILL, tsk); | 162 | if (WARN_ON(init_fpu(tsk))) |
163 | user_fpu_begin(); | 163 | force_sig(SIGKILL, tsk); |
164 | user_fpu_begin(); | ||
165 | } | ||
164 | restore_init_xstate(); | 166 | restore_init_xstate(); |
165 | } | 167 | } |
166 | } | 168 | } |