From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757241AbdJKQw5 (ORCPT ); Wed, 11 Oct 2017 12:52:57 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:33470 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751938AbdJKQwz (ORCPT ); Wed, 11 Oct 2017 12:52:55 -0400 Date: Wed, 11 Oct 2017 09:47:48 -0700 From: "Paul E. McKenney" To: Peter Zijlstra Cc: David Howells , Will Deacon , linux-kernel@vger.kernel.org, mingo@kernel.org, torvalds@linux-foundation.org, mark.rutland@arm.com, linux-arch@vger.kernel.org, Jonathan Corbet , Alexander Kuleshov , dvyukov@google.com Subject: Re: [PATCH RFC tip/core/rcu 12/15] lib/assoc_array: Remove smp_read_barrier_depends() Reply-To: paulmck@linux.vnet.ibm.com References: <20171011122217.GD11106@arm.com> <20171010155042.GD3521@linux.vnet.ibm.com> <1507594969-8347-12-git-send-email-paulmck@linux.vnet.ibm.com> <20171010001951.GA6476@linux.vnet.ibm.com> <8079.1507628146@warthog.procyon.org.uk> <26455.1507724399@warthog.procyon.org.uk> <6309.1507735045@warthog.procyon.org.uk> <20171011155948.GE3521@linux.vnet.ibm.com> <20171011161220.zqkdhynxerrcmvdd@hirez.programming.kicks-ass.net> <20171011162412.o6lmjiag7spwabge@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20171011162412.o6lmjiag7spwabge@hirez.programming.kicks-ass.net> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17101116-0044-0000-0000-0000039E1862 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007878; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000236; SDB=6.00929665; UDB=6.00467926; IPR=6.00709936; BA=6.00005634; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017492; XFM=3.00000015; UTC=2017-10-11 16:47:52 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101116-0045-0000-0000-000007CD1A12 Message-Id: <20171011164748.GK3521@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-11_06:,, 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-1710110234 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 11, 2017 at 06:24:12PM +0200, Peter Zijlstra wrote: > On Wed, Oct 11, 2017 at 06:12:20PM +0200, Peter Zijlstra wrote: > > On Wed, Oct 11, 2017 at 08:59:48AM -0700, Paul E. McKenney wrote: > > > On Wed, Oct 11, 2017 at 04:17:25PM +0100, David Howells wrote: > > > > I will, however, quibble with the appropriateness of the name READ_ONCE()... > > > > I still think it's not sufficiently obvious that this is a barrier and the > > > > barrier is after. Maybe READ_AND_BARRIER()? > > > > > > Linus was unhappy with READ_ONCE_CTRL() to tag control dependencies, but > > > indicated that he might consider it if it helped code-analysis tools. > > > Adding Dmitry Vyukov for his thoughts on whether tagging READ_ONCE() > > > for dependencies would help. Me, I would suggest READ_ONCE_DEP(), but > > > let's figure out if the bikeshed needs to be painted before arguing over > > > the color. ;-) > > > > Count me one vote for the READ_ONCE() name. This is about dependent > > reads, which are nothing special on anything except Alpha. > > > > We want to remove the exception/specialness from the memory model; and > > therefore have to fix up all primitives that could possibly be used for > > these reads to unconditionally issue the barrier (on Alpha). The > > alternative is: rm -rf arch/alpha. > > > > Adding something like READ_ONCE_DEP() does not rid us of the idea that > > dependent reads are special and thus defeats the purpose, we might as > > well retain lockless_dereference(). > > > > Now; any user of dependent reads must use READ_ONCE() in any case, to > > avoid load tearing and reloads. So using READ_ONCE() for the dependent > > reads is not extra or additional (note we'll also have to add the > > barrier to all our relaxed and release atomics and anything else that > > implies READ_ONCE and doesn't already imply smp_mb() after). > > Add the per-cpu ops to that list, they imply READ_ONCE(). Consider for > example this example: > > > for_each_possible_cpu(cpu) > smp_store_release(per_cpu_ptr(&foo, cpu), obj); > > -vs- > > obj = this_cpu_read(foo); > if (obj->ponies) > fart_rainbow(obj); Interesting. Do we currently have any dependencies headed by this_cpu_read()? Thanx, Paul