Skip to contentSkip to conversation

watchdog: remove HARDLOCKUP_DETECTOR_PERF

PATCH In review Yunhui Cui 6 participants 8 messages Sep 15, 2025 – Sep 16, 2025

Subsystems (5)
x86 PowerPC Library code perf events +1 more subsystems
lore
Share & tools
lore

Yunhui Cui

author
#0 lore raw

PATCH 1/1 watchdog: remove HARDLOCKUP_DETECTOR_PERF

There are currently two hard lockup detector implementations:
HARDLOCKUP_DETECTOR_PERF (perf-based) and HARDLOCKUP_DETECTOR_BUDDY (buddy-based). When enabling the hardlockup feature on new arch (e.g., RISC-V), ambiguity arises regarding which detector to choose.

From the community discussion (see link below [1]), the buddy approach is preferred. So remove the HARDLOCKUP_DETECTOR_PERF implementation.

---
 arch/Kconfig                     |  14 --
 arch/arm64/Kconfig               |   3 -
 arch/arm64/kernel/Makefile       |   1 -
 arch/arm64/kernel/watchdog_hld.c |  94 ----------
 arch/powerpc/Kconfig             |   2 -
 arch/powerpc/kernel/setup_64.c   |  11 --
 arch/x86/Kconfig                 |   2 -
 arch/x86/events/intel/core.c     |   4 -
 arch/x86/kernel/apic/hw_nmi.c    |   7 -
 include/linux/nmi.h              |  24 ---
 kernel/Makefile                  |   1 -
 kernel/watchdog.c                |   3 -
 kernel/watchdog_perf.c           | 308 -------------------------------
 lib/Kconfig.debug                |  34 +---
 14 files changed, 3 insertions(+), 505 deletions(-)
 delete mode 100644 arch/arm64/kernel/watchdog_hld.c
 delete mode 100644 kernel/watchdog_perf.c
arch/Kconfig +0 -14
index f18dbcc776140..76e99f25be8ca 100644
@@ -459,20 +459,6 @@ config HAVE_MIXED_BREAKPOINTS_REGS
 config HAVE_USER_RETURN_NOTIFIER
 	bool
 
-config HAVE_PERF_EVENTS_NMI
-	bool
-	help
-	  System hardware can generate an NMI using the perf event
-	  subsystem.  Also has support for calculating CPU cycle events
-	  to determine how many clock cycles in a given period.
-
-config HAVE_HARDLOCKUP_DETECTOR_PERF
-	bool
-	depends on HAVE_PERF_EVENTS_NMI
-	help
-	  The arch chooses to use the generic perf-NMI-based hardlockup
-	  detector. Must define HAVE_PERF_EVENTS_NMI.
-
 config HAVE_HARDLOCKUP_DETECTOR_ARCH
 	bool
 	help
arch/arm64/Kconfig +0 -3
index 63e7d8a86b92c..d04ad76ecf67b 100644
@@ -229,8 +229,6 @@ config ARM64
 	select HAVE_FUNCTION_GRAPH_FREGS
 	select HAVE_FUNCTION_GRAPH_TRACER
 	select HAVE_GCC_PLUGINS
-	select HAVE_HARDLOCKUP_DETECTOR_PERF if PERF_EVENTS && \
-		HW_PERF_EVENTS && HAVE_PERF_EVENTS_NMI
 	select HAVE_HW_BREAKPOINT if PERF_EVENTS
 	select HAVE_IOREMAP_PROT
 	select HAVE_IRQ_TIME_ACCOUNTING
@@ -238,7 +236,6 @@ config ARM64
 	select HAVE_MOD_ARCH_SPECIFIC
 	select HAVE_NMI
 	select HAVE_PERF_EVENTS
-	select HAVE_PERF_EVENTS_NMI if ARM64_PSEUDO_NMI
 	select HAVE_PERF_REGS
 	select HAVE_PERF_USER_STACK_DUMP
 	select HAVE_PREEMPT_DYNAMIC_KEY
arch/arm64/kernel/Makefile +0 -1
index 76f32e424065e..12d77f373fea4 100644
@@ -44,7 +44,6 @@ obj-$(CONFIG_KUSER_HELPERS)		+= kuser32.o
 obj-$(CONFIG_FUNCTION_TRACER)		+= ftrace.o entry-ftrace.o
 obj-$(CONFIG_MODULES)			+= module.o module-plts.o
 obj-$(CONFIG_PERF_EVENTS)		+= perf_regs.o perf_callchain.o
