Received: by 10.223.185.116 with SMTP id b49csp4131382wrg; Mon, 19 Feb 2018 11:42:27 -0800 (PST) X-Google-Smtp-Source: AH8x22745ELN4QnAJ9Ij0DsrdqRnD2BCdT3mWFZl07+JFDlOPloY91F4TzS0BZa6+dXGlzdaOGAo X-Received: by 2002:a17:902:6bc3:: with SMTP id m3-v6mr15183659plt.442.1519069347167; Mon, 19 Feb 2018 11:42:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519069347; cv=none; d=google.com; s=arc-20160816; b=Qd6dWtDSWoMUL4gqf6PXyfKOmN3hUmery1FKJpajzz1igyHPdJktWkBHhqVYAFz0UX GdwOLeV/MHyQOfcCeJDq+mccoCdz3x0aIIZPx0IjXL8K/0JbDGAcgY+hwvU1SDx9lr7t lvgsq9/t1iTJ0b2cttRYWHXy3UGU/hIG9jvxSEJPCUwsAPbIS/S7t5W5gynb+TAxtQXp uaoBNogtOJKxPDseCAZVZEXeqnWL8QN2bHrxTnEbynFst+VhQNcAu5dywNXPKgo+nxAZ fcrGx8E7QoNXZf4DJkAXBsynmEeuM+pxhpAhFRdUvtyZZhxNuwLrE9iT3Hz1pBb9CocT 2k0w== 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:arc-authentication-results; bh=RCy3+YyroxDWm9C/ypCeOgprxUcZi7AuNOtmXmhM2mc=; b=WeRWAm6ZjindlIO60M5huVN5nIPWkZX92eGr04mXN90AmwNK4FOVFxSPkEPJP7d+pD ZcXjgGsh1e+jwjvgHK/I+cLtsU+JvNstSZgRYkAY/eWPeli3jPektgYSw/5JRCoLVj/b bg3WwgfrRR6ToEt3bp5Pb59wWxxOoWx2QMqRV0Fzi2wo822SKo2JXEw0do7CwqJU3+MW rA1ko/yfacoa2uPbw3qeDKyZIC3ItPJxtzZuBitGGlUZdp8KUUSy07dkaGwSLnkMCD3T Mn2aV2ZlPCWy1LsWwGDAOG6RThsmTqexPQ94x49eNpy+e8iNP1WKUQvrQvapC3MFITlt 775Q== 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 e6si9510809pgt.274.2018.02.19.11.42.12; Mon, 19 Feb 2018 11:42:27 -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 S1753651AbeBSTl0 (ORCPT + 99 others); Mon, 19 Feb 2018 14:41:26 -0500 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:35514 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753466AbeBSTlY (ORCPT ); Mon, 19 Feb 2018 14:41:24 -0500 Received: from pps.filterd (m0098394.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w1JJd0qB136512 for ; Mon, 19 Feb 2018 14:41:24 -0500 Received: from e11.ny.us.ibm.com (e11.ny.us.ibm.com [129.33.205.201]) by mx0a-001b2d01.pphosted.com with ESMTP id 2g80r1k8pc-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 19 Feb 2018 14:41:06 -0500 Received: from localhost by e11.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 19 Feb 2018 14:41:05 -0500 Received: from b01cxnp22034.gho.pok.ibm.com (9.57.198.24) by e11.ny.us.ibm.com (146.89.104.198) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 19 Feb 2018 14:41:01 -0500 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 w1JJf1vl53542948; Mon, 19 Feb 2018 19:41:01 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id CBAB9B204D; Mon, 19 Feb 2018 15:43:19 -0500 (EST) Received: from paulmck-ThinkPad-W541 (unknown [9.80.232.163]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP id 8F4EAB2054; Mon, 19 Feb 2018 15:43:19 -0500 (EST) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id DFAA116C11AA; Mon, 19 Feb 2018 11:41:23 -0800 (PST) Date: Mon, 19 Feb 2018 11:41:23 -0800 From: "Paul E. McKenney" To: Alan Stern Cc: Andrea Parri , Akira Yokosawa , Kernel development list , mingo@kernel.org, Will Deacon , peterz@infradead.org, boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, Jade Alglave , Luc Maranget , Patrick Bellasi Subject: Re: [PATCH] tools/memory-model: remove rb-dep, smp_read_barrier_depends, and lockless_dereference Reply-To: paulmck@linux.vnet.ibm.com References: <20180217151413.GA3785@andrea> 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: 18021919-2213-0000-0000-00000272539F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00008561; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000254; SDB=6.00992130; UDB=6.00504010; IPR=6.00771476; MB=3.00019641; MTD=3.00000008; XFM=3.00000015; UTC=2018-02-19 19:41:04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18021919-2214-0000-0000-0000592BD0CD Message-Id: <20180219194123.GZ3617@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-02-19_08:,, 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=1011 lowpriorityscore=0 impostorscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1709140000 definitions=main-1802190243 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Feb 19, 2018 at 12:14:45PM -0500, Alan Stern wrote: > On Sat, 17 Feb 2018, Andrea Parri wrote: > > > > Akira's observation about READ_ONCE extends to all (annotated) loads. In > > > fact, it also applies to loads corresponding to unsuccessful RMW operations; > > > consider, for example, the following variation of MP+onceassign+derefonce: > > > > > > C T > > > > > > { > > > y=z; > > > z=0; > > > } > > > > > > P0(int *x, int **y) > > > { > > > WRITE_ONCE(*x, 1); > > > smp_store_release(y, x); > > > } > > > > > > P1(int **y, int *z) > > > { > > > int *r0; > > > int r1; > > > > > > r0 = cmpxchg_relaxed(y, z, z); > > > r1 = READ_ONCE(*r0); > > > } > > > > > > exists (1:r0=x /\ 1:r1=0) > > > > > > The final state is allowed w/o the patch, and forbidden w/ the patch. > > > > > > This also reminds me of > > > > > > 5a8897cc7631fa544d079c443800f4420d1b173f > > > ("locking/atomics/alpha: Add smp_read_barrier_depends() to _release()/_relaxed() atomics") > > > > > > (that we probably want to mention in the commit message). > > > > Please also notice that 5a8897cc7631f only touched alpha's atomic.h: > > I see no corresponding commit/change on {,cmp}xchg.h (where the "mb" > > is currently conditionally executed). > > This leaves us with a question: Do we want to change the kernel by > adding memory barriers after unsuccessful RMW operations on Alpha, or > do we want to change the model by excluding such operations from > address dependencies? I vote for adding the barrier on Alpha. However, I don't know of any code in the Linux kernel that relies on read-to-read address dependency ordering headed by a failing RMW operation, so I don't feel all that strongly about this. > Note that operations like atomic_add_unless() already include memory > barriers. And I don't see an atomic_add_unless_relaxed(), so we are good on this one. So far, anyway! ;-) Thanx, Paul