Skip to contentSkip to conversation

powerpc/64e: Fix perf hardlockup detector build

PATCH New Nicholas Piggin 1 participant 1 message Aug 7, 2017 PowerPC

lore
Share & tools
lore

Nicholas Piggin

author reviewer
#0 lore raw

PATCH 1/1 powerpc/64e: Fix perf hardlockup detector build

This fixes a couple more bits of fallout when enabling the hardlockup detector for 64e.

It restores the required hw_nmi_get_sample_period() function for the perf watchdog, and restores disabling of the watchdog there. It also removes API definitions that are only defined for 64s.

Fixes 2104180a53 ("powerpc/64s: implement arch-specific hardlockup watchdog")

---

This patch should go on top of the previous:

http://patchwork.ozlabs.org/patch/796202/

 arch/powerpc/include/asm/nmi.h |  3 +--
 arch/powerpc/kernel/setup_64.c | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+), 2 deletions(-)
arch/powerpc/include/asm/nmi.h +1 -2
index 6f8e79cd35d8..3760150a0ff0 100644
@@ -1,9 +1,8 @@
 #ifndef _ASM_NMI_H
 #define _ASM_NMI_H
 
-#ifdef CONFIG_HARDLOCKUP_DETECTOR
+#ifdef CONFIG_PPC_WATCHDOG
 extern void arch_touch_nmi_watchdog(void);
-
 extern void arch_trigger_cpumask_backtrace(const cpumask_t *mask,
 					   bool exclude_self);
 #define arch_trigger_cpumask_backtrace arch_trigger_cpumask_backtrace
arch/powerpc/kernel/setup_64.c +21 -0
index af23d4b576ec..5db2ddd8c31d 100644
@@ -751,3 +751,24 @@ unsigned long memory_block_size_bytes(void)
 struct ppc_pci_io ppc_pci_io;
 EXPORT_SYMBOL(ppc_pci_io);
 #endif
+
+#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
+u64 hw_nmi_get_sample_period(int watchdog_thresh)
+{
+	return ppc_proc_freq * watchdog_thresh;
+}
+
+/*
+ * The perf based hardlockup detector breaks PMU event based branches and is
+ * likely to get false positives in KVM guests, so disable it by default.
+ * Book3S has a soft-nmi version based on the decrementer interrupt so it does
+ * not suffer from these problems.
+ */
+static int __init disable_hardlockup_detector(void)
+{
+	hardlockup_detector_disable();
+
+	return 0;
+}
+early_initcall(disable_hardlockup_detector);
+#endif
Signature · 1 line
2.13.3