Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp22444imu; Wed, 12 Dec 2018 11:44:37 -0800 (PST) X-Google-Smtp-Source: AFSGD/U9xHMlHQiE9DX7zD5zTMGcMmqV/cpEtKoRn7VrOhTo6gEmzabAqf/yyNKSdVi+HTVRZJ0K X-Received: by 2002:a17:902:66e6:: with SMTP id e93mr20476065plk.92.1544643877404; Wed, 12 Dec 2018 11:44:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544643877; cv=none; d=google.com; s=arc-20160816; b=Rr5saCe9kfFRQ1ZLqp5bpspuiZZSOhSU98F5Y1EauPVL5DeA1Hc7IE+ZRtyoxhha22 mEGgFnNvLfa0StHogQVfQCURDHaAGCak855jxoDCvHjhap/l2XL2uUATJnD73/htYqu7 7p1jYnsig53tS7R88LX5V0t6e041Dgk5ULZnrrq3+DyIkzuZSIPa9FSI3le7WaTtIT9i rayGMab9J0vTwa7QMriWZzfGTsyl2J3aiUUPPshrQYtohi6LfZ3dI62zxpGsBa21TF5v lIlqm+Bsg+FdRCJLU/kYDF4j00FM0EU+fc6HYDtCn6uvLNRkkD/TnBf0ZFZ5JCrK9Jts nAvw== 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=rXfe6IyMge6Ofyk7cvljLD2FOSQ8grO0Zth9/ceLfRU=; b=IJ4lZ9nPY8IE5x8QcTVJkN3A7ErPcYVK4R2druHisKlLVIKmvqgjHv8sDktOlwSuMu lS7ZX9r1RZfPWapSWV8L32TWW1po9s/2uA76sBDgOQVzw3o/Zr27ieCJXW2Ft/0lSddb QvVXAxMBWdogcghA46cGDenmI/o9/v8qN8EA4UazZIeeCNZhOtkGI+dZ52uQJ8q+X3e/ VPvLsDJWAqJO1dbsBJ/loA0smvyFspbLooT7ttP1Gar0PUGrdid2m5pEYYJgp+Vm/Ilt i+cJkZRYc/WidaYiIkBR45iAJGA0u9eP14lIg/YIz8XXDKrKHdRYGfeTSkAqi0u8UtQb MVyA== 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 j39si15586636plb.272.2018.12.12.11.43.53; Wed, 12 Dec 2018 11:44:37 -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 S1726888AbeLLTmd (ORCPT + 99 others); Wed, 12 Dec 2018 14:42:33 -0500 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:52262 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726243AbeLLTmc (ORCPT ); Wed, 12 Dec 2018 14:42:32 -0500 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id wBCJbxcT004619 for ; Wed, 12 Dec 2018 14:42:31 -0500 Received: from e13.ny.us.ibm.com (e13.ny.us.ibm.com [129.33.205.203]) by mx0b-001b2d01.pphosted.com with ESMTP id 2pb8nn05sk-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Wed, 12 Dec 2018 14:42:30 -0500 Received: from localhost by e13.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 12 Dec 2018 19:42:30 -0000 Received: from b01cxnp22034.gho.pok.ibm.com (9.57.198.24) by e13.ny.us.ibm.com (146.89.104.200) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Wed, 12 Dec 2018 19:42:25 -0000 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id wBCJgOQl21233774 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 12 Dec 2018 19:42:24 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 64499B206B; Wed, 12 Dec 2018 19:42:24 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 4364DB2066; Wed, 12 Dec 2018 19:42:24 +0000 (GMT) Received: from paulmck-ThinkPad-W541 (unknown [9.70.82.38]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Wed, 12 Dec 2018 19:42:24 +0000 (GMT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 2EFFE16C341B; Wed, 12 Dec 2018 11:42:25 -0800 (PST) Date: Wed, 12 Dec 2018 11:42:25 -0800 From: "Paul E. McKenney" To: Alan Stern Cc: David Goldblatt , mathieu.desnoyers@efficios.com, Florian Weimer , triegel@redhat.com, libc-alpha@sourceware.org, andrea.parri@amarulasolutions.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, akiyks@gmail.com, dlustig@nvidia.com, linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] Linux: Implement membarrier function Reply-To: paulmck@linux.ibm.com References: <20181212170706.GA17397@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 18121219-0064-0000-0000-000003853F75 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00010215; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000270; SDB=6.01130821; UDB=6.00587636; IPR=6.00910955; MB=3.00024670; MTD=3.00000008; XFM=3.00000015; UTC=2018-12-12 19:42:29 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18121219-0065-0000-0000-00003BA7AF9F Message-Id: <20181212194225.GB4170@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-12-12_04:,, 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=542 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812120167 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 12, 2018 at 01:04:44PM -0500, Alan Stern wrote: > On Wed, 12 Dec 2018, Paul E. McKenney wrote: > > > > > > Or am I still missing something here? > > > > > > > > You tell me... > > > > > > I think I am on board. ;-) > > > > And more to the point, here is a three-process variant showing a cycle > > that is permitted: > > > > > > P0 P1 P2 > > Wa=2 Wb=2 Wc=2 > > mb0s > > [mb01] [mb02] > > mb0e > > Rb=0 Rc=0 Ra=0 > > > > As can be seen by reordering it as follows: > > > > P0 P1 P2 > > Ra=0 > > Wa=2 > > mb0s > > [mb01] > > Rc=0 > > Wc=2 > > [mb02] > > mb0e > > Rb=0 > > Wb=2 > > > > Make sense? > > You got it! OK. How about this one? P0 P1 P2 P3 Wa=2 rcu_read_lock() Wc=2 Wd=2 memb Wb=2 Rd=0 synchronize_rcu(); Rb=0 Rc=0 Ra=0 rcu_read_unlock() The model should say that it is allowed. Taking a look... P0 P1 P2 P3 Rd=0 Wd=2 synchronize_rcu(); Ra=0 Wa=2 membs rcu_read_lock() [m01] Rc=0 Wc=2 [m02] [m03] membe Rb=0 Wb=2 rcu_read_unlock() Looks allowed to me. If the synchronization of P1 and P2 were interchanged, it should be forbidden: P0 P1 P2 P3 Wa=2 Wb=2 rcu_read_lock() Wd=2 memb Rc=0 Wc=2 synchronize_rcu(); Rb=0 Rd=0 Ra=0 rcu_read_unlock() Taking a look... P0 P1 P2 P3 rcu_read_lock() Rd=0 Wa=2 Wb=2 Wd=2 membs synchronize_rcu(); [m01] Rc=0 Wc=2 rcu_read_unlock() [m02] Ra=0 [Forbidden?] membe Rb=0 I believe that this ordering forbids the cycle: Wa=1 > membs -> [m01] -> Rc=0 -> Wc=2 -> rcu_read_unlock() -> return from synchronize_rcu() -> Ra Does this make sense, or am I missing something? Thanx, Paul