From: Peter Zijlstra <peterz@infradead.org>
To: Boqun Feng <boqun.feng@gmail.com>
Cc: Ingo Molnar <mingo@redhat.com>, linux-kernel@vger.kernel.org
Subject: Re: [Question] lockdep: Is nested lock handled correctly?
Date: Mon, 10 Aug 2015 13:42:28 +0200 [thread overview]
Message-ID: <20150810114228.GY16853@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20150810095247.GA4606@fixme-laptop.cn.ibm.com>
On Mon, Aug 10, 2015 at 05:52:47PM +0800, Boqun Feng wrote:
> Hi Peter and Ingo,
>
> I'm now learning the code of lockdep and find that nested lock may not
> be handled correctly because we fail to take held_lock merging into
> consideration. I come up with an example and hope that could explain my
> concern.
>
> Please consider this lock/unlock sequence, I also put a patch ading this
> sequence as a test into locking-selftest:
>
> (lock_X1 and lock_X2 belong to the same lock class X, lock_Y1 belongs to
> another lock class Y)
>
> spin_lock(&lock_X1);
> spin_lock(&lock_Y1);
> spin_lock_nested_lock(&lock_X2, &lock_X1);
> spin_unlock(&lock_Y1);
> spin_unlock(&lock_X2);
> spin_unlock(&lock_X1);
>
>
> This is totally legal in current lockdep rules, right?
Yuck, I'd say no. That's quite horrible.
Why would you ever want to do that?
next prev parent reply other threads:[~2015-08-10 11:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-10 9:52 Boqun Feng
2015-08-10 11:42 ` Peter Zijlstra [this message]
2015-08-10 13:49 ` Boqun Feng
2015-08-10 14:24 ` Peter Zijlstra
2015-08-11 1:32 ` Boqun Feng
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=20150810114228.GY16853@twins.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=boqun.feng@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
/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
Powered by JetHome