From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751459AbdJEPGQ (ORCPT ); Thu, 5 Oct 2017 11:06:16 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:35294 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750965AbdJEPGP (ORCPT ); Thu, 5 Oct 2017 11:06:15 -0400 Date: Thu, 5 Oct 2017 08:06:06 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com Subject: Re: [PATCH tip/core/rcu 7/9] rcu: Pretend ->boost_mtx acquired legitimately Reply-To: paulmck@linux.vnet.ibm.com References: <20171004212915.GA10089@linux.vnet.ibm.com> <1507152575-11055-7-git-send-email-paulmck@linux.vnet.ibm.com> <20171005095059.5hm2pumwpv75gvuk@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171005095059.5hm2pumwpv75gvuk@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17100515-0056-0000-0000-000003D452DE X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007847; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000235; SDB=6.00926852; UDB=6.00466312; IPR=6.00707094; BA=6.00005623; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017407; XFM=3.00000015; UTC=2017-10-05 15:06:11 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17100515-0057-0000-0000-0000080B635E Message-Id: <20171005150606.GQ3521@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-05_07:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1710050211 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Oct 05, 2017 at 11:50:59AM +0200, Peter Zijlstra wrote: > On Wed, Oct 04, 2017 at 02:29:33PM -0700, Paul E. McKenney wrote: > > RCU priority boosting uses rt_mutex_init_proxy_locked() to initialize an > > rt_mutex structure in locked state held by some other task. When that > > other task releases it, lockdep complains (quite accurately, but a bit > > uselessly) that the other task never acquired it. This complaint can > > suppress other, more helpful, lockdep complaints, and in any case it is > > a false positive. > > > > This commit therefore uses the mutex_acquire() macro to make it look > > like that other process legitimately acquired the lock, thus suppressing > > this lockdep false-positive complaint. > > > > Of course, if lockdep ever learns about rt_mutex_init_proxy_locked(), > > this commit will need to be reverted. > > > > Signed-off-by: Paul E. McKenney > > This is a consequence of me doing: > > f5694788ad8d ("rt_mutex: Add lockdep annotations") > > Right? The timing matches, so I do believe this is the case. > > --- > > kernel/rcu/tree_plugin.h | 5 ++++- > > 1 file changed, 4 insertions(+), 1 deletion(-) > > > > diff --git a/kernel/rcu/tree_plugin.h b/kernel/rcu/tree_plugin.h > > index fed95fa941e6..60bfb16c9a1a 100644 > > --- a/kernel/rcu/tree_plugin.h > > +++ b/kernel/rcu/tree_plugin.h > > @@ -529,8 +529,11 @@ void rcu_read_unlock_special(struct task_struct *t) > > } > > > > /* Unboost if we were boosted. */ > > - if (IS_ENABLED(CONFIG_RCU_BOOST) && drop_boost_mutex) > > + if (IS_ENABLED(CONFIG_RCU_BOOST) && drop_boost_mutex) { > > + /* For lockdep, pretend we acquired lock honestly. */ > > + mutex_acquire(&rnp->boost_mtx.dep_map, 0, 0, _RET_IP_); > > rt_mutex_unlock(&rnp->boost_mtx); > > + } > > So I'm thinking the problem is that you're mixing rt_mutex and PI-futex > primitives here. As per commit: > > 5293c2efda37 ("futex,rt_mutex: Provide futex specific rt_mutex API") > > these are two separate APIs, that should, ideally, not be mixed. > > The 'right' counterpart to rt_mutex_init_proxy_locked() is > rt_mutex_futex_unlock() (which very much does not include lockdep bits). OK, will give this a try. It does at least seem to build, so I guess that is a good start. ;-) Thanx, Paul