[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CANpmjNOSo2WqquKJwePdsA1VXS2V94DQZ=RVY9bULbVwGPx1RA@mail.gmail.com>
Date: Thu, 16 Apr 2020 11:27:38 +0200
From: Marco Elver <elver@...gle.com>
To: Joe Perches <joe@...ches.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"Paul E. McKenney" <paulmck@...nel.org>,
Dmitry Vyukov <dvyukov@...gle.com>,
Alexander Potapenko <glider@...gle.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
kasan-dev <kasan-dev@...glegroups.com>,
LKML <linux-kernel@...r.kernel.org>, apw@...onical.com,
Will Deacon <will@...nel.org>
Subject: Re: [PATCH] checkpatch: Warn about data_race() without comment
On Wed, 1 Apr 2020 at 17:19, Joe Perches <joe@...ches.com> 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",
Do we still want to do this? Which tree can pick this up? Or was there
anything left that we missed?
> 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.
AFAIK the C99 comment patch is in -mm now.
> 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
>
Thanks,
-- Marco
Powered by blists - more mailing lists