[PATCH 4/4] powerpc: machine check interrupt is a non-maskable interrupt

Nicholas Piggin npiggin at gmail.com
Wed Jul 5 14:04:22 AEST 2017


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 at gmail.com>
---
 arch/powerpc/kernel/traps.c           | 9 ++++++---
 arch/powerpc/platforms/powernv/opal.c | 2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/arch/powerpc/kernel/traps.c b/arch/powerpc/kernel/traps.c
index 574e949f8db9..1933b74372a1 100644
--- a/arch/powerpc/kernel/traps.c
+++ b/arch/powerpc/kernel/traps.c
@@ -767,8 +767,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_cpu_inc(irq_stat.mce_exceptions);
 
@@ -798,10 +800,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("Unrecoverable Machine check");
 
 bail:
-	exception_exit(prev_state);
+	if (!nested)
+		nmi_exit();
 }
 
 void SMIException(struct pt_regs *regs)
diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c
index 92f00113227f..29967de9823d 100644
--- a/arch/powerpc/platforms/powernv/opal.c
+++ b/arch/powerpc/platforms/powernv/opal.c
@@ -449,7 +449,7 @@ int opal_machine_check(struct pt_regs *regs)
 
 	pnv_platform_error = "Unrecoverable Machine Check exception";
 
-	panic("Unrecoverable Machine Check exception");
+	nmi_panic("Unrecoverable Machine Check exception");
 }
 
 /* Early hmi handler called in real mode. */
-- 
2.11.0



More information about the Linuxppc-dev mailing list