public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Yong Zhang <yong.zhang0@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-kernel@vger.kernel.org, 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: Re: [PATCH 1/7] lockdep: Print a nice description of an irq locking issue
Date: Thu, 21 Apr 2011 21:35:41 +0800	[thread overview]
Message-ID: <20110421133541.GB2702@zhy> (raw)
In-Reply-To: <1303386029.7181.118.camel@gandalf.stny.rr.com>

On Thu, Apr 21, 2011 at 07:40:29AM -0400, Steven Rostedt wrote:
> On Thu, 2011-04-21 at 15:02 +0800, Yong Zhang wrote:
> > On Thu, Apr 21, 2011 at 9:41 AM, Steven Rostedt <rostedt@goodmis.org> wrote:
> > >  ---
> > >
> > > The above is the case when the unsafe lock is taken while holding
> > > a lock taken in irq context. But when a lock is taken that also
> > > grabs a unsafe lock, the call chain is shown:
> > >
> > >  ---
> > > other info that might help us debug this:
> > >
> > > Chain exists of:
> > >  &rq->lock --> lockA --> lockC
> > >
> > >  Possible interrupt unsafe locking scenario:
> > >
> > >       CPU0                    CPU1
> > >       ----                    ----
> > >  lock(lockC);
> > >                               local_irq_disable();
> > >                               lock(&rq->lock);
> > >                               lock(lockA);
> > >  <Interrupt>
> > >    lock(&rq->lock);
> > >
> > >  *** DEADLOCK ***
> > 
> > Or we could show this:
> > Chain exists of:
> > &rq->lock --> lockA --> lockC
> > 
> >  Possible interrupt unsafe locking scenario:
> > 
> >       CPU0                    CPU1                           CPU2
> >       ----                    ----                                     ----
> >  lock(lockC);
> >                               local_irq_disable();
> >                               lock(&rq->lock);            lock(lockA);
> >                               lock(lockA);                   lock(lockC);
> >  <Interrupt>
> >    lock(&rq->lock);
> > 
> >  *** DEADLOCK ***
> 
> 
> We could but I prefer not to ;) We have some chains that are 8 locks
> deep. I really don't want to scatter that entirely across the screen.
> Hence my "Chain exists.." statement, following an example that any
> kernel developer can (with a little thinking) see is a possible
> deadlock.

Yup :)

> 
> In fact, this code doesn't even look at the full chain, it only examines
> 3 locks in the chain, and lets the developer figure out the rest.

OK, fair enough.

> I
> could show the entire chain too.

Sure :)

Thanks,
Yong

  reply	other threads:[~2011-04-21 13:35 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 [this message]
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 ` [PATCH 6/7] lockdep: Print a nice description of simple irq inversion Steven Rostedt
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=20110421133541.GB2702@zhy \
    --to=yong.zhang0@gmail.com \
    --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=rostedt@goodmis.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