Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2055741imm; Mon, 28 May 2018 00:18:32 -0700 (PDT) X-Google-Smtp-Source: AB8JxZrwGxz+5S3dT+KBxbkZiaLz5j0BZt/tTxnq/S0okiiI57uT4Q2aTYeyi9CyQxwOvAkJLxK2 X-Received: by 2002:aa7:864d:: with SMTP id a13-v6mr12423298pfo.199.1527491912686; Mon, 28 May 2018 00:18:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527491912; cv=none; d=google.com; s=arc-20160816; b=nc1R5oZ+6QBk20iy/M3oZLsTvaaJ9ux3qeyHKbshQZNLUooE1/+J9Jv8mhVLlSYsRE C7nQ4BQUNtGAJ48LGpR6XqqK4pB/iDzJR1XCBjrxqJjxj9OtXYb3L2N+unrcrQYa8BNf DdxCMPL/zD6PZ/PkG5XPzDz0A3tyUAuDDjp2ZMlogmrK9/rkh73RVuecjg3TbJG0cQDw OWoYQluuAFJJE7jhcvdabvKwa7W1/Ki+vbrSrU10ehkEkDkgj3VBV6d02CLCxmiXPXXk GQTPEpzdq9fDTcuNcS8XmF3Xfs9oFtLBmlnsqqyumwSKDfmT7D9Bf9Q6nUbsYBs4iTZj d9OA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=kyPY1cw+cqeX2cYb/bFN9HqHlVOU+Af4jZR/xWaarL8=; b=hkBhnPyxoVHwImCNMo2eRzgeaEyPzSUyIpVKHnwjZvENQ940mcdXJJvJyKXyRmtKZq YK6LHEP/YxADpXO1Z+gzsd4NskxcVX3MDFj+tG1XI7qCNE0bqbMSxERCrZ2E4uYwRoof tnOhMPqT61rT/FJyKQXQgMywZbNHH/XsJWhYBSgy8PsdY2JdAjkbXEdF2PA5jKYSwBOa yMF9yLjqQcdadCrzPTXTznPAvOqM6YtElGMJ9WEmA/8BCL6J/KP6yCuswGU37GzKFKZr VrPFb9FceZ3hLOVQgKy0ojlvck/2fNh8eWlrh1yGreejsdMOnhLfKSbc33JFz3bDslFA T6uA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=OO5Tm7Yw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f5-v6si23245004pgo.69.2018.05.28.00.18.16; Mon, 28 May 2018 00:18:32 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=OO5Tm7Yw; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753922AbeE1HSH (ORCPT + 99 others); Mon, 28 May 2018 03:18:07 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:51556 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753695AbeE1HSE (ORCPT ); Mon, 28 May 2018 03:18:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20170209; h=In-Reply-To:Content-Type:MIME-Version :References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=kyPY1cw+cqeX2cYb/bFN9HqHlVOU+Af4jZR/xWaarL8=; b=OO5Tm7YweDCSPKFivguRaAj2z AU0TXaoAVRGq/lNbS4nCERChX79eKh4+CEeUExk6B5qgZ1avT4KzcQf1QRygCUKw8LuhAXYp5KdN+ eV7OL3JLplCcpCy2ogj3R8D7++drHnpWFF7vr9c6hkBLKZcET/fV5C04M+ereSdmFGNLTzJZc4kXd /TboDIhDReG6fiJnLX4ODlwAhiqWT97rKkjTnnPg4OZWp/0lZ00we3VY597l8xLm+8p5OrOhYr06Z yHAbnHqLK7+gX04ATt7QtBXdhpJsyDHMoCN9MUBsV/Caqqx9kNMg/f05oKAd+abxpvtAgUZuEX/Yo yn5vpcgoQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fNCPh-0004eO-RS; Mon, 28 May 2018 07:17:54 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 51E9F2029F1CA; Mon, 28 May 2018 09:17:51 +0200 (CEST) Date: Mon, 28 May 2018 09:17:51 +0200 From: Peter Zijlstra To: Joel Fernandes Cc: Peter Rosin , linux-kernel@vger.kernel.org, Wolfram Sang , Ingo Molnar , Will Deacon , Davidlohr Bueso , Philippe Ombredanne , Thomas Gleixner , Greg Kroah-Hartman , linux-i2c@vger.kernel.org, Peter Chang , Deepa Dinamani , John Sperbeck Subject: Re: [PATCH v3 1/2] rtmutex: allow specifying a subclass for nested locking Message-ID: <20180528071751.GT12180@hirez.programming.kicks-ass.net> References: <20180524135240.10881-1-peda@axentia.se> <20180524135240.10881-2-peda@axentia.se> <20180528051936.GA205298@joelaf.mtv.corp.google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180528051936.GA205298@joelaf.mtv.corp.google.com> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, May 27, 2018 at 10:19:36PM -0700, Joel Fernandes wrote: > > +static inline void __rt_mutex_lock(struct rt_mutex *lock, unsigned int subclass) > > +{ > > + might_sleep(); > > + > > + mutex_acquire(&lock->dep_map, subclass, 0, _RET_IP_); > > + rt_mutex_fastlock(lock, TASK_UNINTERRUPTIBLE, rt_mutex_slowlock); > > +} > > + > > +#ifdef CONFIG_DEBUG_LOCK_ALLOC > > +/** > > + * rt_mutex_lock_nested - lock a rt_mutex > > This ifdef seems consistent with other nested locking primitives, but its > kind of confusing. > > The Kconfig.debug for DEBUG_LOCK_ALLOC says: > > config DEBUG_LOCK_ALLOC > bool "Lock debugging: detect incorrect freeing of live locks" > [...] > help > This feature will check whether any held lock (spinlock, rwlock, > mutex or rwsem) is incorrectly freed by the kernel, via any of the > memory-freeing routines (kfree(), kmem_cache_free(), free_pages(), > vfree(), etc.), whether a live lock is incorrectly reinitialized via > spin_lock_init()/mutex_init()/etc., or whether there is any lock > held during task exit. > > Shouldn't this ideally be ifdef'd under PROVE_LOCKING for this and other > locking primitives? Any idea what's the reason? I know PROVE_LOCKING selects > DEBUG_LOCK_ALLOC but still.. No, the reason is that DEBUG_LOCK_ALLOC needs the lockdep hooks to know which locks are held, so it can warn when we try and free a held one. PROVE_LOCKING builds upon that. The the locking primitives should key off of DEBUG_LOCK_ALLOC for introducing the hooks.