]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
powerpc: Mark system reset as an NMI with nmi_enter/exit()
authorNicholas Piggin <npiggin@gmail.com>
Mon, 19 Dec 2016 18:30:07 +0000 (04:30 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Fri, 28 Apr 2017 11:02:25 +0000 (21:02 +1000)
System reset is a non-maskable interrupt from Linux's point of view
(occurs under local_irq_disable()), so it should use nmi_enter/exit.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/traps.c

index 2393d3c462360e0e95713eba195427e373b4f566..6a81a451d7674eae43a445eb112018a971c32bf0 100644 (file)
@@ -279,6 +279,14 @@ void _exception(int signr, struct pt_regs *regs, int code, unsigned long addr)
 
 void system_reset_exception(struct pt_regs *regs)
 {
+       /*
+        * Avoid crashes in case of nested NMI exceptions. Recoverability
+        * is determined by RI and in_nmi
+        */
+       bool nested = in_nmi();
+       if (!nested)
+               nmi_enter();
+
        /* See if any machine dependent calls */
        if (ppc_md.system_reset_exception) {
                if (ppc_md.system_reset_exception(regs))
@@ -297,6 +305,9 @@ out:
        if (!(regs->msr & MSR_RI))
                panic("Unrecoverable System Reset");
 
+       if (!nested)
+               nmi_exit();
+
        /* What should we do here? We could issue a shutdown or hard reset. */
 }