Skip to content

Commit abc514c

Browse files
h-kawai-eztorvalds
authored andcommitted
hpwdt: use nmi_panic() when kernel panics in NMI handler
Commit 1717f20 ("panic, x86: Fix re-entrance problem due to panic on NMI") introduced nmi_panic() which prevents concurrent and recursive execution of panic(). It also saves registers for the crash dump on x86 by later commit 58c5661 ("panic, x86: Allow CPUs to save registers even if looping in NMI context"). hpwdt driver can call panic() from NMI handler, so replace it with nmi_panic(). Also, do some cleanups. Signed-off-by: Hidehiro Kawai <hidehiro.kawai.ez@hitachi.com> Acked-by: Guenter Roeck <linux@roeck-us.net> Cc: Thomas Mingarelli <thomas.mingarelli@hpe.com> Cc: Wim Van Sebroeck <wim@iguana.be> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 73cbf4a commit abc514c

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

‎drivers/watchdog/hpwdt.c‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ static int hpwdt_pretimeout(unsigned int ulReason, struct pt_regs *regs)
484484
static int die_nmi_called;
485485

486486
if (!hpwdt_nmi_decoding)
487-
goto out;
487+
return NMI_DONE;
488488

489489
spin_lock_irqsave(&rom_lock, rom_pl);
490490
if (!die_nmi_called && !is_icru && !is_uefi)
@@ -497,20 +497,19 @@ static int hpwdt_pretimeout(unsigned int ulReason, struct pt_regs *regs)
497497

498498
if (!is_icru && !is_uefi) {
499499
if (cmn_regs.u1.ral == 0) {
500-
panic("An NMI occurred, "
501-
"but unable to determine source.\n");
500+
nmi_panic(regs, "An NMI occurred, but unable to determine source.\n");
501+
return NMI_HANDLED;
502502
}
503503
}
504-
panic("An NMI occurred. Depending on your system the reason "
504+
nmi_panic(regs, "An NMI occurred. Depending on your system the reason "
505505
"for the NMI is logged in any one of the following "
506506
"resources:\n"
507507
"1. Integrated Management Log (IML)\n"
508508
"2. OA Syslog\n"
509509
"3. OA Forward Progress Log\n"
510510
"4. iLO Event Log");
511511

512-
out:
513-
return NMI_DONE;
512+
return NMI_HANDLED;
514513
}
515514
#endif /* CONFIG_HPWDT_NMI_DECODING */
516515

0 commit comments

Comments
 (0)