All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
To: Joe Perches <joe@perches.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 <apw@canonical.com>
Subject: Re: [PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends()
Date: Mon, 4 Dec 2017 11:06:46 -0800	[thread overview]
Message-ID: <20171204190646.GD7829@linux.vnet.ibm.com> (raw)
In-Reply-To: <1512189913.19952.184.camel@perches.com>

On Fri, Dec 01, 2017 at 08:45:13PM -0800, Joe Perches wrote:
> On Fri, 2017-12-01 at 13:44 -0800, Paul E. McKenney wrote:

[ . . . ]

> > Good points!  Like this?
> []
> > commit ff155ce179aab891dbe2ca80f82a453383fd165a
> > Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> > 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 <paulmck@linux.vnet.ibm.com>
> >     Cc: Andy Whitcroft <apw@canonical.com>
> >     Cc: Joe Perches <joe@perches.com>
> >     [ 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);

How about like this?  (s/$1/$1read_barrier_depends/).

							Thanx, Paul

------------------------------------------------------------------------

commit e4f1d781e33c150547c68e55099794b98ee14d5e
Author: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
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 <paulmck@linux.vnet.ibm.com>
    Cc: Andy Whitcroft <apw@canonical.com>
    Cc: Joe Perches <joe@perches.com>
    [ paulmck: Skipped checking files and handled whitespace per Joe Perches. ]

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index 95cda3ecc66b..9a384bfe2bd5 100755
--- 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",
+			     "$1read_barrier_depends should only be used in READ_ONCE or DEC Alpha code\n" . $herecurr);
+		}
+
 # check of hardware specific defines
 		if ($line =~ m@^.\s*\#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) {
 			CHK("ARCH_DEFINES",

  reply	other threads:[~2017-12-04 19:06 UTC|newest]

Thread overview: 92+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-01 19:50 [PATCH tip/core/rcu 0/21] De-emphasize {smp_,}read_barrier_depends Paul E. McKenney
2017-12-01 19:50 ` [PATCH tip/core/rcu 01/21] doc: READ_ONCE() now implies smp_barrier_depends() Paul E. McKenney
2017-12-04 15:38   ` David Howells
2017-12-04 18:52     ` Paul E. McKenney
2017-12-04 21:54       ` Peter Zijlstra
2017-12-04 22:15         ` Paul E. McKenney
2017-12-04 22:39         ` David Howells
2017-12-04 22:57           ` Peter Zijlstra
2017-12-01 19:50 ` [PATCH tip/core/rcu 02/21] mn10300: READ_ONCE() now implies smp_read_barrier_depends() Paul E. McKenney
2017-12-01 19:50 ` [PATCH tip/core/rcu 03/21] drivers/net/ethernet/qlogic/qed: Fix __qed_spq_block() ordering Paul E. McKenney
2017-12-01 19:50 ` [PATCH tip/core/rcu 04/21] fs/dcache: Use release-acquire for name/length update Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 05/21] percpu: READ_ONCE() now implies smp_read_barrier_depends() Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 06/21] rcu: Adjust read-side accessor comments for READ_ONCE() Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 07/21] rtnetlink: Update now-misleading smp_read_barrier_depends() comment Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 08/21] seqlock: Remove now-redundant smp_read_barrier_depends() Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 09/21] uprobes: " Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 10/21] locking: Remove smp_read_barrier_depends() from queued_spin_lock_slowpath() Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 11/21] tracepoint: Remove smp_read_barrier_depends() from comment Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 12/21] lib/assoc_array: Remove smp_read_barrier_depends() Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 13/21] mm/ksm: Remove now-redundant smp_read_barrier_depends() Paul E. McKenney
2017-12-01 19:51   ` Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 14/21] netfilter: " Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 15/21] keyring: " Paul E. McKenney
2017-12-01 19:51   ` Paul E. McKenney
2017-12-01 19:51   ` Paul E. McKenney
2017-12-04  0:59   ` James Morris
2017-12-04  0:59     ` James Morris
2017-12-04  0:59     ` James Morris
2017-12-04 18:54     ` Paul E. McKenney
2017-12-04 18:54       ` Paul E. McKenney
2017-12-04 18:54       ` Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 16/21] drivers/infiniband: " Paul E. McKenney
2017-12-01 19:51   ` Paul E. McKenney
     [not found]   ` <1512157876-24665-16-git-send-email-paulmck-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2017-12-02  0:11     ` Jason Gunthorpe