-obj-$(CONFIG_HARDLOCKUP_DETECTOR_PERF)	+= watchdog_hld.o
 obj-$(CONFIG_HAVE_HW_BREAKPOINT)	+= hw_breakpoint.o
 obj-$(CONFIG_CPU_PM)			+= sleep.o suspend.o
 obj-$(CONFIG_KGDB)			+= kgdb.o
arch/arm64/kernel/watchdog_hld.c deleted +0 -94

94 lines not on this page · raw message

arch/powerpc/Kconfig +0 -2
index a72d15bbbd7c7..4feebc0ba6adf 100644
@@ -253,7 +253,6 @@ config PPC
 	select HAVE_GCC_PLUGINS
 	select HAVE_GENERIC_VDSO
 	select HAVE_HARDLOCKUP_DETECTOR_ARCH	if PPC_BOOK3S_64 && SMP
-	select HAVE_HARDLOCKUP_DETECTOR_PERF	if PERF_EVENTS && HAVE_PERF_EVENTS_NMI
 	select HAVE_HW_BREAKPOINT		if PERF_EVENTS && (PPC_BOOK3S || PPC_8xx)
 	select HAVE_IOREMAP_PROT
 	select HAVE_IRQ_TIME_ACCOUNTING
@@ -272,7 +271,6 @@ config PPC
 	select HAVE_OBJTOOL			if ARCH_USING_PATCHABLE_FUNCTION_ENTRY || MPROFILE_KERNEL || PPC32
 	select HAVE_OBJTOOL_MCOUNT		if HAVE_OBJTOOL
 	select HAVE_PERF_EVENTS
-	select HAVE_PERF_EVENTS_NMI		if PPC64
 	select HAVE_PERF_REGS
 	select HAVE_PERF_USER_STACK_DUMP
 	select HAVE_PREEMPT_DYNAMIC_KEY
arch/powerpc/kernel/setup_64.c +0 -11
index 8fd7cbf3bd048..8deea36ed97d1 100644
@@ -894,13 +894,6 @@ 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;
-}
-#endif
-
 /*
  * The perf based hardlockup detector breaks PMU event based branches, so
  * disable it by default. Book3S has a soft-nmi hardlockup detector based
@@ -913,15 +906,11 @@ u64 hw_nmi_get_sample_period(int watchdog_thresh)
  */
 static int __init disable_hardlockup_detector(void)
 {
-#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
-	hardlockup_detector_disable();
-#else
 	if (firmware_has_feature(FW_FEATURE_LPAR)) {
 		check_kvm_guest();
 		if (is_kvm_guest())
 			hardlockup_detector_disable();
 	}
-#endif
 
 	return 0;
 }
arch/x86/Kconfig +0 -2
index d68b5f6202e2f..099fa9fc725c1 100644
@@ -273,8 +273,6 @@ config X86
 	select HAVE_PAGE_SIZE_4KB
 	select HAVE_PCSPKR_PLATFORM
 	select HAVE_PERF_EVENTS
-	select HAVE_PERF_EVENTS_NMI
-	select HAVE_HARDLOCKUP_DETECTOR_PERF	if PERF_EVENTS && HAVE_PERF_EVENTS_NMI
 	select HAVE_PCI
 	select HAVE_PERF_REGS
 	select HAVE_PERF_USER_STACK_DUMP
arch/x86/events/intel/core.c +0 -4
index 28f5468a6ea36..756929be84992 100644
@@ -7818,16 +7818,12 @@ static __init int fixup_ht_bug(void)
 
 	cpus_read_lock();
 
-	hardlockup_detector_perf_stop();
-
 	x86_pmu.flags &= ~(PMU_FL_EXCL_CNTRS | PMU_FL_EXCL_ENABLED);
 
 	x86_pmu.start_scheduling = NULL;
 	x86_pmu.commit_scheduling = NULL;
 	x86_pmu.stop_scheduling = NULL;
 
-	hardlockup_detector_perf_restart();
-
 	for_each_online_cpu(c)
 		free_excl_cntrs(&per_cpu(cpu_hw_events, c));
 
arch/x86/kernel/apic/hw_nmi.c +0 -7
index 45af535c44a07..bc534f4f6fbc5 100644
@@ -23,13 +23,6 @@
 
 #include "local.h"
 
