Skip to contentSkip to conversation

hung task: NMI when hung and going to panic

PATCH In review Sasha Levin 1 participant 2 messages Mar 15, 2012 – Apr 25, 2012 Hung task detector

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hung task: NMI when hung and going to panic

NMI all CPUs when detected a hung task and the hung task code is configured to panic.

This lets us get stack trace of all CPUs which makes life easier trying to debug a deadlock, and the NMI doesn't change anything since the next step is a kernel panic.

---
 kernel/hung_task.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
kernel/hung_task.c +3 -1
index c21449f..6df6149 100644
@@ -108,8 +108,10 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
 
 	touch_nmi_watchdog();
 
-	if (sysctl_hung_task_panic)
+	if (sysctl_hung_task_panic) {
+		trigger_all_cpu_backtrace();
 		panic("hung_task: blocked tasks");
+	}
 }
 
 /*
Signature · 1 line
1.7.8.4
#1 lore raw

[tip:core/locking] hung task debugging: Inject NMI when hung and going to panic

Commit-ID:  625056b65ee9a8b4caf42136e0c844c15e6ec54f
Gitweb:     http://git.kernel.org/tip/625056b65ee9a8b4caf42136e0c844c15e6ec54f
Author:     Sasha Levin <[email protected]>
AuthorDate: Thu, 15 Mar 2012 17:47:20 -0400
Committer:  Ingo Molnar <[email protected]>
CommitDate: Wed, 25 Apr 2012 12:39:25 +0200

hung task debugging: Inject NMI when hung and going to panic

Send an NMI to all CPUs when a hung task is detected and the hung task code is configured to panic. This gives us a fairly uptodate snapshot of all CPUs in the system.

This lets us get stack trace of all CPUs which makes life easier trying to debug a deadlock, and the NMI doesn't change anything since the next step is a kernel panic.

Cc Linus Torvalds <[email protected]>
Cc Andrew Morton <[email protected]>
[ extended the changelog a bit ]
---
 kernel/hung_task.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)
kernel/hung_task.c +3 -1
index c21449f..6df6149 100644
@@ -108,8 +108,10 @@ static void check_hung_task(struct task_struct *t, unsigned long timeout)
 
 	touch_nmi_watchdog();
 
-	if (sysctl_hung_task_panic)
+	if (sysctl_hung_task_panic) {
+		trigger_all_cpu_backtrace();
 		panic("hung_task: blocked tasks");
+	}
 }
 
 /*