mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@kernel.org>
To: Joe Perches <joe@perches.com>
Cc: Marco Elver <elver@google.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	dvyukov@google.com, glider@google.com, andreyknvl@google.com,
	kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org,
	apw@canonical.com, Will Deacon <will@kernel.org>
Subject: Re: [PATCH] checkpatch: Warn about data_race() without comment
Date: Wed, 1 Apr 2020 08:38:24 -0700	[thread overview]
Message-ID: <20200401153824.GX19865@paulmck-ThinkPad-P72> (raw)
In-Reply-To: <9de4fb8fa1223fc61d6d8d8c41066eea3963c12e.camel@perches.com>

On Wed, Apr 01, 2020 at 08:17:52AM -0700, Joe Perches wrote:
> On Wed, 2020-04-01 at 12:17 +0200, Marco Elver wrote:
> > Warn about applications of data_race() without a comment, to encourage
> > documenting the reasoning behind why it was deemed safe.
> []
> > diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
> []
> > @@ -5833,6 +5833,14 @@ sub process {
> >  			}
> >  		}
> >  
> > +# check for data_race without a comment.
> > +		if ($line =~ /\bdata_race\s*\(/) {
> > +			if (!ctx_has_comment($first_line, $linenr)) {
> > +				WARN("DATA_RACE",
> > +				     "data_race without comment\n" . $herecurr);
> > +			}
> > +		}
> > +
> >  # check for smp_read_barrier_depends and read_barrier_depends
> >  		if (!$file && $line =~ /\b(smp_|)read_barrier_depends\s*\(/) {
> >  			WARN("READ_BARRIER_DEPENDS",
> 
> Sensible enough but it looks like ctx_has_comment should
> be updated to allow c99 comments too, but that should be
> a separate change from this patch.
> 
> Otherwise, this style emits a message:
> 
> WARNING: data_race without comment
> #135: FILE: kernel/rcu/tasks.h:135:
> +	int i = data_race(rtp->gp_state); // Let KCSAN detect update races
> 

Yes, please!

							Thanx, Paul

  reply	other threads:[~2020-04-01 15:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-01 10:17 Marco Elver
2020-04-01 10:32 ` Will Deacon
2020-04-01 15:17 ` Joe Perches
2020-04-01 15:38   ` Paul E. McKenney [this message]
2020-04-02  2:20     ` [PATCH] checkpatch: Look for c99 comments in ctx_locate_comment Joe Perches
2020-04-02  3:12       ` Paul E. McKenney
2020-04-16  9:27   ` [PATCH] checkpatch: Warn about data_race() without comment Marco Elver

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=20200401153824.GX19865@paulmck-ThinkPad-P72 \
    --to=paulmck@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=andreyknvl@google.com \
    --cc=apw@canonical.com \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=glider@google.com \
    --cc=joe@perches.com \
    --cc=kasan-dev@googlegroups.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=will@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®