public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: peterz@infradead•org (Peter Zijlstra)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH] mutex: make mutex_lock_nested an inline function
Date: Wed, 14 Oct 2015 15:47:21 +0200	[thread overview]
Message-ID: <20151014134721.GD3816@twins.programming.kicks-ass.net> (raw)
In-Reply-To: <20151014123624.GV14956@sirena.org.uk>

On Wed, Oct 14, 2015 at 01:36:24PM +0100, Mark Brown wrote:

> Sure, but I don't really expect to have to trawl the implementation of
> an API to find out about this sort of thing (I hadn't even been aware

I more like view header files as 'documentation' and c files as
implementation :-)

> that the subclasses were required to be small positive integers, never
> mind needing to check what the limit was).  I think the main place I'd
> have expected to see it was in lockdep-design.txt or somewhere near
> that.

Oh, you're one of them people that actually looks in Documentation/.

> The other big one that came up recently was that lockdep apparently
> works out what a class is by looking at the point of allocation which
> causes a lot of problems for regmap since it makes all regmap locks look
> like a single class.  That's fixed now by explicitly allocating a class
> per regmap with some macro magic but it was a bit of a surprise.  The
> documentation doesn't make this obvious.

Yes, Documentation/locking/lockdep-design.txt needs help -- I'd even
forgotten we had it.

Does the below work for you?

---
 Documentation/locking/lockdep-design.txt | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/Documentation/locking/lockdep-design.txt b/Documentation/locking/lockdep-design.txt
index 5001280e9d82..e8e9ad4e6f5e 100644
--- a/Documentation/locking/lockdep-design.txt
+++ b/Documentation/locking/lockdep-design.txt
@@ -24,6 +24,10 @@ a lock-class is used for the first time after bootup it gets registered,
 and all subsequent uses of that lock-class will be attached to this
 lock-class.
 
+A class is typically associated with a lock's initialisation site; although
+its possible to explicitly initialize a lock with a different class key --
+such class keys much come from static storage.
+
 State
 -----
 
@@ -165,6 +169,10 @@ partition.
 The validator treats a lock that is taken in such a nested fashion as a
 separate (sub)class for the purposes of validation.
 
+Since lock classes are associated with static addresses, the size of struct
+lock_class_key determines the amount of sub classes that are possible --
+currently set to 8.
+
 Note: When changing code to use the _nested() primitives, be careful and
 check really thoroughly that the hierarchy is correctly mapped; otherwise
 you can get false positives or false negatives.

  reply	other threads:[~2015-10-14 13:47 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-13 20:30 [PATCH] mutex: make mutex_lock_nested an inline function Arnd Bergmann
2015-10-13 20:38 ` Peter Zijlstra
2015-10-13 21:46   ` Arnd Bergmann
2015-10-14  8:20     ` Peter Zijlstra
2015-10-14  8:37       ` Peter Zijlstra
2015-10-14  9:00         ` Arnd Bergmann
2015-10-14  9:08           ` Peter Zijlstra
2015-10-14  9:59             ` Mark Brown
2015-10-14 10:27       ` Mark Brown
2015-10-14 11:07         ` Peter Zijlstra
2015-10-14 12:36           ` Mark Brown
2015-10-14 13:47             ` Peter Zijlstra [this message]
2015-10-14 13:50               ` Peter Zijlstra
2015-10-14 13:58                 ` Ingo Molnar
2015-10-14 14:11               ` Mark Brown
2015-10-22 15:02     ` Arnd Bergmann
2015-10-22 15:09       ` Peter Zijlstra
2015-10-22 17:44         ` Russell King - ARM Linux
2015-10-27 18:13           ` Ingo Molnar

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=20151014134721.GD3816@twins.programming.kicks-ass.net \
    --to=peterz@infradead$(echo .)org \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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