diff options
author | Ingo Molnar <mingo@elte.hu> | 2008-01-25 15:08:02 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-01-25 15:08:02 -0500 |
commit | 82a1fcb90287052aabfa235e7ffc693ea003fe69 (patch) | |
tree | 826b464a248bebe259fe787f7b8d17d5626cf2c5 /include | |
parent | d0d23b5432fe61229dd3641c5e94d4130bc4e61b (diff) |
softlockup: automatically detect hung TASK_UNINTERRUPTIBLE tasks
this patch extends the soft-lockup detector to automatically
detect hung TASK_UNINTERRUPTIBLE tasks. Such hung tasks are
printed the following way:
------------------>
INFO: task prctl:3042 blocked for more than 120 seconds.
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message
prctl D fd5e3793 0 3042 2997
f6050f38 00000046 00000001 fd5e3793 00000009 c06d8264 c06dae80 00000286
f6050f40 f6050f00 f7d34d90 f7d34fc8 c1e1be80 00000001 f6050000 00000000
f7e92d00 00000286 f6050f18 c0489d1a f6050f40 00006605 00000000 c0133a5b
Call Trace:
[<c04883a5>] schedule_timeout+0x6d/0x8b
[<c04883d8>] schedule_timeout_uninterruptible+0x15/0x17
[<c0133a76>] msleep+0x10/0x16
[<c0138974>] sys_prctl+0x30/0x1e2
[<c0104c52>] sysenter_past_esp+0x5f/0xa5
=======================
2 locks held by prctl/3042:
#0: (&sb->s_type->i_mutex_key#5){--..}, at: [<c0197d11>] do_fsync+0x38/0x7a
#1: (jbd_handle){--..}, at: [<c01ca3d2>] journal_start+0xc7/0xe9
<------------------
the current default timeout is 120 seconds. Such messages are printed
up to 10 times per bootup. If the system has crashed already then the
messages are not printed.
if lockdep is enabled then all held locks are printed as well.
this feature is a natural extension to the softlockup-detector (kernel
locked up without scheduling) and to the NMI watchdog (kernel locked up
with IRQs disabled).
[ Gautham R Shenoy <ego@in.ibm.com>: CPU hotplug fixes. ]
[ Andrew Morton <akpm@linux-foundation.org>: build warning fix. ]
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Arjan van de Ven <arjan@linux.intel.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/debug_locks.h | 5 | ||||
-rw-r--r-- | include/linux/sched.h | 10 |
2 files changed, 15 insertions, 0 deletions
diff --git a/include/linux/debug_locks.h b/include/linux/debug_locks.h index 1678a5de7013..f4a5871767f5 100644 --- a/include/linux/debug_locks.h +++ b/include/linux/debug_locks.h | |||
@@ -47,6 +47,7 @@ struct task_struct; | |||
47 | 47 | ||
48 | #ifdef CONFIG_LOCKDEP | 48 | #ifdef CONFIG_LOCKDEP |
49 | extern void debug_show_all_locks(void); | 49 | extern void debug_show_all_locks(void); |
50 | extern void __debug_show_held_locks(struct task_struct *task); | ||
50 | extern void debug_show_held_locks(struct task_struct *task); | 51 | extern void debug_show_held_locks(struct task_struct *task); |
51 | extern void debug_check_no_locks_freed(const void *from, unsigned long len); | 52 | extern void debug_check_no_locks_freed(const void *from, unsigned long len); |
52 | extern void debug_check_no_locks_held(struct task_struct *task); | 53 | extern void debug_check_no_locks_held(struct task_struct *task); |
@@ -55,6 +56,10 @@ static inline void debug_show_all_locks(void) | |||
55 | { | 56 | { |
56 | } | 57 | } |
57 | 58 | ||
59 | static inline void __debug_show_held_locks(struct task_struct *task) | ||
60 | { | ||
61 | } | ||
62 | |||
58 | static inline void debug_show_held_locks(struct task_struct *task) | 63 | static inline void debug_show_held_locks(struct task_struct *task) |
59 | { | 64 | { |
60 | } | 65 | } |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 288245f83bd4..0846f1f9e196 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -258,12 +258,17 @@ extern void account_process_tick(struct task_struct *task, int user); | |||
258 | extern void update_process_times(int user); | 258 | extern void update_process_times(int user); |
259 | extern void scheduler_tick(void); | 259 | extern void scheduler_tick(void); |
260 | 260 | ||
261 | extern void sched_show_task(struct task_struct *p); | ||
262 | |||
261 | #ifdef CONFIG_DETECT_SOFTLOCKUP | 263 | #ifdef CONFIG_DETECT_SOFTLOCKUP |
262 | extern void softlockup_tick(void); | 264 | extern void softlockup_tick(void); |
263 | extern void spawn_softlockup_task(void); | 265 | extern void spawn_softlockup_task(void); |
264 | extern void touch_softlockup_watchdog(void); | 266 | extern void touch_softlockup_watchdog(void); |
265 | extern void touch_all_softlockup_watchdogs(void); | 267 | extern void touch_all_softlockup_watchdogs(void); |
266 | extern int softlockup_thresh; | 268 | extern int softlockup_thresh; |
269 | extern unsigned long sysctl_hung_task_check_count; | ||
270 | extern unsigned long sysctl_hung_task_timeout_secs; | ||
271 | extern long sysctl_hung_task_warnings; | ||
267 | #else | 272 | #else |
268 | static inline void softlockup_tick(void) | 273 | static inline void softlockup_tick(void) |
269 | { | 274 | { |
@@ -1041,6 +1046,11 @@ struct task_struct { | |||
1041 | /* ipc stuff */ | 1046 | /* ipc stuff */ |
1042 | struct sysv_sem sysvsem; | 1047 | struct sysv_sem sysvsem; |
1043 | #endif | 1048 | #endif |
1049 | #ifdef CONFIG_DETECT_SOFTLOCKUP | ||
1050 | /* hung task detection */ | ||
1051 | unsigned long last_switch_timestamp; | ||
1052 | unsigned long last_switch_count; | ||
1053 | #endif | ||
1044 | /* CPU-specific state of this task */ | 1054 | /* CPU-specific state of this task */ |
1045 | struct thread_struct thread; | 1055 | struct thread_struct thread; |
1046 | /* filesystem information */ | 1056 | /* filesystem information */ |