Thread (21 messages) 21 messages, 4 authors, 2018-10-13

Re: [PATCH v2 3/3] powerpc: machine check interrupt is a non-maskable interrupt

From: Christophe LEROY <hidden>
Date: 2018-10-08 16:19:46

Hi Nick,

Le 19/07/2017 à 08:59, Nicholas Piggin a écrit :
quoted hunk ↗ jump to hunk
Use nmi_enter similarly to system reset interrupts. This uses NMI
printk NMI buffers and turns off various debugging facilities that
helps avoid tripping on ourselves or other CPUs.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
  arch/powerpc/kernel/traps.c | 9 ++++++---
  1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 2849c4f50324..6d31f9d7c333 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -789,8 +789,10 @@ int machine_check_generic(struct pt_regs *regs)
  
  void machine_check_exception(struct pt_regs *regs)
  {
-	enum ctx_state prev_state = exception_enter();
  	int recover = 0;
+	bool nested = in_nmi();
+	if (!nested)
+		nmi_enter();
This alters preempt_count, then when die() is called
in_interrupt() returns true allthough the trap didn't happen in 
interrupt, so oops_end() panics for "fatal exception in interrupt" 
instead of gently sending SIGBUS the faulting app.

Any idea on how to fix this ?

Christophe
quoted hunk ↗ jump to hunk
  
  	__this_cpu_inc(irq_stat.mce_exceptions);
  
@@ -820,10 +822,11 @@ void machine_check_exception(struct pt_regs *regs)
  
  	/* Must die if the interrupt is not recoverable */
  	if (!(regs->msr & MSR_RI))
-		panic("Unrecoverable Machine check");
+		nmi_panic(regs, "Unrecoverable Machine check");
  
  bail:
-	exception_exit(prev_state);
+	if (!nested)
+		nmi_exit();
  }
  
  void SMIException(struct pt_regs *regs)
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help