Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751560AbdLBEpV (ORCPT ); Fri, 1 Dec 2017 23:45:21 -0500 Received: from smtprelay0174.hostedemail.com ([216.40.44.174]:56813 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751311AbdLBEpU (ORCPT ); Fri, 1 Dec 2017 23:45:20 -0500 X-Session-Marker: 6A6F6540706572636865732E636F6D X-Spam-Summary: 2,0,0,,d41d8cd98f00b204,joe@perches.com,:::::::::::::::::::::::::::::::,RULES_HIT:41:355:379:541:599:800:960:973:982:988:989:1260:1277:1311:1313:1314:1345:1359:1373:1431:1437:1515:1516:1518:1534:1542:1593:1594:1711:1730:1747:1777:1792:2197:2199:2393:2553:2559:2562:2828:3138:3139:3140:3141:3142:3352:3622:3865:3867:3868:3870:3872:3873:3874:4321:5007:6742:8957:9040:10004:10400:10848:11026:11232:11473:11658:11914:12043:12114:12296:12438:12555:12740:12760:12895:13095:13255:13439:14181:14659:14721:21080:21221:21365:21433:21451:21627:30012:30029:30054: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:2,LUA_SUMMARY:none X-HE-Tag: kitty75_854105127d415 X-Filterd-Recvd-Size: 3799 Message-ID: <1512189913.19952.184.camel@perches.com> Subject: Re: [PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends() From: Joe Perches To: paulmck@linux.vnet.ibm.com Cc: linux-kernel@vger.kernel.org, mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com, akpm@linux-foundation.org, mathieu.desnoyers@efficios.com, josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org, rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com, fweisbec@gmail.com, oleg@redhat.com, Andy Whitcroft Date: Fri, 01 Dec 2017 20:45:13 -0800 In-Reply-To: <20171201214416.GJ7829@linux.vnet.ibm.com> References: <20171201195053.GA23494@linux.vnet.ibm.com> <1512157876-24665-20-git-send-email-paulmck@linux.vnet.ibm.com> <1512159257.19952.167.camel@perches.com> <20171201214416.GJ7829@linux.vnet.ibm.com> Content-Type: text/plain; charset="ISO-8859-1" X-Mailer: Evolution 3.26.1-1 Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2509 Lines: 67 On Fri, 2017-12-01 at 13:44 -0800, Paul E. McKenney wrote: > On Fri, Dec 01, 2017 at 12:14:17PM -0800, Joe Perches wrote: > > On Fri, 2017-12-01 at 11:51 -0800, Paul E. McKenney wrote: > > > Now that both smp_read_barrier_depends() and read_barrier_depends() > > > are being de-emphasized, warn if any are added. > > > > This would also warn on existing files when run > > with ./scripts/checkpatch.pl -f > > > > Do you want it to check new patches only? > > > > If so the test could become "if (!$file && etc...) > > > > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > > > @@ -5586,6 +5586,12 @@ sub process { > > > } > > > } > > > > > > +# check for smp_read_barrier_depends and read_barrier_depends > > > + if ($line =~ /\b(smp_|)read_barrier_depends\(/) { > > > > Must become > > > > + if ($line =~ /\b(smp_|)read_barrier_depends\s*\(/) { > > > > similar to the lines above this as there are sometimes > > spaces between function name and argument parentheses. > > Good points! Like this? [] > commit ff155ce179aab891dbe2ca80f82a453383fd165a > Author: Paul E. McKenney > Date: Mon Nov 27 09:37:35 2017 -0800 > > checkpatch: Add warnings for {smp_,}read_barrier_depends() > > Now that both smp_read_barrier_depends() and read_barrier_depends() > are being de-emphasized, warn if any are added. > > Signed-off-by: Paul E. McKenney > Cc: Andy Whitcroft > Cc: Joe Perches > [ paulmck: Skipped checking files and handled whitespace per Joe Perches. ] > > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl [] > @@ -5586,6 +5586,12 @@ sub process { > } > } > > +# check for smp_read_barrier_depends and read_barrier_depends > + if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) { > + WARN("READ_BARRIER_DEPENDS", > + "Dependency barriers should only be used in READ_ONCE or DEC Alpha code" . $herecurr); Almost right. Missing a '\n' after "DEC Alpha code". Without the '\n', running checkpatch with --terse outputs badly. If you really wanted to optimize, you could make the first (smp_|) become (?:smp_|) to avoid the unused capture group. Or perhaps this could emit the actual type in the message like: if (!$file && $line =~ /\b((?:smp_|)read_barrier_depends)\s*\(/ { WARN("READ_BARRIER_DEPENDS", "$1 should only be used in READ_ONCE or DEC Alpha code\n" . $herecurr);