2017-12-02  0:11       ` Jason Gunthorpe
2017-12-02  1:08       ` Paul E. McKenney
     [not found]         ` <20171202010851.GL7829-23VcF4HTsmIX0ybBhKVfKdBPR1lH4CV8@public.gmane.org>
2017-12-05 15:08           ` Jason Gunthorpe
2017-12-05 15:08             ` Jason Gunthorpe
2017-12-05 20:06             ` Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 17/21] doc: De-emphasize smp_read_barrier_depends Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 18/21] genetlink: Remove smp_read_barrier_depends() from comment Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 19/21] netlink: " Paul E. McKenney
2017-12-01 19:51 ` [PATCH tip/core/rcu 20/21] checkpatch: Add warnings for {smp_,}read_barrier_depends() Paul E. McKenney
2017-12-01 20:14   ` Joe Perches
2017-12-01 21:44     ` Paul E. McKenney
2017-12-02  4:45       ` Joe Perches
2017-12-04 19:06         ` Paul E. McKenney [this message]
2017-12-04 19:12           ` Joe Perches
2017-12-01 19:51 ` [PATCH tip/core/rcu 21/21] drivers/vhost: Remove now-redundant read_barrier_depends() Paul E. McKenney
2017-12-01 19:51   ` Paul E. McKenney
2017-12-05 18:31   ` Michael S. Tsirkin
2017-12-05 18:39     ` Peter Zijlstra
2017-12-05 18:39       ` Peter Zijlstra
2017-12-05 18:57       ` Michael S. Tsirkin
2017-12-05 18:57         ` Michael S. Tsirkin
2017-12-05 19:17         ` Peter Zijlstra
2017-12-05 19:17         ` Peter Zijlstra
2017-12-05 19:24           ` Michael S. Tsirkin
2017-12-05 19:24             ` Michael S. Tsirkin
2017-12-05 19:33             ` Paul E. McKenney
2017-12-05 19:33               ` Paul E. McKenney
2017-12-05 19:51               ` Michael S. Tsirkin
2017-12-05 19:51               ` Michael S. Tsirkin
2017-12-05 19:57                 ` Peter Zijlstra
2017-12-05 19:57                   ` Peter Zijlstra
2017-12-05 20:28                   ` Michael S. Tsirkin
2017-12-05 20:28                   ` Michael S. Tsirkin
2017-12-05 21:17                     ` Peter Zijlstra
2017-12-05 21:42                       ` Michael S. Tsirkin
2017-12-05 21:42                       ` Michael S. Tsirkin
2017-12-05 21:17                     ` Peter Zijlstra
2017-12-05 20:08                 ` Paul E. McKenney
2017-12-05 21:24                   ` Michael S. Tsirkin
2017-12-05 21:24                   ` Michael S. Tsirkin
2017-12-05 21:36                     ` Paul E. McKenney
2017-12-05 21:36                     ` Paul E. McKenney
2017-12-05 21:43                       ` Michael S. Tsirkin
2017-12-05 22:02                         ` Paul E. McKenney
2017-12-05 22:02                         ` Paul E. McKenney
2017-12-05 21:43                       ` Michael S. Tsirkin
2017-12-05 22:09                       ` Peter Zijlstra
2017-12-05 22:09                       ` Peter Zijlstra
2017-12-05 21:57                     ` Peter Zijlstra
2017-12-05 21:57                     ` Peter Zijlstra
2017-12-05 22:09                       ` Michael S. Tsirkin
2017-12-05 23:39                         ` Paul E. McKenney
2017-12-05 23:39                         ` Paul E. McKenney
2017-12-05 22:09                       ` Michael S. Tsirkin
2017-12-05 20:08                 ` Paul E. McKenney
2017-12-05 19:55             ` Peter Zijlstra
2017-12-05 19:55               ` Peter Zijlstra
2017-12-05 18:31   ` Michael S. Tsirkin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171204190646.GD7829@linux.vnet.ibm.com \
    --to=paulmck@linux.vnet.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joe@perches.com \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.