Skip to contentSkip to conversation

Add WARN() function call to hard-soft lockup

PATCH Superseded Jeffrey Merkey 1 participant 1 message Feb 1, 2016

v1 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 Add WARN() function call to hard-soft lockup

This patch series adds config options which can be set during compile to direct the compiler to output a breakpoint instruction anywhere a BUG_XX() or WANR_XX() macro has been placed in the kernel to trigger the system to enter a debugger if a bug is detected by the system. Use of this compile time option also allows conditional breakpoints to be set in the kernel where these macros have been previously placed.

This addition is extremely useful for debugging hard and soft lockups real time and quickly from a console debugger, and other areas of the kernel.

---
 kernel/watchdog.c | 5 +++++
 1 file changed, 5 insertions(+)
kernel/watchdog.c +5 -0
index b3ace6e..af07a83 100644
@@ -358,6 +358,8 @@ static void watchdog_overflow_callback(struct perf_event *event,
 		else
 			dump_stack();
 
+		WARN(1, "Watchdog detected hard LOCKUP on cpu %d", this_cpu);
+
 		/*
 		 * Perform all-CPU dump only once to avoid multiple hardlockups
 		 * generating interleaving traces
@@ -478,6 +480,9 @@ static enum hrtimer_restart watchdog_timer_fn(struct hrtimer *hrtimer)
 		else
 			dump_stack();
 
+		WARN(1, "Watchdog detected soft LOCKUP on cpu %d",
+			smp_processor_id());
+
 		if (softlockup_all_cpu_backtrace) {
 			/* Avoid generating two back traces for current
 			 * given that one is already made above
Signature · 1 line
1.8.3.1