ksummit.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: "Bird, Tim" <Tim.Bird@sony.com>
To: Joe Perches <joe@perches.com>,
	"laurent.pinchart@ideasonboard.com"
	<laurent.pinchart@ideasonboard.com>, Andrew Lunn <andrew@lunn.ch>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	James Bottomley <James.Bottomley@hansenpartnership.com>,
	Chris Mason <clm@meta.com>,
	"ksummit@lists.linux.dev" <ksummit@lists.linux.dev>,
	Dan Carpenter <dan.carpenter@linaro.org>,
	Alexei Starovoitov <ast@kernel.org>,
	Rob Herring <robh@kernel.org>,
	"Knut.omang@oracle.com" <Knut.omang@oracle.com>
Subject: checkpatch encouragement improvements (was RE: [MAINTAINERS / KERNEL SUMMIT] AI patch review tools)
Date: Fri, 10 Oct 2025 16:01:31 +0000	[thread overview]
Message-ID: <MW5PR13MB56325771E2CB01118E02F6D1FDEFA@MW5PR13MB5632.namprd13.prod.outlook.com> (raw)
In-Reply-To: <739c7a03558c3c8642fc6a51de4d679ecd389365.camel@perches.com>



> -----Original Message-----
> From: Joe Perches <joe@perches.com>
> On Fri, 2025-10-10 at 14: 15 +0000, Bird, Tim wrote: > I have ideas to address the false positive rate, based on features that checkpatch. pl >
> already has, as well as ideas for handling some of the concerns that running > checkpatch. pl
> On Fri, 2025-10-10 at 14:15 +0000, Bird, Tim wrote:
> > I have ideas to address the false positive rate, based on features that checkpatch.pl
> > already has, as well as ideas for handling some of the concerns that running
> > checkpatch.pl (or an equivalent) at build time would raise.  Some of these might
> > apply to AI review as well.  Let me know if you want me to elaborate, or if we
> > should just discuss in Tokyo.
> 
> Please elaborate.

Before I rattled off my ideas, I did a quick check to see if anything like what I had
in mind had already been suggested, and I found this:
https://lore.kernel.org/all/cover.3dd1d0c1f15a7a7c418f20ebafc9719afc1c2704.1510840787.git-series.knut.omang@oracle.com/

That's a submission by Knut Omang from 2017 that adds support for running
checkpatch.pl on the whole kernel source, integrated into kbuild.

It looks like it was not adopted.

That patchset allows:
1) fine-tuning the set of items that checkpatch checks for
2) using a config file to control the fine tuning
3) allowing selection of the groups of checks (so that preferences of
individual maintainers or sub-systems could be adhered to)

My ideas for tackling false-positives was along those same lines.
1) determine a list of "must-have" items, that everyone supports as true-positives
2) having a way to designate groups of items that were deemed as true-positives
     - by creating a profile of items, specific to a subsystem or maintainer
     - having the 'true-positives' profile under the control of the maintainer or subsystem
3) creating a mechanism to tell checkpatch which profile to use

In terms of runtime issues, there are two ways to "encourage (/force?)" users
to run the checks, while still managing overhead:
1) add a checkpatch.pl invocation sometime during a regular build (either
before or after the compiler invocation)
     - My idea to avoid overhead here is to add a command-line option to the kernel
       build, to indicate the number of commits to include in patch review (default to 1), and only
       run checkpatch on either a) each commit itself, or b) the files touched by each commit.
       - OR,  only run checkpatch on source files that differ from the git index.
2) alternatively, add a gcc plugin that performs some set of checks similar to checkpatch.pl,
    maybe calling checkpatch itself, but maybe just directly checking for definite true-positives
    itself.  This would involve migrating the true-positives check from checkpatch into a gcc plugin.
    - then dealing with clang builds

I think there would be too much noise, and too much latency, to run
checkpatch on the entire kernel source on every build.

But my goal here is to have checkpatch issues show up like gcc errors - early in development,
as the errors are made, so they never make it into patch emails.

