From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932409AbdJJQ17 (ORCPT ); Tue, 10 Oct 2017 12:27:59 -0400 Received: from smtprelay0141.hostedemail.com ([216.40.44.141]:35501 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932075AbdJJQ16 (ORCPT ); Tue, 10 Oct 2017 12:27:58 -0400 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::,RULES_HIT:41:69:355:379:541:599:960:968:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1437:1515:1516:1518:1534:1543:1593:1594:1605:1711:1730:1747:1777:1792:2197:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3622:3653:3865:3867:3868:3870:3871:3872:3873:3874:4321:5007:7903:8531:8957:9040:9592:10004:10400:10848:11026:11232:11473:11657:11658:11783:11914:12043:12296:12438:12555:12740:12895:13439:13894:14181:14659:14721:21080:21221:21451:21627:30012:30054:30056:30070:30090:30091,0,RBL:none,CacheIP:none,Bayesian:0.5,0.5,0.5,Netcheck:none,DomainCache:0,MSF:not bulk,SPF:,MSBL:0,DNSBL:none,Custom_rules:0:0:0,LFtime:1,LUA_SUMMARY:none X-HE-Tag: mind91_7f7ebb62b4f4a X-Filterd-Recvd-Size: 4682 Message-ID: <1507652874.3552.34.camel@perches.com> Subject: Re: [PATCH 13/13] rcutorture: formal: prepare for ACCESS_ONCE() removal From: Joe Perches To: paulmck@linux.vnet.ibm.com, Mark Rutland Cc: linux-kernel@vger.kernel.org Date: Tue, 10 Oct 2017 09:27:54 -0700 In-Reply-To: <20171010145252.GX3521@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> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.22.6-1ubuntu1 Mime-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 ---  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",