Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2111516imu; Thu, 10 Jan 2019 08:27:42 -0800 (PST) X-Google-Smtp-Source: ALg8bN4c1fBiOkePE9xxRYpZeEdVxFN7GKKi0P+zn8Tik7YS/brzBtO2GWUDeeQHbZ7t74UHuvzB X-Received: by 2002:a17:902:bd86:: with SMTP id q6mr10627431pls.16.1547137662416; Thu, 10 Jan 2019 08:27:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1547137662; cv=none; d=google.com; s=arc-20160816; b=cTrC0mkiBcLY/jloSoSwrRueLBiKVRem2fzSdd9lcacY+wnpuPbL/va7lr8GLMEIZP ffGg62JVeUib5MhrqAEG5WGSc0RvzsAcdzKef+t/BOCQ3A+CJzc5204KP/BGBvDbVRcD fSKptTICBD985xmdWy66EZZ48yC8bvvzUL4p1KedQtkcFbwDBywVBeiVoWFGVacrEj8E fJVKaDrpJfXfIBvcyHEH5Yk7oKyUzxDd/IF9H6m5meYJFwIvOvoL+Kx4512vkSo5Cq6L JMW0fHUz/8G+0AMe/NPYV43s8IBIQ40PQlEp550NAUoI3HuZb3En5FkF9RL8oWUHTIsq mmYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date; bh=yAZ6KFzu6+xUpHQ7pDjIP3ld+/AGPP0Wu3yR3nvD3U8=; b=lChfKf60LeR6wNIN/jYy1XfFR6aqOtTzclRG89Y069ljoWQAwVhWKZNsgXzBlg0XVa JXKwY3gIpccGJ67dacN4yzqxDg8I123k45l34A9GxTCNoUuKVy6GXtDfp01/cMxz0M2Y M2VRnkFWFxaclvD0pb5BfTxdAQojVIjXCvgBqygxkDY0QHD7v2HSmKZLh6X2PwVviJQD S5S1m7pUxidvSM+v+SFulPN0nIu8A+yll/q9AG7edo6oCPiRUnICAO0hw0MXThpgn5sV U6UzAGjj7WWncOacf1WAomJll9lubU++xHR2HaI6N8CqY/wcNHmzJMK41Mp/2ZAz0ry6 aG3A== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f95si19681252plb.60.2019.01.10.08.27.27; Thu, 10 Jan 2019 08:27:42 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729244AbfAJOk5 (ORCPT + 99 others); Thu, 10 Jan 2019 09:40:57 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:34338 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1729081AbfAJOk4 (ORCPT ); Thu, 10 Jan 2019 09:40:56 -0500 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id x0AEaB0X095568 for ; Thu, 10 Jan 2019 09:40:55 -0500 Received: from e16.ny.us.ibm.com (e16.ny.us.ibm.com [129.33.205.206]) by mx0b-001b2d01.pphosted.com with ESMTP id 2px7y106gb-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Thu, 10 Jan 2019 09:40:54 -0500 Received: from localhost by e16.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 10 Jan 2019 14:40:54 -0000 Received: from b01cxnp22035.gho.pok.ibm.com (9.57.198.25) by e16.ny.us.ibm.com (146.89.104.203) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Thu, 10 Jan 2019 14:40:49 -0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22035.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x0AEemd721692514 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Thu, 10 Jan 2019 14:40:49 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CD78CB205F; Thu, 10 Jan 2019 14:40:48 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 9B349B2067; Thu, 10 Jan 2019 14:40:48 +0000 (GMT) Received: from paulmck-ThinkPad-W541 (unknown [9.70.82.88]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 10 Jan 2019 14:40:48 +0000 (GMT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 5A0B216C5F90; Thu, 10 Jan 2019 06:40:49 -0800 (PST) Date: Thu, 10 Jan 2019 06:40:49 -0800 From: "Paul E. McKenney" To: Andrea Parri Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, mingo@kernel.org, stern@rowland.harvard.edu, parri.andrea@gmail.com, will.deacon@arm.com, peterz@infradead.org, boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, willy@infradead.org Subject: Re: [PATCH RFC LKMM 7/7] tools/memory-model: Dynamically check SRCU lock-to-unlock matching Reply-To: paulmck@linux.ibm.com References: <20190109210706.GA27268@linux.ibm.com> <20190109210748.29074-7-paulmck@linux.ibm.com> <20190110094131.GA11647@andrea> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190110094131.GA11647@andrea> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 19011014-0072-0000-0000-000003E7DEF3 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010379; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000274; SDB=6.01144481; UDB=6.00595912; IPR=6.00924745; MB=3.00025068; MTD=3.00000008; XFM=3.00000015; UTC=2019-01-10 14:40:53 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19011014-0073-0000-0000-00004AC1F6FB Message-Id: <20190110144049.GK1215@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-01-10_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1901100115 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jan 10, 2019 at 10:41:31AM +0100, Andrea Parri wrote: > On Wed, Jan 09, 2019 at 01:07:48PM -0800, Paul E. McKenney wrote: > > From: Luc Maranget > > > > This commit checks that the return value of srcu_read_lock() is passed > > to the matching srcu_read_unlock(), where "matching" is determined by > > nesting. This check operates as follows: > > > > 1. srcu_read_lock() creates an integer token, which is stored into > > the generated events. > > 2. srcu_read_unlock() records its second (token) argument into the > > generated event. > > 3. A new herd primitive 'different-values' filters out pairs of events > > with identical values from the relation passed as its argument. > > 4. The bell file applies the above primitive to the (srcu) > > read-side-critical-section relation 'srcu-rscs' and flags non-empty > > results. > > > > BEWARE: Works only with herd version 7.51+6 and onwards. > > > > Signed-off-by: Luc Maranget > > Signed-off-by: Paul E. McKenney > > [ paulmck: Apply Andrea Parri's off-list feedback. ] > > --- > > tools/memory-model/linux-kernel.bell | 3 +++ > > tools/memory-model/linux-kernel.cat | 2 ++ > > tools/memory-model/linux-kernel.def | 2 +- > > 3 files changed, 6 insertions(+), 1 deletion(-) > > > > diff --git a/tools/memory-model/linux-kernel.bell b/tools/memory-model/linux-kernel.bell > > index 9c42cd9ddcb4..def9131d3d8e 100644 > > --- a/tools/memory-model/linux-kernel.bell > > +++ b/tools/memory-model/linux-kernel.bell > > @@ -73,3 +73,6 @@ flag ~empty Srcu-unlock \ range(srcu-rscs) as unbalanced-srcu-locking > > > > (* Check for use of synchronize_srcu() inside an RCU critical section *) > > flag ~empty rcu-rscs & (po ; [Sync-srcu] ; po) as invalid-sleep > > + > > +(* Validate SRCU dynamic match *) > > +flag ~empty different-values(srcu-rscs) as srcu-bad-nesting > > diff --git a/tools/memory-model/linux-kernel.cat b/tools/memory-model/linux-kernel.cat > > index 8dcb37835b61..95bf45f1215f 100644 > > --- a/tools/memory-model/linux-kernel.cat > > +++ b/tools/memory-model/linux-kernel.cat > > @@ -1,5 +1,7 @@ > > // SPDX-License-Identifier: GPL-2.0+ > > (* > > + * Requires herd version 7.51+6 or higher. > > I'm not all that exited about spreading version requirements in the > source: we report this requirement in our README, and apparently we > already struggle to keep this information up-to-date. So what about > squashing something like the below (assume that 7.52 will be released > by the time this patch hit mainline; if this won't be the case, we > may consider using the development version 7.51+6)? notice that this > also removes an (obsolete, at this point) comment from lock.cat. Sounds like a very good point to me! Should have pointers in the various files to the README file? Or maybe get people used to using scripting that checks versions? Or maybe after answering questions for some time, people will get used to checking versions? Thanx, Paul > Andrea > > diff --git a/tools/memory-model/README b/tools/memory-model/README > index 9d7d4f23503fd..b362a41358fa1 100644 > --- a/tools/memory-model/README > +++ b/tools/memory-model/README > @@ -20,8 +20,8 @@ that litmus test to be exercised within the Linux kernel. > REQUIREMENTS > ============ > > -Version 7.49 of the "herd7" and "klitmus7" tools must be downloaded > -separately: > +Version 7.52 or higher of the "herd7" and "klitmus7" tools must be > +downloaded separately: > > https://github.com/herd/herdtools7 > > diff --git a/tools/memory-model/linux-kernel.cat b/tools/memory-model/linux-kernel.cat > index 95bf45f1215fc..8dcb37835b613 100644 > --- a/tools/memory-model/linux-kernel.cat > +++ b/tools/memory-model/linux-kernel.cat > @@ -1,7 +1,5 @@ > // SPDX-License-Identifier: GPL-2.0+ > (* > - * Requires herd version 7.51+6 or higher. > - * > * Copyright (C) 2015 Jade Alglave , > * Copyright (C) 2016 Luc Maranget for Inria > * Copyright (C) 2017 Alan Stern , > diff --git a/tools/memory-model/lock.cat b/tools/memory-model/lock.cat > index 305ded17e7411..a059d1a6d8a29 100644 > --- a/tools/memory-model/lock.cat > +++ b/tools/memory-model/lock.cat > @@ -6,9 +6,6 @@ > > (* > * Generate coherence orders and handle lock operations > - * > - * Warning: spin_is_locked() crashes herd7 versions strictly before 7.48. > - * spin_is_locked() is functional from herd7 version 7.49. > *) > > include "cross.cat" > > > > > + * > > * Copyright (C) 2015 Jade Alglave , > > * Copyright (C) 2016 Luc Maranget for Inria > > * Copyright (C) 2017 Alan Stern , > > diff --git a/tools/memory-model/linux-kernel.def b/tools/memory-model/linux-kernel.def > > index 1d6a120cde14..0c3f0ef486f4 100644 > > --- a/tools/memory-model/linux-kernel.def > > +++ b/tools/memory-model/linux-kernel.def > > @@ -49,7 +49,7 @@ synchronize_rcu_expedited() { __fence{sync-rcu}; } > > > > // SRCU > > srcu_read_lock(X) __srcu{srcu-lock}(X) > > -srcu_read_unlock(X,Y) { __srcu{srcu-unlock}(X); } > > +srcu_read_unlock(X,Y) { __srcu{srcu-unlock}(X,Y); } > > synchronize_srcu(X) { __srcu{sync-srcu}(X); } > > > > // Atomic > > -- > > 2.17.1 > > >