Skip to contentSkip to conversation

x86: show remote CPU state upon fatal NMI or unknown MCE

PATCH In review Jan Beulich 2 participants 2 messages Jun 20, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 x86: show remote CPU state upon fatal NMI or unknown MCE

Quite frequently the watchdog would hit an innocent CPU, e.g. one trying to acquire a spin lock a remote CPU holds for extended periods of time, or a random CPU in TSC calbration rendezvous. In such cases the register and stack dump for that CPU doesn't really help in the analysis of the problem.

To keep things reasonable on large systems, only log CS:RIP by default. This can be overridden via a new command line option such that full register/stack state would get logged.

---
v3: Add timeout. (Andrew, I hope the R-b can be kept despite the logic
not being a 1:1 clone of what the crash dump path does.)
v2: Pass flag to fatal_trap().

docs/misc/xen-command-line.markdown +8 -0
@@ -198,6 +198,14 @@ Permit Xen to use Address Space Identifi
 tags the TLB entries with an ID per vcpu.  This allows for guest TLB flushes
 to be performed without the overhead of a complete TLB flush.
 
+### async-show-all
+> `= <boolean>`
+
+> Default: `false`
+
+Forces all CPUs' full state to be logged upon certain fatal asynchronous
+exceptions (watchdog NMIs and unexpected MCEs).
+
 ### ats
 > `= <boolean>`
 
xen/arch/x86/cpu/mcheck/mce.c +1 -1
@@ -77,7 +77,7 @@ static void unexpected_machine_check(con
 {
     console_force_unlock();
     printk("Unexpected Machine Check Exception\n");
-    fatal_trap(regs);
+    fatal_trap(regs, 1);
 }
 
 
xen/arch/x86/nmi.c +1 -1
@@ -488,7 +488,7 @@ bool_t nmi_watchdog_tick(const struct cp
             console_force_unlock();
             printk("Watchdog timer detects that CPU%d is stuck!\n",
                    smp_processor_id());
-            fatal_trap(regs);
+            fatal_trap(regs, 1);
         }
     } 
     else 
xen/arch/x86/traps.c +53 -6

107 lines not on this page · raw message

xen/arch/x86/x86_64/entry.S +1 -0
@@ -558,6 +558,7 @@ exception_with_ints_disabled:
 
 /* No special register assumptions. */
 FATAL_exception_with_ints_disabled:
+        xorl  %esi,%esi
         movq  %rsp,%rdi
         call  fatal_trap
         BUG   /* fatal_trap() shouldn't return. */
xen/include/asm-x86/processor.h +1 -1
@@ -541,7 +541,7 @@ void show_registers(const struct cpu_use
 void show_execution_state(const struct cpu_user_regs *regs);
 #define dump_execution_state() run_in_exception_handler(show_execution_state)
 void show_page_walk(unsigned long addr);
-void noreturn fatal_trap(const struct cpu_user_regs *regs);
+void noreturn fatal_trap(const struct cpu_user_regs *regs, bool_t show_remote);
 
 void compat_show_guest_stack(struct vcpu *v,
                              const struct cpu_user_regs *regs, int lines);

x86: show remote CPU state upon fatal NMI or unknown MCE

Quite frequently the watchdog would hit an innocent CPU, e.g. one trying to acquire a spin lock a remote CPU holds for extended periods of time, or a random CPU in TSC calbration rendezvous. In such cases the register and stack dump for that CPU doesn't really help in the analysis of the problem.

To keep things reasonable on large systems, only log CS:RIP by default. This can be overridden via a new command line option such that full register/stack state would get logged.

---
v3: Add timeout. (Andrew, I hope the R-b can be kept despite the logic
not being a 1:1 clone of what the crash dump path does.)
v2: Pass flag to fatal_trap().

docs/misc/xen-command-line.markdown +8 -0
@@ -198,6 +198,14 @@ Permit Xen to use Address Space Identifi
 tags the TLB entries with an ID per vcpu.  This allows for guest TLB flushes
 to be performed without the overhead of a complete TLB flush.
 
+### async-show-all
+> `= <boolean>`
+
+> Default: `false`
+
+Forces all CPUs' full state to be logged upon certain fatal asynchronous
+exceptions (watchdog NMIs and unexpected MCEs).
+
 ### ats
 > `= <boolean>`
 
xen/arch/x86/cpu/mcheck/mce.c +1 -1
@@ -77,7 +77,7 @@ static void unexpected_machine_check(con
 {
     console_force_unlock();
     printk("Unexpected Machine Check Exception\n");
-    fatal_trap(regs);
+    fatal_trap(regs, 1);
 }
 
 
xen/arch/x86/nmi.c +1 -1
@@ -488,7 +488,7 @@ bool_t nmi_watchdog_tick(const struct cp
             console_force_unlock();
             printk("Watchdog timer detects that CPU%d is stuck!\n",
                    smp_processor_id());
-            fatal_trap(regs);
+            fatal_trap(regs, 1);
         }
     } 
     else 
xen/arch/x86/traps.c +53 -6

107 lines not on this page · raw message

xen/arch/x86/x86_64/entry.S +1 -0
@@ -558,6 +558,7 @@ exception_with_ints_disabled:
 
 /* No special register assumptions. */
 FATAL_exception_with_ints_disabled:
+        xorl  %esi,%esi
         movq  %rsp,%rdi
         call  fatal_trap
         BUG   /* fatal_trap() shouldn't return. */
xen/include/asm-x86/processor.h +1 -1
@@ -541,7 +541,7 @@ void show_registers(const struct cpu_use
 void show_execution_state(const struct cpu_user_regs *regs);
 #define dump_execution_state() run_in_exception_handler(show_execution_state)
 void show_page_walk(unsigned long addr);
-void noreturn fatal_trap(const struct cpu_user_regs *regs);
+void noreturn fatal_trap(const struct cpu_user_regs *regs, bool_t show_remote);
 
 void compat_show_guest_stack(struct vcpu *v,
                              const struct cpu_user_regs *regs, int lines);

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

#1 lore raw
Quoted 10 lines · Jan Beulich

Quite frequently the watchdog would hit an innocent CPU, e.g. one trying to acquire a spin lock a remote CPU holds for extended periods of time, or a random CPU in TSC calbration rendezvous. In such cases the register and stack dump for that CPU doesn't really help in the analysis of the problem.

To keep things reasonable on large systems, only log CS:RIP by default. This can be overridden via a new command line option such that full register/stack state would get logged.

Quoted 5 lines

---
v3: Add timeout. (Andrew, I hope the R-b can be kept despite the logic
not being a 1:1 clone of what the crash dump path does.)

Yeah - looks good.

~Andrew

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel