Skip to content

Commit 84dd7f1

Browse files
committed
checkpatch: Complain about unexpected uses of RCU Tasks Trace
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. [ paulmck: Apply Joe Perches feedback. ] Cc: Andy Whitcroft <[email protected]> (maintainer:CHECKPATCH) Cc: Joe Perches <[email protected]> (maintainer:CHECKPATCH) Cc: Dwaipayan Ray <[email protected]> (reviewer:CHECKPATCH) Cc: Lukas Bulwahn <[email protected]> Cc: Alexei Starovoitov <[email protected]> Cc: Daniel Borkmann <[email protected]> Cc: John Fastabend <[email protected]> Cc: <[email protected]> Signed-off-by: Paul E. McKenney <[email protected]>
1 parent db13710 commit 84dd7f1

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

scripts/checkpatch.pl

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7457,6 +7457,30 @@ sub process {
74577457
}
74587458
}
74597459

7460+
# Complain about RCU Tasks Trace used outside of BPF (and of course, RCU).
7461+
our $rcu_trace_funcs = qr{(?x:
7462+
rcu_read_lock_trace |
7463+
rcu_read_lock_trace_held |
7464+
rcu_read_unlock_trace |
7465+
call_rcu_tasks_trace |
7466+
synchronize_rcu_tasks_trace |
7467+
rcu_barrier_tasks_trace |
7468+
rcu_request_urgent_qs_task
7469+
)};
7470+
our $rcu_trace_paths = qr{(?x:
7471+
kernel/bpf/ |
7472+
include/linux/bpf |
7473+
net/bpf/ |
7474+
kernel/rcu/ |
7475+
include/linux/rcu
7476+
)};
7477+
if ($line =~ /\b($rcu_trace_funcs)\s*\(/) {
7478+
if ($realfile !~ m{^$rcu_trace_paths}) {
7479+
WARN("RCU_TASKS_TRACE",
7480+
"use of RCU tasks trace is incorrect outside BPF or core RCU code\n" . $herecurr);
7481+
}
7482+
}
7483+
74607484
# check for lockdep_set_novalidate_class
74617485
if ($line =~ /^.\s*lockdep_set_novalidate_class\s*\(/ ||
74627486
$line =~ /__lockdep_no_validate__\s*\)/ ) {

0 commit comments

Comments
 (0)