From 63c6680cd09b8803f428ec606d764229cb78eca6 Mon Sep 17 00:00:00 2001 From: Ingo Molnar Date: Fri, 1 May 2015 10:54:22 +0200 Subject: [PATCH] x86/fpu: Move debugging check from kernel_fpu_begin() to __kernel_fpu_begin() kernel_fpu_begin() is __kernel_fpu_begin() with a preempt_disable(). Move the kernel_fpu_begin() debugging check into __kernel_fpu_begin(), so that users of __kernel_fpu_begin() may benefit from it as well. Cc: Andy Lutomirski Cc: Borislav Petkov Cc: Dave Hansen Cc: Fenghua Yu Cc: H. Peter Anvin Cc: Linus Torvalds Cc: Oleg Nesterov Cc: Peter Zijlstra Cc: Thomas Gleixner Signed-off-by: Ingo Molnar --- arch/x86/kernel/fpu/core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/x86/kernel/fpu/core.c b/arch/x86/kernel/fpu/core.c index 97df457784aa..d67558cdbddd 100644 --- a/arch/x86/kernel/fpu/core.c +++ b/arch/x86/kernel/fpu/core.c @@ -109,6 +109,8 @@ void __kernel_fpu_begin(void) { struct fpu *fpu = ¤t->thread.fpu; + WARN_ON_ONCE(!irq_fpu_usable()); + kernel_fpu_disable(); if (fpu->fpregs_active) { @@ -138,7 +140,6 @@ EXPORT_SYMBOL(__kernel_fpu_end); void kernel_fpu_begin(void) { preempt_disable(); - WARN_ON_ONCE(!irq_fpu_usable()); __kernel_fpu_begin(); } EXPORT_SYMBOL_GPL(kernel_fpu_begin);