Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1204184

Re: [Question] lockdep: Is nested lock handled correctly?

From Peter Zijlstra <peterz@infradead.org>
Newsgroups linux.kernel
Subject Re: [Question] lockdep: Is nested lock handled correctly?
Date 2015-08-10 13:50 +0200
Message-ID <pVTKx-5eW-1@gated-at.bofh.it> (permalink)
References <pVS27-2wD-39@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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?
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[Question] lockdep: Is nested lock handled correctly? Boqun Feng <boqun.feng@gmail.com> - 2015-08-10 12:00 +0200
  Re: [Question] lockdep: Is nested lock handled correctly? Peter Zijlstra <peterz@infradead.org> - 2015-08-10 13:50 +0200
    Re: [Question] lockdep: Is nested lock handled correctly? Boqun Feng <boqun.feng@gmail.com> - 2015-08-10 15:50 +0200
      Re: [Question] lockdep: Is nested lock handled correctly? Peter Zijlstra <peterz@infradead.org> - 2015-08-10 16:30 +0200
        Re: [Question] lockdep: Is nested lock handled correctly? Boqun Feng <boqun.feng@gmail.com> - 2015-08-11 03:40 +0200

csiph-web