diff options
author | Steven Rostedt <srostedt@redhat.com> | 2011-04-20 21:41:59 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2011-04-22 05:06:59 -0400 |
commit | 282b5c2f6f663c008444321fd8fcdd374596046b (patch) | |
tree | 33d189c35bccdccfaef281a90afd3451c5ae115f | |
parent | 6be8c3935b914dfbc24b27c91c2b6d583645e61a (diff) |
lockdep: Print a nicer description for simple irq lock inversions
Lockdep output can be pretty cryptic, having nicer output
can save a lot of head scratching. When a simple irq inversion
scenario is detected by lockdep (lock A taken in interrupt
context but also in thread context without disabling interrupts)
we now get the following (hopefully more informative) output:
other info that might help us debug this:
Possible unsafe locking scenario:
CPU0
----
lock(lockA);
<Interrupt>
lock(lockA);
*** 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/20110421014300.436140880@goodmis.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | kernel/lockdep.c | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c index 270cfa405d39..27c609f3eae5 100644 --- a/kernel/lockdep.c +++ b/kernel/lockdep.c | |||
@@ -2158,6 +2158,24 @@ static void check_chain_key(struct task_struct *curr) | |||
2158 | #endif | 2158 | #endif |
2159 | } | 2159 | } |
2160 | 2160 | ||
2161 | static void | ||
2162 | print_usage_bug_scenario(struct held_lock *lock) | ||
2163 | { | ||
2164 | struct lock_class *class = hlock_class(lock); | ||
2165 | |||
2166 | printk(" Possible unsafe locking scenario:\n\n"); | ||
2167 | printk(" CPU0\n"); | ||
2168 | printk(" ----\n"); | ||
2169 | printk(" lock("); | ||
2170 | __print_lock_name(class); | ||
2171 | printk(");\n"); | ||
2172 | printk(" <Interrupt>\n"); | ||
2173 | printk(" lock("); | ||
2174 | __print_lock_name(class); | ||
2175 | printk(");\n"); | ||
2176 | printk("\n *** DEADLOCK ***\n\n"); | ||
2177 | } | ||
2178 | |||
2161 | static int | 2179 | static int |
2162 | print_usage_bug(struct task_struct *curr, struct held_lock *this, | 2180 | print_usage_bug(struct task_struct *curr, struct held_lock *this, |
2163 | enum lock_usage_bit prev_bit, enum lock_usage_bit new_bit) | 2181 | enum lock_usage_bit prev_bit, enum lock_usage_bit new_bit) |
@@ -2186,6 +2204,8 @@ print_usage_bug(struct task_struct *curr, struct held_lock *this, | |||
2186 | 2204 | ||
2187 | print_irqtrace_events(curr); | 2205 | print_irqtrace_events(curr); |
2188 | printk("\nother info that might help us debug this:\n"); | 2206 | printk("\nother info that might help us debug this:\n"); |
2207 | print_usage_bug_scenario(this); | ||
2208 | |||
2189 | lockdep_print_held_locks(curr); | 2209 | lockdep_print_held_locks(curr); |
2190 | 2210 | ||
2191 | printk("\nstack backtrace:\n"); | 2211 | printk("\nstack backtrace:\n"); |