[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-bef8b6da95229f780a0a7f63e23124058bfad6d3@git.kernel.org>
Date: Tue, 1 Nov 2016 00:16:19 -0700
From: tip-bot for Andy Lutomirski <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: tglx@...utronix.de, jpoimboe@...hat.com, oleg@...hat.com,
pbonzini@...hat.com, bp@...en8.de, quentin.casasnovas@...cle.com,
rusty@...tcorp.com.au, riel@...hat.com, brgerst@...il.com,
luto@...nel.org, dave.hansen@...ux.intel.com, kvm@...r.kernel.org,
torvalds@...ux-foundation.org, fenghua.yu@...el.com, hpa@...or.com,
mingo@...nel.org, dvlasenk@...hat.com, peterz@...radead.org,
linux-kernel@...r.kernel.org
Subject: [tip:x86/fpu] x86/fpu: Handle #NM without FPU emulation as an error
Commit-ID: bef8b6da95229f780a0a7f63e23124058bfad6d3
Gitweb: http://git.kernel.org/tip/bef8b6da95229f780a0a7f63e23124058bfad6d3
Author: Andy Lutomirski <luto@...nel.org>
AuthorDate: Mon, 31 Oct 2016 15:18:47 -0700
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Tue, 1 Nov 2016 07:47:54 +0100
x86/fpu: Handle #NM without FPU emulation as an error
Don't use CR0.TS. Make it an error rather than making nonsensical
changes to the FPU state.
(The cond_local_irq_enable() appears to have been pointless, too.)
Signed-off-by: Andy Lutomirski <luto@...nel.org>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>
Cc: Fenghua Yu <fenghua.yu@...el.com>
Cc: H. Peter Anvin <hpa@...or.com>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Oleg Nesterov <oleg@...hat.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Quentin Casasnovas <quentin.casasnovas@...cle.com>
Cc: Rik van Riel <riel@...hat.com>
Cc: Rusty Russell <rusty@...tcorp.com.au>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: kvm list <kvm@...r.kernel.org>
Link: http://lkml.kernel.org/r/f1ee6bf73ed1025fccaab321ba43d0594245f927.1477951965.git.luto@kernel.org
Signed-off-by: Ingo Molnar <mingo@...nel.org>
---
arch/x86/kernel/traps.c | 20 ++++++++++++++++----
1 file changed, 16 insertions(+), 4 deletions(-)
diff --git a/arch/x86/kernel/traps.c b/arch/x86/kernel/traps.c
index bd4e3d4..bf0c6d0 100644
--- a/arch/x86/kernel/traps.c
+++ b/arch/x86/kernel/traps.c
@@ -853,6 +853,8 @@ do_spurious_interrupt_bug(struct pt_regs *regs, long error_code)
dotraplinkage void
do_device_not_available(struct pt_regs *regs, long error_code)
{
+ unsigned long cr0;
+
RCU_LOCKDEP_WARN(!rcu_is_watching(), "entry code didn't wake RCU");
#ifdef CONFIG_MATH_EMULATION
@@ -866,10 +868,20 @@ do_device_not_available(struct pt_regs *regs, long error_code)
return;
}
#endif
- fpu__restore(¤t->thread.fpu); /* interrupts still off */
-#ifdef CONFIG_X86_32
- cond_local_irq_enable(regs);
-#endif
+
+ /* This should not happen. */
+ cr0 = read_cr0();
+ if (WARN(cr0 & X86_CR0_TS, "CR0.TS was set")) {
+ /* Try to fix it up and carry on. */
+ write_cr0(cr0 & ~X86_CR0_TS);
+ } else {
+ /*
+ * Something terrible happened, and we're better off trying
+ * to kill the task than getting stuck in a never-ending
+ * loop of #NM faults.
+ */
+ die("unexpected #NM exception", regs, error_code);
+ }
}
NOKPROBE_SYMBOL(do_device_not_available);
Powered by blists - more mailing lists