aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/lockdep.c
diff options
context:
space:
mode:
authorSteven Rostedt <srostedt@redhat.com>2011-04-20 21:41:56 -0400
committerIngo Molnar <mingo@elte.hu>2011-04-22 05:06:58 -0400
commit48702ecf308e53f176c1f6fdc193d622ded54ac0 (patch)
treeaa348b35b3a97fd9a5230e145ea4e6186ab2a978 /kernel/lockdep.c
parentf4185812aa046ecb97e8817e10148cacdd7a6baa (diff)
lockdep: Print a nicer description for simple deadlocks
Lockdep output can be pretty cryptic, having nicer output can save a lot of head scratching. When a simple deadlock scenario is detected by lockdep (lock A -> lock A) we now get the following new output: other info that might help us debug this: Possible unsafe locking scenario: CPU0 ---- lock(&(lock)->rlock); lock(&(lock)->rlock); *** DEADLOCK *** Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Andrew Morton <akpm@linux-foundation.org> Link: http://lkml.kernel.org/r/20110421014259.643930104@goodmis.org Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel/lockdep.c')
-rw-r--r--kernel/lockdep.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 73cebd7aa71..c4cc5d1acf4 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -1664,6 +1664,26 @@ static inline void inc_chains(void)
1664 1664
1665#endif 1665#endif
1666 1666
1667static void
1668print_deadlock_scenario(struct held_lock *nxt,
1669 struct held_lock *prv)
1670{
1671 struct lock_class *next = hlock_class(nxt);
1672 struct lock_class *prev = hlock_class(prv);
1673
1674 printk(" Possible unsafe locking scenario:\n\n");
1675 printk(" CPU0\n");
1676 printk(" ----\n");
1677 printk(" lock(");
1678 __print_lock_name(prev);
1679 printk(");\n");
1680 printk(" lock(");
1681 __print_lock_name(next);
1682 printk(");\n");
1683 printk("\n *** DEADLOCK ***\n\n");
1684 printk(" May be due to missing lock nesting notation\n\n");
1685}
1686
1667static int 1687static int
1668print_deadlock_bug(struct task_struct *curr, struct held_lock *prev, 1688print_deadlock_bug(struct task_struct *curr, struct held_lock *prev,
1669 struct held_lock *next) 1689 struct held_lock *next)
@@ -1682,6 +1702,7 @@ print_deadlock_bug(struct task_struct *curr, struct held_lock *prev,
1682 print_lock(prev); 1702 print_lock(prev);
1683 1703
1684 printk("\nother info that might help us debug this:\n"); 1704 printk("\nother info that might help us debug this:\n");
1705 print_deadlock_scenario(next, prev);
1685 lockdep_print_held_locks(curr); 1706 lockdep_print_held_locks(curr);
1686 1707
1687 printk("\nstack backtrace:\n"); 1708 printk("\nstack backtrace:\n");