-#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
-u64 hw_nmi_get_sample_period(int watchdog_thresh)
-{
-	return (u64)(cpu_khz) * 1000 * watchdog_thresh;
-}
-#endif
-
 #ifdef arch_trigger_cpumask_backtrace
 static void nmi_raise_cpu_backtrace(cpumask_t *mask)
 {
include/linux/nmi.h +0 -24
index cf3c6ab408aac..ff2b70cfd39bb 100644
@@ -99,18 +99,6 @@ void watchdog_hardlockup_touch_cpu(unsigned int cpu);
 void watchdog_hardlockup_check(unsigned int cpu, struct pt_regs *regs);
 #endif
 
-#if defined(CONFIG_HARDLOCKUP_DETECTOR_PERF)
-extern void hardlockup_detector_perf_stop(void);
-extern void hardlockup_detector_perf_restart(void);
-extern void hardlockup_config_perf_event(const char *str);
-extern void hardlockup_detector_perf_adjust_period(u64 period);
-#else
-static inline void hardlockup_detector_perf_stop(void) { }
-static inline void hardlockup_detector_perf_restart(void) { }
-static inline void hardlockup_config_perf_event(const char *str) { }
-static inline void hardlockup_detector_perf_adjust_period(u64 period) { }
-#endif
-
 void watchdog_hardlockup_stop(void);
 void watchdog_hardlockup_start(void);
 int watchdog_hardlockup_probe(void);
@@ -204,18 +192,6 @@ static inline bool trigger_single_cpu_backtrace(int cpu)
 }
 #endif
 
-#ifdef CONFIG_HARDLOCKUP_DETECTOR_PERF
-u64 hw_nmi_get_sample_period(int watchdog_thresh);
-bool arch_perf_nmi_is_available(void);
-#endif
-
-#if defined(CONFIG_HARDLOCKUP_CHECK_TIMESTAMP) && \
-    defined(CONFIG_HARDLOCKUP_DETECTOR_PERF)
-void watchdog_update_hrtimer_threshold(u64 period);
-#else
-static inline void watchdog_update_hrtimer_threshold(u64 period) { }
-#endif
-
 #ifdef CONFIG_HAVE_ACPI_APEI_NMI
 #include <asm/nmi.h>
 #endif
kernel/Makefile +0 -1
index 216a7dfc3a688..76de2a3df2fb9 100644
@@ -102,7 +102,6 @@ obj-$(CONFIG_KGDB) += debug/
 obj-$(CONFIG_DETECT_HUNG_TASK) += hung_task.o
 obj-$(CONFIG_LOCKUP_DETECTOR) += watchdog.o
 obj-$(CONFIG_HARDLOCKUP_DETECTOR_BUDDY) += watchdog_buddy.o
-obj-$(CONFIG_HARDLOCKUP_DETECTOR_PERF) += watchdog_perf.o
 obj-$(CONFIG_SECCOMP) += seccomp.o
 obj-$(CONFIG_RELAY) += relay.o
 obj-$(CONFIG_SYSCTL) += utsname_sysctl.o
kernel/watchdog.c +0 -3
index 5b62d10027836..8d058389a3565 100644
@@ -111,8 +111,6 @@ static int __init hardlockup_panic_setup(char *str)
 		watchdog_hardlockup_user_enabled = 0;
 	else if (!strncmp(str, "1", 1))
 		watchdog_hardlockup_user_enabled = 1;
