From patchwork Wed Oct 14 13:47:21 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 7395691 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id B30DFBEEA4 for ; Wed, 14 Oct 2015 13:49:05 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CA9B420802 for ; Wed, 14 Oct 2015 13:49:04 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E5C6020776 for ; Wed, 14 Oct 2015 13:49:03 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZmMOt-0005m4-3v; Wed, 14 Oct 2015 13:47:27 +0000 Received: from 178-85-85-44.dynamic.upc.nl ([178.85.85.44] helo=twins) by bombadil.infradead.org with esmtpsa (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZmMOq-0005kU-Oz; Wed, 14 Oct 2015 13:47:24 +0000 Received: by twins (Postfix, from userid 1000) id E6E2D103B3E82; Wed, 14 Oct 2015 15:47:21 +0200 (CEST) Date: Wed, 14 Oct 2015 15:47:21 +0200 From: Peter Zijlstra To: Mark Brown Subject: Re: [PATCH] mutex: make mutex_lock_nested an inline function Message-ID: <20151014134721.GD3816@twins.programming.kicks-ass.net> References: <11282238.AHmyWliPRj@wuerfel> <20151013203812.GM17308@twins.programming.kicks-ass.net> <11817958.z9KtmeKzV7@wuerfel> <20151014082050.GQ17308@twins.programming.kicks-ass.net> <20151014102706.GR14956@sirena.org.uk> <20151014110717.GT17308@twins.programming.kicks-ass.net> <20151014123624.GV14956@sirena.org.uk> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20151014123624.GV14956@sirena.org.uk> User-Agent: Mutt/1.5.21 (2012-12-30) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Arnd Bergmann , Liam Girdwood , linux-kernel@vger.kernel.org, Sascha Hauer , akpm@linux-foundation.org, Ingo Molnar , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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? Reviewed-by: Mark Brown --- 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.