I've been working recently with gcc plugins, and they aren't as scary to write
as I initially thought.  But converting all the checkpatch checks to C code would still
be quite a bit of work.

 -- Tim



  reply	other threads:[~2025-10-10 16:02 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-08 17:04 [MAINTAINERS / KERNEL SUMMIT] AI patch review tools Chris Mason
2025-10-08 17:20 ` Konstantin Ryabitsev
2025-10-08 18:11   ` Sasha Levin
2025-10-08 18:35   ` Chris Mason
2025-10-08 17:57 ` Bart Van Assche
2025-10-08 18:04   ` Chris Mason
2025-10-08 18:14     ` Bart Van Assche
2025-10-08 18:42       ` Chris Mason
2025-10-08 21:08     ` Kees Cook
2025-10-09  1:37       ` Chris Mason
2025-10-08 18:33 ` Sasha Levin
2025-10-09  1:43   ` Chris Mason
2025-10-09 14:49     ` Paul E. McKenney
2025-10-08 19:08 ` Andrew Lunn
2025-10-08 19:28   ` Arnaldo Carvalho de Melo
2025-10-08 19:33     ` Laurent Pinchart
2025-10-08 19:39       ` Arnaldo Carvalho de Melo
2025-10-08 20:29         ` Andrew Lunn
2025-10-08 20:53           ` Mark Brown
2025-10-09  9:37         ` Laurent Pinchart
2025-10-09 12:48           ` Arnaldo Carvalho de Melo
2025-10-08 19:29   ` Laurent Pinchart
2025-10-08 19:50     ` Bird, Tim
2025-10-08 20:30       ` Sasha Levin
2025-10-09 12:32         ` Arnaldo Carvalho de Melo
2025-10-08 20:30       ` James Bottomley
2025-10-08 20:38         ` Bird, Tim
2025-10-08 22:21           ` Jiri Kosina
2025-10-09  9:14           ` Laurent Pinchart
2025-10-09 10:03             ` Chris Mason
2025-10-10  7:54               ` Laurent Pinchart
2025-10-10 11:40                 ` James Bottomley
2025-10-10 11:53                   ` Laurent Pinchart
2025-10-10 14:21                     ` Steven Rostedt
2025-10-10 14:35                   ` Bird, Tim
2025-10-09 14:30             ` Steven Rostedt
2025-10-09 14:51               ` Andrew Lunn
2025-10-09 15:05                 ` Steven Rostedt
2025-10-10  7:59                 ` Laurent Pinchart
2025-10-10 14:15                   ` Bird, Tim
2025-10-10 15:07                     ` Joe Perches
2025-10-10 16:01                       ` Bird, Tim [this message]
2025-10-10 17:11                         ` checkpatch encouragement improvements (was RE: [MAINTAINERS / KERNEL SUMMIT] AI patch review tools) Rob Herring
2025-10-10 17:33                           ` Arnaldo Carvalho de Melo
2025-10-10 19:21                           ` Joe Perches
2025-10-10 16:11                       ` [MAINTAINERS / KERNEL SUMMIT] AI patch review tools Steven Rostedt
2025-10-10 16:47                         ` Joe Perches
2025-10-10 17:42                           ` Steven Rostedt
2025-10-11 10:28                         ` Mark Brown
2025-10-09 16:31               ` Chris Mason
2025-10-09 17:19                 ` Arnaldo Carvalho de Melo
2025-10-09 17:24                   ` Arnaldo Carvalho de Melo
2025-10-09 17:31                     ` Alexei Starovoitov
2025-10-09 17:47                       ` Arnaldo Carvalho de Melo
2025-10-09 18:42                     ` Chris Mason
2025-10-09 18:56                       ` Linus Torvalds
2025-10-10 15:52                         ` Mauro Carvalho Chehab
2025-10-09 14:47             ` Bird, Tim
2025-10-09 15:11               ` Andrew Lunn
2025-10-09 17:58               ` Mark Brown
2025-10-09  1:15         ` Chris Mason
2025-10-08 20:37     ` Andrew Lunn
2025-10-09 12:40       ` Arnaldo Carvalho de Melo
2025-10-09 14:52 ` Paul E. McKenney
2025-10-10  3:08 ` Krzysztof Kozlowski
2025-10-10 14:12   ` Chris Mason
2025-10-31 16:51   ` Stephen Hemminger
2025-10-14  7:16 ` Dan Carpenter

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=MW5PR13MB56325771E2CB01118E02F6D1FDEFA@MW5PR13MB5632.namprd13.prod.outlook.com \
    --to=tim.bird@sony.com \
    --cc=James.Bottomley@hansenpartnership.com \
    --cc=Knut.omang@oracle.com \
    --cc=andrew@lunn.ch \
    --cc=ast@kernel.org \
    --cc=clm@meta.com \
    --cc=dan.carpenter@linaro.org \
    --cc=joe@perches.com \
    --cc=ksummit@lists.linux.dev \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=robh@kernel.org \
    --cc=rostedt@goodmis.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