From: Joe Perches <joe@perches.com>
To: "Paul E. McKenney" <paulmck@kernel.org>, rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@meta.com,
rostedt@goodmis.org, Andy Whitcroft <apw@canonical.com>,
Dwaipayan Ray <dwaipayanray1@gmail.com>,
Lukas Bulwahn <lukas.bulwahn@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
bpf@vger.kernel.org
Subject: Re: [PATCH rcu 5/5] checkpatch: Complain about unexpected uses of RCU Tasks Trace
Date: Mon, 17 Jul 2023 15:34:14 -0700 [thread overview]
Message-ID: <04e74fd214a01bee0fb5ac690730cb386536cced.camel@perches.com> (raw)
In-Reply-To: <20230717180454.1097714-5-paulmck@kernel.org>
On Mon, 2023-07-17 at 11:04 -0700, Paul E. McKenney wrote:
> RCU Tasks Trace is quite specialized, having been created specifically
> for sleepable BPF programs. Because it allows general blocking within
> readers, any new use of RCU Tasks Trace must take current use cases into
> account. Therefore, update checkpatch.pl to complain about use of any of
> the RCU Tasks Trace API members outside of BPF and outside of RCU itself.
>
> Cc: Andy Whitcroft <apw@canonical.com> (maintainer:CHECKPATCH)
> Cc: Joe Perches <joe@perches.com> (maintainer:CHECKPATCH)
> Cc: Dwaipayan Ray <dwaipayanray1@gmail.com> (reviewer:CHECKPATCH)
> Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
> Cc: Alexei Starovoitov <ast@kernel.org>
> Cc: Daniel Borkmann <daniel@iogearbox.net>
> Cc: John Fastabend <john.fastabend@gmail.com>
> Cc: <bpf@vger.kernel.org>
> Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
> ---
> scripts/checkpatch.pl | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
[]
> @@ -7457,6 +7457,24 @@ sub process {
> }
> }
>
> +# Complain about RCU Tasks Trace used outside of BPF (and of course, RCU).
> + if ($line =~ /\brcu_read_lock_trace\s*\(/ ||
> + $line =~ /\brcu_read_lock_trace_held\s*\(/ ||
> + $line =~ /\brcu_read_unlock_trace\s*\(/ ||
> + $line =~ /\bcall_rcu_tasks_trace\s*\(/ ||
> + $line =~ /\bsynchronize_rcu_tasks_trace\s*\(/ ||
> + $line =~ /\brcu_barrier_tasks_trace\s*\(/ ||
> + $line =~ /\brcu_request_urgent_qs_task\s*\(/) {
> + if ($realfile !~ m@^kernel/bpf@ &&
> + $realfile !~ m@^include/linux/bpf@ &&
> + $realfile !~ m@^net/bpf@ &&
> + $realfile !~ m@^kernel/rcu@ &&
> + $realfile !~ m@^include/linux/rcu@) {
Functions and paths like these tend to be accreted.
Please use a variable or 2 like:
our $rcu_trace_funcs = qr{(?x:
rcu_read_lock_trace |
rcu_read_lock_trace_held |
rcu_read_unlock_trace |
call_rcu_tasks_trace |
synchronize_rcu_tasks_trace |
rcu_barrier_tasks_trace |
rcu_request_urgent_qs_task
)};
our $rcu_trace_paths = qr{(?x:
kernel/bfp/ |
include/linux/bpf |
net/bpf/ |
kernel/rcu/ |
include/linux/rcu
)};
...
if ($line =~ /\b($rcu_trace_funcs)\s*\(/ &&
$realfile !~ m{^$rcu_trace_paths}) {
WARN("RCU_TASKS_TRACE",
"use of RCU tasks trace '$1' is incorrect outside BPF or core RCU code\n" . $herecurr); }
}
next prev parent reply other threads:[~2023-07-17 22:34 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-17 18:04 [PATCH rcu 0/5] Tasks RCU updates for v6.6 Paul E. McKenney
2023-07-17 18:04 ` [PATCH rcu 1/5] rcu-tasks: Treat only synchronous grace periods urgently Paul E. McKenney
2023-07-17 18:04 ` [PATCH rcu 2/5] rcu-tasks: Remove redundant #ifdef CONFIG_TASKS_RCU Paul E. McKenney
2023-07-17 18:04 ` [PATCH rcu 3/5] rcu-tasks: Add kernel boot parameters for callback laziness Paul E. McKenney
2023-07-17 18:04 ` [PATCH rcu 4/5] rcu-tasks: Cancel callback laziness if too many callbacks Paul E. McKenney
2023-07-17 18:04 ` [PATCH rcu 5/5] checkpatch: Complain about unexpected uses of RCU Tasks Trace Paul E. McKenney
2023-07-17 22:34 ` Joe Perches [this message]
2023-07-17 23:34 ` Paul E. McKenney
2023-07-19 11:51 ` Joel Fernandes
2023-07-19 18:27 ` Paul E. McKenney
2023-07-19 18:44 ` Joe Perches
2023-07-19 19:02 ` Paul E. McKenney
2023-07-20 7:29 ` Joe Perches
2023-07-20 19:43 ` Paul E. McKenney
2023-07-21 3:56 ` Paul E. McKenney
2023-07-21 4:38 ` Joe Perches
2023-07-21 22:34 ` Paul E. McKenney
2023-07-31 23:11 ` [PATCH rcu 6/5] rcu-tasks: Permit use of debug-objects with RCU Tasks flavors Paul E. McKenney
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=04e74fd214a01bee0fb5ac690730cb386536cced.camel@perches.com \
--to=joe@perches.com \
--cc=apw@canonical.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dwaipayanray1@gmail.com \
--cc=john.fastabend@gmail.com \
--cc=kernel-team@meta.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=paulmck@kernel.org \
--cc=rcu@vger.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
all inboxes | Powered by JetHome®