mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Peter Zijlstra <peterz@infradead.org>
Subject: Re: [RFC][PATCH] lockdep: Print a nice description of an irq locking issue
Date: Tue, 29 Mar 2011 13:20:14 -0400	[thread overview]
Message-ID: <1301419214.14261.289.camel@gandalf.stny.rr.com> (raw)
In-Reply-To: <1301418845.14261.284.camel@gandalf.stny.rr.com>

On Tue, 2011-03-29 at 13:14 -0400, Steven Rostedt wrote:
>    
>      ---
>     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 ***
>     

Note, the above output is real. To produce this output, I wrote a module
that created a "lockA", "lockB" and "lockC" and had the following:

        spin_lock_irq(&lockA);
        spin_lock(&lockB);
        spin_unlock(&lockB);
        spin_unlock_irq(&lockA);

        spin_lock_irq(&lockB);
        spin_lock(&lockC);
        spin_unlock(&lockC);
        spin_unlock_irq(&lockB);

        spin_lock(&lockC);
        spin_unlock(&lockC);
        ret = register_trace_sched_switch(probe_switch, NULL);

static void
probe_switch(void *ignore, struct task_struct *p, struct task_struct *n)
{
        unsigned long flags;

        spin_lock_irqsave(&lockA, flags);
        spin_unlock_irqrestore(&lockA, flags);
}


probe_switch is called via the trace_sched_switch() trace point that is
called with the rq lock held, producing the call chain that will trigger
lockdep to produce a dump.

-- Steve





  reply	other threads:[~2011-03-29 17:20 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-29 17:14 Steven Rostedt
2011-03-29 17:20 ` Steven Rostedt [this message]
2011-03-29 18:21 ` Ingo Molnar
2011-03-29 18:21   ` Ingo Molnar
2011-03-29 19:09     ` Steven Rostedt
2011-03-29 19:53 ` Thomas Gleixner

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=1301419214.14261.289.camel@gandalf.stny.rr.com \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    /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

all inboxes | Powered by JetHome®