From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932321AbdJJQfR (ORCPT ); Tue, 10 Oct 2017 12:35:17 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:45082 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932075AbdJJQfQ (ORCPT ); Tue, 10 Oct 2017 12:35:16 -0400 Date: Tue, 10 Oct 2017 09:35:11 -0700 From: "Paul E. McKenney" To: Joe Perches Cc: Mark Rutland , linux-kernel@vger.kernel.org Subject: Re: [PATCH 13/13] rcutorture: formal: prepare for ACCESS_ONCE() removal Reply-To: paulmck@linux.vnet.ibm.com References: <1507573730-8083-1-git-send-email-mark.rutland@arm.com> <1507573730-8083-14-git-send-email-mark.rutland@arm.com> <20171009195112.GL3521@linux.vnet.ibm.com> <20171010095413.GE27659@leverpostej> <20171010124712.GV3521@linux.vnet.ibm.com> <20171010125039.GI27659@leverpostej> <20171010145252.GX3521@linux.vnet.ibm.com> <1507652874.3552.34.camel@perches.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1507652874.3552.34.camel@perches.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17101016-0036-0000-0000-00000279825F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00007873; HX=3.00000241; KW=3.00000007; PH=3.00000004; SC=3.00000235; SDB=6.00929181; UDB=6.00467660; IPR=6.00709452; BA=6.00005632; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00017476; XFM=3.00000015; UTC=2017-10-10 16:35:14 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17101016-0037-0000-0000-000042086D30 Message-Id: <20171010163511.GK3521@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-10-10_05:,, 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-1710100235 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Oct 10, 2017 at 09:27:54AM -0700, Joe Perches wrote: > On Tue, 2017-10-10 at 07:52 -0700, Paul E. McKenney wrote: > > On Tue, Oct 10, 2017 at 01:50:39PM +0100, Mark Rutland wrote: > > > On Tue, Oct 10, 2017 at 05:47:12AM -0700, Paul E. McKenney wrote: > > > > On Tue, Oct 10, 2017 at 10:54:14AM +0100, Mark Rutland wrote: > > > > > On Mon, Oct 09, 2017 at 12:51:12PM -0700, Paul E. McKenney wrote: > > > > > > On Mon, Oct 09, 2017 at 07:28:50PM +0100, Mark Rutland wrote: > > > > > > > diff --git a/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h b/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h > > > > > > > index 6687acc..ee4e4f8 100644 > > > > > > > --- a/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h > > > > > > > +++ b/tools/testing/selftests/rcutorture/formal/srcu-cbmc/src/barriers.h > > > > > > > @@ -34,8 +34,9 @@ > > > > > > > #define rs_smp_mb() do {} while (0) > > > > > > > #endif > > > > > > > > > > > > > > -#define ACCESS_ONCE(x) (*(volatile typeof(x) *) &(x)) > > > > > > > -#define READ_ONCE(x) ACCESS_ONCE(x) > > > > > > > -#define WRITE_ONCE(x, val) (ACCESS_ONCE(x) = (val)) > > > > > > > +#define __ACCESS_ONCE(x) (*(volatile typeof(x) *) &(x)) > > > > > > > +#define ACCESS_ONCE(x) __ACCESS_ONCE(x) > > > > > > > +#define READ_ONCE(x) __ACCESS_ONCE(x) > > > > > > > +#define WRITE_ONCE(x, val) (__ACCESS_ONCE(x) = (val)) > > > > > > > > > > > > How about something like the following? > > > > > > > > > > > > #define READ_ONCE(x) (*(volatile typeof(x) *) &(x)) > > > > > > #define WRITE_ONCE(x) ((*(volatile typeof(x) *) &(x)) = (val)) > > > > > > > > > > Sure; folded in and pushed out. :) > > > > > > > > Thank you! > > > > > > > > > I've assumed that the ACCESS_ONCE() definition needs to be kept until > > > > > that's ripped out treewide. Please shout if that's not the case! > > > > > > > > You have it right. This case is an exception because this code is > > > > used only by RCU, which has long since had ACCESS_ONCE() ripped out. > > > > > > Sorry; I meant that in this case, I leave this code as: > > > > > > #define ACCESS_ONCE(x) (*(volatile typeof(x) *) &(x)) > > > #define READ_ONCE(x) (*(volatile typeof(x) *) &(x)) > > > #define WRITE_ONCE(x) ((*(volatile typeof(x) *) &(x)) = (val)) > > > > > > ... if you mean that we can drop ACCESS_ONCE() in this case, then I can > > > rip that out. > > > > We can drop ACCESS_ONCE() in this case. > > Once ACCESS_ONCE is removed from the code in the tree > it can also be removed from checkpatch Agreed, but only after all ACCESS_ONCE() definitions are removed. Thanx, Paul > --- >  scripts/checkpatch.pl | 22 ---------------------- >  1 file changed, 22 deletions(-) > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl > index 2a8c6c3c1bdb..440262a87d26 100755 > --- a/scripts/checkpatch.pl > +++ b/scripts/checkpatch.pl > @@ -6224,28 +6224,6 @@ sub process { >   } >   } >   > -# whine about ACCESS_ONCE > - if ($^V && $^V ge 5.10.0 && > -     $line =~ /\bACCESS_ONCE\s*$balanced_parens\s*(=(?!=))?\s*($FuncArg)?/) { > - my $par = $1; > - my $eq = $2; > - my $fun = $3; > - $par =~ s/^\(\s*(.*)\s*\)$/$1/; > - if (defined($eq)) { > - if (WARN("PREFER_WRITE_ONCE", > -  "Prefer WRITE_ONCE(, ) over ACCESS_ONCE() = \n" . $herecurr) && > -     $fix) { > - $fixed[$fixlinenr] =~ s/\bACCESS_ONCE\s*\(\s*\Q$par\E\s*\)\s*$eq\s*\Q$fun\E/WRITE_ONCE($par, $fun)/; > - } > - } else { > - if (WARN("PREFER_READ_ONCE", > -  "Prefer READ_ONCE() over ACCESS_ONCE()\n" . $herecurr) && > -     $fix) { > - $fixed[$fixlinenr] =~ s/\bACCESS_ONCE\s*\(\s*\Q$par\E\s*\)/READ_ONCE($par)/; > - } > - } > - } > - >  # check for mutex_trylock_recursive usage >   if ($line =~ /mutex_trylock_recursive/) { >   ERROR("LOCKING", >