x86/traps: Disentangle the 32-bit and 64-bit doublefault code
authorAndy Lutomirski <luto@kernel.org>
Thu, 21 Nov 2019 06:12:38 +0000 (22:12 -0800)
committerIngo Molnar <mingo@kernel.org>
Tue, 26 Nov 2019 20:53:34 +0000 (21:53 +0100)
The 64-bit doublefault handler is much nicer than the 32-bit one.
As a first step toward unifying them, make the 64-bit handler
self-contained.  This should have no effect no functional effect
except in the odd case of x86_64 with CONFIG_DOUBLEFAULT=n in which
case it will change the logging a bit.

This also gets rid of CONFIG_DOUBLEFAULT configurability on 64-bit
kernels.  It didn't do anything useful -- CONFIG_DOUBLEFAULT=n
didn't actually disable doublefault handling on x86_64.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
arch/x86/Kconfig.debug
arch/x86/include/asm/processor.h
arch/x86/kernel/doublefault.c
arch/x86/kernel/traps.c

index 409c00f74e608c455620950aa9b6caa8da3568d7..c4eab8ed33a37fe2f97e788577a1f266d6b5e627 100644 (file)
@@ -117,7 +117,7 @@ config DEBUG_WX
 
 config DOUBLEFAULT
        default y
-       bool "Enable doublefault exception handler" if EXPERT
+       bool "Enable doublefault exception handler" if EXPERT && X86_32
        ---help---
          This option allows trapping of rare doublefault exceptions that
          would otherwise cause a system to silently reboot. Disabling this
index e51afbb0cbfbe1aab03f5db3d4b5fcd97f9dcf3b..f6c630097d9f61d11b545a01e865bfc89f8acc38 100644 (file)
@@ -997,7 +997,6 @@ bool xen_set_default_idle(void);
 #endif
 
 void stop_this_cpu(void *dummy);
-void df_debug(struct pt_regs *regs, long error_code);
 void microcode_check(void);
 
 enum l1tf_mitigations {
index 0d6c657593f86e5789d1150014df4277a9ed335f..0b3c616b61a3b644983b1e52b82f9416c70cfd93 100644 (file)
@@ -72,15 +72,4 @@ struct x86_hw_tss doublefault_tss __cacheline_aligned = {
        .__cr3          = __pa_nodebug(swapper_pg_dir),
 };
 
-/* dummy for do_double_fault() call */
-void df_debug(struct pt_regs *regs, long error_code) {}
-
-#else /* !CONFIG_X86_32 */
-
-void df_debug(struct pt_regs *regs, long error_code)
-{
-       pr_emerg("PANIC: double fault, error_code: 0x%lx\n", error_code);
-       show_regs(regs);
-       panic("Machine halted.");
-}
 #endif
index c90312146da0357e932de5430922271da7b165bc..76381b04dc93ea4a2d87aab7099095d1953c2ac4 100644 (file)
@@ -411,15 +411,9 @@ dotraplinkage void do_double_fault(struct pt_regs *regs, long error_code, unsign
                handle_stack_overflow("kernel stack overflow (double-fault)", regs, cr2);
 #endif
 
-#ifdef CONFIG_DOUBLEFAULT
-       df_debug(regs, error_code);
-#endif
-       /*
-        * This is always a kernel trap and never fixable (and thus must
-        * never return).
-        */
-       for (;;)
-               die(str, regs, error_code);
+       pr_emerg("PANIC: double fault, error_code: 0x%lx\n", error_code);
+       show_regs(regs);
+       panic("Machine halted.");
 }
 #endif