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

powerpc: Add ppc64 hard lockup detector support

The hard lockup detector uses a PMU event as a periodic NMI to
detect if we are stuck (where stuck means no timer interrupts have
occurred).

Ben's rework of the ppc64 soft disable code has made ppc64 PMU
exceptions a partial NMI. They can get disabled if an external
interrupt comes in, but otherwise PMU interrupts will fire in
interrupt disabled regions.

We disable the hard lockup detector by default for a few reasons:

- It breaks userspace event based branches on POWER8.
- It is likely to produce false positives on KVM guests.
- Since PMCs can only count to 2^31, counting cycles means we might
take multiple PMU exceptions per second per hardware thread even
if our hard lockup timeout is 10 seconds.

It can be enabled via a boot option, or via procfs.

Signed-off-by: Anton Blanchard <anton@samba.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>

authored by

Anton Blanchard and committed by
Michael Ellerman
c54b2bf1 af9feebe

+25
+1
arch/powerpc/Kconfig
··· 152 152 select DCACHE_WORD_ACCESS if PPC64 && CPU_LITTLE_ENDIAN 153 153 select NO_BOOTMEM 154 154 select HAVE_GENERIC_RCU_GUP 155 + select HAVE_PERF_EVENTS_NMI if PPC64 155 156 156 157 config GENERIC_CSUM 157 158 def_bool CPU_LITTLE_ENDIAN
+4
arch/powerpc/include/asm/nmi.h
··· 1 + #ifndef _ASM_NMI_H 2 + #define _ASM_NMI_H 3 + 4 + #endif /* _ASM_NMI_H */
+20
arch/powerpc/kernel/setup_64.c
··· 37 37 #include <linux/memblock.h> 38 38 #include <linux/hugetlb.h> 39 39 #include <linux/memory.h> 40 + #include <linux/nmi.h> 40 41 41 42 #include <asm/io.h> 42 43 #include <asm/kdump.h> ··· 779 778 #if defined(CONFIG_PPC_INDIRECT_PIO) || defined(CONFIG_PPC_INDIRECT_MMIO) 780 779 struct ppc_pci_io ppc_pci_io; 781 780 EXPORT_SYMBOL(ppc_pci_io); 781 + #endif 782 + 783 + #ifdef CONFIG_HARDLOCKUP_DETECTOR 784 + u64 hw_nmi_get_sample_period(int watchdog_thresh) 785 + { 786 + return ppc_proc_freq * watchdog_thresh; 787 + } 788 + 789 + /* 790 + * The hardlockup detector breaks PMU event based branches and is likely 791 + * to get false positives in KVM guests, so disable it by default. 792 + */ 793 + static int __init disable_hardlockup_detector(void) 794 + { 795 + watchdog_enable_hardlockup_detector(false); 796 + 797 + return 0; 798 + } 799 + early_initcall(disable_hardlockup_detector); 782 800 #endif