-	else if (!strncmp(str, "r", 1))
-		hardlockup_config_perf_event(str + 1);
 	while (*(str++)) {
 		if (*str == ',') {
 			str++;
@@ -623,7 +621,6 @@ static void set_sample_period(void)
 	 * hardlockup detector generates a warning
 	 */
 	sample_period = get_softlockup_thresh() * ((u64)NSEC_PER_SEC / NUM_SAMPLE_PERIODS);
-	watchdog_update_hrtimer_threshold(sample_period);
 }
 
 static void update_report_ts(void)
kernel/watchdog_perf.c deleted +0 -308

308 lines not on this page · raw message

lib/Kconfig.debug +3 -31
index 099abf128ce67..5981d33e12f6d 100644
@@ -1159,8 +1159,7 @@ config HAVE_HARDLOCKUP_DETECTOR_BUDDY
 config HARDLOCKUP_DETECTOR
 	bool "Detect Hard Lockups"
 	depends on DEBUG_KERNEL && !S390 && !HARDLOCKUP_DETECTOR_SPARC64
-	depends on HAVE_HARDLOCKUP_DETECTOR_PERF || HAVE_HARDLOCKUP_DETECTOR_BUDDY || HAVE_HARDLOCKUP_DETECTOR_ARCH
-	imply HARDLOCKUP_DETECTOR_PERF
+	depends on HAVE_HARDLOCKUP_DETECTOR_BUDDY || HAVE_HARDLOCKUP_DETECTOR_ARCH
 	imply HARDLOCKUP_DETECTOR_BUDDY
 	imply HARDLOCKUP_DETECTOR_ARCH
 	select LOCKUP_DETECTOR
@@ -1174,37 +1173,10 @@ config HARDLOCKUP_DETECTOR
 	  chance to run.  The current stack trace is displayed upon detection
 	  and the system will stay locked up.
 
-#
-# Note that arch-specific variants are always preferred.
-#
-config HARDLOCKUP_DETECTOR_PREFER_BUDDY
-	bool "Prefer the buddy CPU hardlockup detector"
-	depends on HARDLOCKUP_DETECTOR
-	depends on HAVE_HARDLOCKUP_DETECTOR_PERF && HAVE_HARDLOCKUP_DETECTOR_BUDDY
-	depends on !HAVE_HARDLOCKUP_DETECTOR_ARCH
-	help
-	  Say Y here to prefer the buddy hardlockup detector over the perf one.
-
-	  With the buddy detector, each CPU uses its softlockup hrtimer
-	  to check that the next CPU is processing hrtimer interrupts by
-	  verifying that a counter is increasing.
-
-	  This hardlockup detector is useful on systems that don't have
-	  an arch-specific hardlockup detector or if resources needed
-	  for the hardlockup detector are better used for other things.
-
-config HARDLOCKUP_DETECTOR_PERF
-	bool
-	depends on HARDLOCKUP_DETECTOR
-	depends on HAVE_HARDLOCKUP_DETECTOR_PERF && !HARDLOCKUP_DETECTOR_PREFER_BUDDY
-	depends on !HAVE_HARDLOCKUP_DETECTOR_ARCH
-	select HARDLOCKUP_DETECTOR_COUNTS_HRTIMER
-
 config HARDLOCKUP_DETECTOR_BUDDY
 	bool
 	depends on HARDLOCKUP_DETECTOR
 	depends on HAVE_HARDLOCKUP_DETECTOR_BUDDY
-	depends on !HAVE_HARDLOCKUP_DETECTOR_PERF || HARDLOCKUP_DETECTOR_PREFER_BUDDY
 	depends on !HAVE_HARDLOCKUP_DETECTOR_ARCH
 	select HARDLOCKUP_DETECTOR_COUNTS_HRTIMER
 
@@ -1217,8 +1189,8 @@ config HARDLOCKUP_DETECTOR_ARCH
 	  be used.
 
 #
-# Both the "perf" and "buddy" hardlockup detectors count hrtimer
-# interrupts. This config enables functions managing this common code.
+# Buddy hardlockup detectors count hrtimer interrupts. This config enables
+# functions managing this common code.
 #
 config HARDLOCKUP_DETECTOR_COUNTS_HRTIMER
 	bool
Signature · 1 line
2.39.5
maintainer
#1 lore raw
Quoted 9 lines · Yunhui Cui

There are currently two hard lockup detector implementations:
HARDLOCKUP_DETECTOR_PERF (perf-based) and HARDLOCKUP_DETECTOR_BUDDY (buddy-based). When enabling the hardlockup feature on new arch (e.g., RISC-V), ambiguity arises regarding which detector to choose.

From the community discussion (see link below [1]), the buddy approach is preferred. So remove the HARDLOCKUP_DETECTOR_PERF implementation.

This is a link to a thread containing two messages, so I think it's a little premature to say whether one driver is preferred over the other.

Quoted 6 lines
---
 arch/Kconfig                     |  14 --
 arch/arm64/Kconfig               |   3 -
 arch/arm64/kernel/Makefile       |   1 -
 arch/arm64/kernel/watchdog_hld.c |  94 ----------

The main reason we used HARDLOCKUP_DETECTOR_PERF on arm64 is because we can use interrupt priorities to treat the PMU overflow interrupt like an NMI, meaning that even if CPUs get wedged with irqs disabled then we're still able to trigger the watchdog reset.

How does HARDLOCKUP_DETECTOR_BUDDY achieve that? From my cursory glance at the code, it just looks to be using an hrtimer.

/me looks back at the "discussion" cited in the commit message:

| If all CPUs are hard locked up at the same time the buddy system | can't detect it.

Ok, so why is that limitation acceptable? It looks to me like you're removing useful functionality.

Will

maintainer
#2 lore raw
Quoted 5 lines · Will Deacon

| If all CPUs are hard locked up at the same time the buddy system | can't detect it.

Ok, so why is that limitation acceptable? It looks to me like you're removing useful functionality.

Yeah, this. I've run into this case waaay too many times to think it reasonable to remove the perf/NMI based lockup detector.

#3 lore raw

Hi,

Quoted 11 lines · Peter Zijlstra
Quoted 5 lines · Will Deacon

| If all CPUs are hard locked up at the same time the buddy system | can't detect it.

Ok, so why is that limitation acceptable? It looks to me like you're removing useful functionality.

Yeah, this. I've run into this case waaay too many times to think it reasonable to remove the perf/NMI based lockup detector.

I am a bit curious how this comes to be in cases where you've seen it. What causes all CPUs to be stuck looping all with interrupts disabled (but still able to execute NMIs)? Certainly one can come up with a synthetic way to make that happen, but I would imagine it to be exceedingly rare in real life. Maybe all CPUs are deadlocked waiting on spinlocks or something? There shouldn't be a lot of other reasons that all CPUs should be stuck indefinitely with interrupts disabled... If that's what's happening, (just spitballing) I wonder if hooking into the slowpath of spinlocks to look for lockups would help? Maybe every 10000 failures to acquire the spinlock we check for a lockup? Obviously you could still come up with synthetic ways to make a non-caught watchdog, but hopefully in those types of cases we can at least reset the device with a hardware watchdog?

Overall the issue is that it's really awkward to have both types of lockup detectors, especially since you've got to pick at compile time. The perf lockup detector has a pile of things that make it pretty awkward and it seems like people have been toward the buddy detector because of this...

-Doug

#4 lore raw
Quoted 29 lines · Doug Anderson

Hi,

Quoted 11 lines · Peter Zijlstra
Quoted 5 lines · Will Deacon

| If all CPUs are hard locked up at the same time the buddy system | can't detect it.

Ok, so why is that limitation acceptable? It looks to me like you're removing useful functionality.

Yeah, this. I've run into this case waaay too many times to think it reasonable to remove the perf/NMI based lockup detector.

I am a bit curious how this comes to be in cases where you've seen it. What causes all CPUs to be stuck looping all with interrupts disabled (but still able to execute NMIs)? Certainly one can come up with a synthetic way to make that happen, but I would imagine it to be exceedingly rare in real life. Maybe all CPUs are deadlocked waiting on spinlocks or something? There shouldn't be a lot of other reasons that all CPUs should be stuck indefinitely with interrupts disabled... If that's what's happening, (just spitballing) I wonder if hooking into the slowpath of spinlocks to look for lockups would help? Maybe every 10000 failures to acquire the spinlock we check for a lockup? Obviously you could still come up with synthetic ways to make a non-caught watchdog, but hopefully in those types of cases we can at least reset the device with a hardware watchdog?

Quoted 7 lines

Overall the issue is that it's really awkward to have both types of lockup detectors, especially since you've got to pick at compile time. The perf lockup detector has a pile of things that make it pretty awkward and it seems like people have been toward the buddy detector because of this...

-Doug

Should we support both modularization and changing the backend after boot, so that the user has the choice?

Signature · 1 line
Jinchao
reviewer
#5 lore raw
Quoted 2 lines · Jinchao Wang

Should we support both modularization and changing the backend after boot, so that the user has the choice?

Having both together and then being able to choose one or the other sounds like the ideal solution. An issue is that /proc/sys/kernel/nmi_watchdog is used to dynamically enable/disable both watchdogs and presumably renaming it for the buddy could cause issues in user code.

There can be unexpected consequences of the buddy watchdog, as the NMI perf event goes away there can be extra cost in setting up the first event such as allocating buffers for the PMU. While enabling the NMI watchdog to avoid this cost is kind of odd, I think users would be glad of a workaround for what may be perceived as a regression.

Thanks,
Ian

maintainer
#6 lore raw
In reply to Doug Anderson
Quoted 13 lines · Doug Anderson
Quoted 11 lines · Peter Zijlstra
Quoted 5 lines · Will Deacon

| If all CPUs are hard locked up at the same time the buddy system | can't detect it.

Ok, so why is that limitation acceptable? It looks to me like you're removing useful functionality.

Yeah, this. I've run into this case waaay too many times to think it reasonable to remove the perf/NMI based lockup detector.

Quoted 7 lines

I am a bit curious how this comes to be in cases where you've seen it. What causes all CPUs to be stuck looping all with interrupts disabled (but still able to execute NMIs)? Certainly one can come up with a synthetic way to make that happen, but I would imagine it to be exceedingly rare in real life. Maybe all CPUs are deadlocked waiting on spinlocks or something? There shouldn't be a lot of other reasons that all CPUs should be stuck indefinitely with interrupts disabled...

The simplest one I often run into is rq->lock getting stuck and then all the other CPUs piling up on that in various ways.

Getting stop_machine() stuck is also a fun one.

I mean, it really isn't that hard. If, as a full time kernel dev, you don't get into this situation at least a few time a year, you're just not doing your job right ;-)

Quoted 6 lines

If that's what's happening, (just spitballing) I wonder if hooking into the slowpath of spinlocks to look for lockups would help? Maybe every 10000 failures to acquire the spinlock we check for a lockup? Obviously you could still come up with synthetic ways to make a non-caught watchdog, but hopefully in those types of cases we can at least reset the device with a hardware watchdog?

Now, why would I want to make the spinlock code worse if I have a perfectly functional NMI watchdog?

Quoted 2 lines

Overall the issue is that it's really awkward to have both types of lockup detectors, especially since you've got to pick at compile time.

Well, then go fix that. Surely this isn't rocket science.

Quoted 3 lines

The perf lockup detector has a pile of things that make it pretty awkward and it seems like people have been toward the buddy detector because of this...

There's nothing awkward about the perf one, except that it takes one counter, and some people are just greedy and want all of them. At the same time, there are people posting patches that use the PMU for page-promotion like things, so these same greedy people are going to hate on that too.

#7 lore raw

Hi,

Quoted 12 lines · Peter Zijlstra
Quoted 11 lines
Quoted 3 lines

Yeah, this. I've run into this case waaay too many times to think it reasonable to remove the perf/NMI based lockup detector.

I am a bit curious how this comes to be in cases where you've seen it. What causes all CPUs to be stuck looping all with interrupts disabled (but still able to execute NMIs)? Certainly one can come up with a synthetic way to make that happen, but I would imagine it to be exceedingly rare in real life. Maybe all CPUs are deadlocked waiting on spinlocks or something? There shouldn't be a lot of other reasons that all CPUs should be stuck indefinitely with interrupts disabled...

Quoted 8 lines

The simplest one I often run into is rq->lock getting stuck and then all the other CPUs piling up on that in various ways.

Getting stop_machine() stuck is also a fun one.

I mean, it really isn't that hard. If, as a full time kernel dev, you don't get into this situation at least a few time a year, you're just not doing your job right ;-)

Wow, so I either suck at my job or I'm not a full time kernel dev? Ouch.

Quoted 9 lines
Quoted 6 lines

If that's what's happening, (just spitballing) I wonder if hooking into the slowpath of spinlocks to look for lockups would help? Maybe every 10000 failures to acquire the spinlock we check for a lockup? Obviously you could still come up with synthetic ways to make a non-caught watchdog, but hopefully in those types of cases we can at least reset the device with a hardware watchdog?

Now, why would I want to make the spinlock code worse if I have a perfectly functional NMI watchdog?

There's cost and tradeoffs everywhere. Using the perf-backed NMI watchdog has real downsides in terms of resource and power costs. Certainly touching the spinlock code would also have costs involved but, at least to this poor kernel engineer it doesn't seem like a forgone conclusion that one set of costs is better than the other.

Quoted 4 lines
Quoted 2 lines

Overall the issue is that it's really awkward to have both types of lockup detectors, especially since you've got to pick at compile time.

Well, then go fix that. Surely this isn't rocket science.

Looks like Jinchao has already sent a proposal for that.

Quoted 9 lines
Quoted 3 lines

The perf lockup detector has a pile of things that make it pretty awkward and it seems like people have been toward the buddy detector because of this...

There's nothing awkward about the perf one, except that it takes one counter, and some people are just greedy and want all of them. At the same time, there are people posting patches that use the PMU for page-promotion like things, so these same greedy people are going to hate on that too.

The weird cpufreq stuff that the perf detector needs to handle is awkward too. I suppose that plus the eating up of the perf counter (which gets awkward when you try to virtualize) is not exactly a pile. I think I was also remembering that people were trying to transition away from the perf detector for power saving reasons to save the extra wakeups/interrupts, but I guess that's not something *awkward* but just a plain-old normal downside...

-Doug