public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@elte.hu>,
	Andrew Morton <akpm@linux-foundation.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>
Subject: [PATCH 6/7] lockdep: Print a nice description of simple irq inversion
Date: Wed, 20 Apr 2011 21:41:59 -0400	[thread overview]
Message-ID: <20110421014300.436140880@goodmis.org> (raw)
In-Reply-To: 20110421014153.126662477@goodmis.org

[-- Attachment #1: 0006-lockdep-Print-a-nice-description-of-simple-irq-inver.patch --]
[-- Type: text/plain, Size: 1781 bytes --]

From: Steven Rostedt <srostedt@redhat.com>

The lockdep output can be pretty cryptic, having a nice 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 get the following output:

other info that might help us debug this:
 Possible unsafe locking scenario:

       CPU0
       ----
  lock(lockA);
  <Interrupt>
    lock(lockA);

 *** DEADLOCK ***

Acked-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/lockdep.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index b531c66..3b1ac92 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2158,6 +2158,24 @@ static void check_chain_key(struct task_struct *curr)
 #endif
 }
 
+static void
+print_usage_bug_scenario(struct held_lock *lock)
+{
+	struct lock_class *class = hlock_class(lock);
+
+	printk(" Possible unsafe locking scenario:\n\n");
+	printk("       CPU0\n");
+	printk("       ----\n");
+	printk("  lock(");
+	__print_lock_name(class);
+	printk(");\n");
+	printk("  <Interrupt>\n");
+	printk("    lock(");
+	__print_lock_name(class);
+	printk(");\n");
+	printk("\n *** DEADLOCK ***\n\n");
+}
+
 static int
 print_usage_bug(struct task_struct *curr, struct held_lock *this,
 		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,
 
 	print_irqtrace_events(curr);
 	printk("\nother info that might help us debug this:\n");
+	print_usage_bug_scenario(this);
+
 	lockdep_print_held_locks(curr);
 
 	printk("\nstack backtrace:\n");
-- 
1.7.2.3



  parent reply	other threads:[~2011-04-21  1:44 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-21  1:41 [PATCH 0/7] [GIT PULL] lockdep: Show description of lockdep problems Steven Rostedt
2011-04-21  1:41 ` [PATCH 1/7] lockdep: Print a nice description of an irq locking issue Steven Rostedt
2011-04-21  6:43   ` Yong Zhang
2011-04-21  7:02   ` Yong Zhang
2011-04-21  7:08     ` Yong Zhang
2011-04-21 11:40     ` Steven Rostedt
2011-04-21 13:35       ` Yong Zhang
2011-04-21 14:24         ` Steven Rostedt
2011-04-22  1:41           ` Yong Zhang
2011-04-22  2:34             ` Steven Rostedt
2011-04-22  6:10               ` Ingo Molnar
2011-04-22 12:19   ` [tip:core/locking] lockdep: Print a nicer description for irq lock inversions tip-bot for Steven Rostedt
2011-04-21  1:41 ` [PATCH 2/7] lockdep: Print a nice description of normal deadlocks Steven Rostedt
2011-04-22 12:20   ` [tip:core/locking] lockdep: Print a nicer description for " tip-bot for Steven Rostedt
2011-04-21  1:41 ` [PATCH 3/7] lockdep: Print a nice description of simple deadlock Steven Rostedt
2011-04-22 12:20   ` [tip:core/locking] lockdep: Print a nicer description for simple deadlocks tip-bot for Steven Rostedt
2011-04-21  1:41 ` [PATCH 4/7] lockdep: Printk nice description for irq inversion bug Steven Rostedt
2011-04-22 12:20   ` [tip:core/locking] lockdep: Print a nicer description for irq inversion bugs tip-bot for Steven Rostedt
2011-04-21  1:41 ` [PATCH 5/7] lockdep: Replace bad path error message with something sane Steven Rostedt
2011-04-22 12:21   ` [tip:core/locking] lockdep: Replace "Bad BFS generated tree" message with something less cryptic tip-bot for Steven Rostedt
2011-04-21  1:41 ` Steven Rostedt [this message]
2011-04-22 12:21   ` [tip:core/locking] lockdep: Print a nicer description for simple irq lock inversions tip-bot for Steven Rostedt
2011-04-21  1:42 ` [PATCH 7/7] lockdep: Remove cmpxchg to update nr_chain_hlocks Steven Rostedt
2011-04-21  6:50   ` Yong Zhang
2011-04-22 12:22   ` [tip:core/locking] " tip-bot for Steven Rostedt
2011-04-21  6:25 ` [PATCH 0/7] [GIT PULL] lockdep: Show description of lockdep problems Yong Zhang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110421014300.436140880@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=a.p.zijlstra@chello.nl \
    --cc=akpm@linux-foundation.org \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox