Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp2954625imm; Mon, 28 May 2018 20:51:27 -0700 (PDT) X-Google-Smtp-Source: AB8JxZquNPwm7wH9QG2btyB9B7DH8jib8JmbwG675J4sLcsTjX86bLZf+I689jYVOfEmTwrm0ngK X-Received: by 2002:a62:c987:: with SMTP id l7-v6mr15459295pfk.221.1527565887711; Mon, 28 May 2018 20:51:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527565887; cv=none; d=google.com; s=arc-20160816; b=FGs8ADeNjkuEebV4IA6Lmx0s71L02Q8rS4MpC37PmtqzS4dweVux0cRUiE1fn7lHXb eui1mMCkaxSc5uIxN2jHDj/YS0yzNevsGTsrqd7wo/A2RhsK2dTbbVtfKWSCPRaPUdLl XeWyblfGFcz/LD/GVuhY5UdJDQ95MgPKqDa094F9tvf/HM+Pwujm0FjTwnLmthoPCmQM TE6+1kWXAbbv/DfW4+Ag7kvRBqCzyVLCp/l5M6Cna98BJSNVSmCQnCMngD+7aUXVnmLq NEIn8VpIoWs/VL+9ehmasAhVgNCzV038YHze+xoCz8fE19zgyj3+j0XBRip1dpdemZs1 QC6w== 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=TnOQOY0tqne2TxHilLiEYkX+uAjuFTJtac6U5xRtcHU=; b=B6HKT8L7mou4DyQvv/NAdMez11AHE826hDMB7hdXUmWY8KI1JEvoqBvi5n8SUvUV/x sQl5KT85qU4F06lnM8QiFF6GUMho1/U9u7JJunOpnNhi2sKyq2sUSpvBq68XoDU29RTJ pAV8/QJxKH4sAJqnYZ7jlpW/+WZNrt+XwQLKBO1htB0AvyzdZv0EDebZbab9/4SDWoxS TUeZGUtLP7V8UD0LtkDjRLEpkgjxkdVbAcSNjFdhbEuFdQzeMk9k86P+o0gfOB6ACAa/ lgy+PoM/9DOEKWWf7VJrkVyBHalSJ/cCZkhFlncmttY0JiPhWlqZWZqqfB5b3sH53DBV ISkw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@joelfernandes.org header.s=google header.b=P+OMJ1w1; 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 33-v6si32115242plu.385.2018.05.28.20.51.13; Mon, 28 May 2018 20:51:27 -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=pass header.i=@joelfernandes.org header.s=google header.b=P+OMJ1w1; 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 S934103AbeE1Uvn (ORCPT + 99 others); Mon, 28 May 2018 16:51:43 -0400 Received: from mail-pl0-f68.google.com ([209.85.160.68]:33828 "EHLO mail-pl0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932451AbeE1Uvk (ORCPT ); Mon, 28 May 2018 16:51:40 -0400 Received: by mail-pl0-f68.google.com with SMTP id ay10-v6so7718018plb.1 for ; Mon, 28 May 2018 13:51:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=joelfernandes.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=TnOQOY0tqne2TxHilLiEYkX+uAjuFTJtac6U5xRtcHU=; b=P+OMJ1w1WpAa8e0x6rmCA9jcUmpvfOX9wr0gtNh2WScL95E2yASzsgWwAtc2bRUm2i TTy9qhPe9Pd9g9vEF+LetPJJpHDMwm2ovfPqeYykotCYvI1o6BXZCb9C1ZnpAznGAJmX fsp0H+SAffgHZmMhCJiMziQcbGEVGPnMOfJpM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=TnOQOY0tqne2TxHilLiEYkX+uAjuFTJtac6U5xRtcHU=; b=ZzF671wCfiEpHdEqj2QXi+KkbhRTQYzxmQ4hZ0ze1yw3SrannyOsq0B+6xa/clgTbn to/nt4s7JZo/Ux9I5T90bmUIF2ogLMDAgsDYTulrR9IR9WryDgRA7F3gcFmqZw4zDsfI LIbgZzzaTD6/h+yMffkyQGTxpM/YWfPlz4pyhI2+adJGgJEzOpjXEKpeHWKQwfMF6k4y Pfcz5AFwd4QVTv9SoS16Y9v8hj44gFTW5xzoezRSUhPoiCln2QMsdfFG4UynWTjGdmgl vPOYtC1I3CO7NbYmIj1/Ei74nASnJ30FOdYsFR1yy3t0dZKtTYE3qkz32wWUYhBUqeuI eEpg== X-Gm-Message-State: ALKqPwe4SDpvNTlmz1EwXmTlm8tHFNOJmzDg3YPW4TpdvDgQRasTs4a0 bknpOpuDmMO/6MmjwFtff+uJ7w== X-Received: by 2002:a17:902:7e05:: with SMTP id b5-v6mr14647765plm.230.1527540699630; Mon, 28 May 2018 13:51:39 -0700 (PDT) Received: from localhost ([2620:0:1000:1600:3122:ea9c:d178:eb]) by smtp.gmail.com with ESMTPSA id t3-v6sm18735869pgs.91.2018.05.28.13.51.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 May 2018 13:51:38 -0700 (PDT) Date: Mon, 28 May 2018 13:51:38 -0700 From: Joel Fernandes To: Peter Zijlstra 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: <20180528205138.GA189841@joelaf.mtv.corp.google.com> References: <20180524135240.10881-1-peda@axentia.se> <20180524135240.10881-2-peda@axentia.se> <20180528051936.GA205298@joelaf.mtv.corp.google.com> <20180528071751.GT12180@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180528071751.GT12180@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 28, 2018 at 09:17:51AM +0200, Peter Zijlstra wrote: > 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. Got it, thanks for the clarification Peter! Regards, -Joel