Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

powerpc/64: hard disable irqs on the panic()ing CPU

Similar to previous patches, hard disable interrupts when a CPU is
in panic. This reduces the chance the watchdog has to interfere with
the panic, and avoids any other type of masked interrupt being
executed when crashing which minimises the length of the crash path.

Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Nicholas Piggin and committed by
Michael Ellerman
855b6232 de6e5d38

+10 -2
+10 -2
arch/powerpc/kernel/setup-common.c
··· 701 701 unsigned long event, void *ptr) 702 702 { 703 703 /* 704 + * panic does a local_irq_disable, but we really 705 + * want interrupts to be hard disabled. 706 + */ 707 + hard_irq_disable(); 708 + 709 + /* 704 710 * If firmware-assisted dump has been registered then trigger 705 711 * firmware-assisted dump and let firmware handle everything else. 706 712 */ 707 713 crash_fadump(NULL, ptr); 708 - ppc_md.panic(ptr); /* May not return */ 714 + if (ppc_md.panic) 715 + ppc_md.panic(ptr); /* May not return */ 709 716 return NOTIFY_DONE; 710 717 } 711 718 ··· 723 716 724 717 void __init setup_panic(void) 725 718 { 726 - if (!ppc_md.panic) 719 + /* PPC64 always does a hard irq disable in its panic handler */ 720 + if (!IS_ENABLED(CONFIG_PPC64) && !ppc_md.panic) 727 721 return; 728 722 atomic_notifier_chain_register(&panic_notifier_list, &ppc_panic_block); 729 723 }