Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752299AbdHANgT (ORCPT ); Tue, 1 Aug 2017 09:36:19 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36989 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751835AbdHANgP (ORCPT ); Tue, 1 Aug 2017 09:36:15 -0400 Date: Tue, 1 Aug 2017 06:35:11 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: Boqun Feng , Will Deacon , linux-kernel@vger.kernel.org, Ingo Molnar , Thomas Gleixner , Randy Dunlap Subject: Re: [RFC][PATCH v3]: documentation,atomic: Add new documents Reply-To: paulmck@linux.vnet.ibm.com References: <20170609154442.GB9236@arm.com> <20170609193604.ncw3hhgvewzc3h5u@hirez.programming.kicks-ass.net> <20170611135632.sl72klbeklelupej@tardis> <20170612144929.3wiwtbqopsfpm3qk@hirez.programming.kicks-ass.net> <20170726115328.2sxiitivlnlq64dk@hirez.programming.kicks-ass.net> <20170726124750.vktrn5zi2gmpzfru@tardis> <20170731090535.rjgnoewqg7mhzr55@hirez.programming.kicks-ass.net> <20170731110403.ou3zqsp3uviqorkz@tardis> <20170731174345.GL3730@linux.vnet.ibm.com> <20170801090121.edo7mekhw3sann4h@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170801090121.edo7mekhw3sann4h@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17080113-0036-0000-0000-00000251DC6F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007465; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000215; SDB=6.00896015; UDB=6.00448193; IPR=6.00676202; BA=6.00005506; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00016481; XFM=3.00000015; UTC=2017-08-01 13:35:14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17080113-0037-0000-0000-0000414A9D63 Message-Id: <20170801133511.GV3730@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-08-01_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-1706020000 definitions=main-1708010224 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1061 Lines: 34 On Tue, Aug 01, 2017 at 11:01:21AM +0200, Peter Zijlstra wrote: > On Mon, Jul 31, 2017 at 10:43:45AM -0700, Paul E. McKenney wrote: > > > Why wouldn't the following have ACQUIRE semantics? > > > > atomic_inc(&var); > > smp_mb__after_atomic(); > > > > Is the issue that there is no actual value returned or some such? > > Yes, so that the inc is a load-store, and thus there is a load, we loose > the value. > > But I see your point I think. Irrespective of still having the value, > the ordering is preserved and nothing should pass across that. > > > So if I have something like this, the assertion really can trigger? > > > > WRITE_ONCE(x, 1); atomic_inc(&y); > > r0 = xchg_release(&y, 5); smp_mb__after_atomic(); > > r1 = READ_ONCE(x); > > > > > > WARN_ON(r0 == 0 && r1 == 0); > > > > I must confess that I am not seeing why we would want to allow this > > outcome. > > No you are indeed quite right. I just wasn't creative enough. Thanks for > the inspiration. Whew! You guys had me worried there for a bit. ;-) Thanx, Paul