From: "Joel Fernandes (Google)" <joel@joelfernandes.org>
To: linux-kernel@vger.kernel.org
Cc: "Joel Fernandes (Google)" <joel@joelfernandes.org>,
Andy Whitcroft <apw@canonical.com>,
Dwaipayan Ray <dwaipayanray1@gmail.com>,
Joe Perches <joe@perches.com>,
Lukas Bulwahn <lukas.bulwahn@gmail.com>,
"Paul E. McKenney" <paulmck@kernel.org>,
RCU <rcu@vger.kernel.org>,
Oleksiy Avramchenko <oleksiy.avramchenko@sony.com>,
Jens Axboe <axboe@kernel.dk>,
Philipp Reisner <philipp.reisner@linbit.com>,
Bryan Tan <bryantan@vmware.com>,
Steven Rostedt <rostedt@goodmis.org>,
Eric Dumazet <edumazet@google.com>,
Bob Pearson <rpearsonhpe@gmail.com>,
Ariel Levkovich <lariel@nvidia.com>,
"Theodore Ts'o" <tytso@mit.edu>, Julian Anastasov <ja@ssi.bg>,
Uladzislau Rezki <urezki@gmail.com>
Subject: [PATCH] checkpatch: Error out if deprecated RCU API used
Date: Tue, 7 Mar 2023 03:04:57 +0000 [thread overview]
Message-ID: <20230307030457.3499834-1-joel@joelfernandes.org> (raw)
Single-argument kvfree_rcu() usage is being deprecated [1] [2] as it is
error-prone. However, till all users are converted, we would like to introduce
checkpatch errors for new patches submitted.
This patch adds support for the same. Tested with a trial patch.
For now, we are only considering usages that don't have compound
nesting, for example ignore: kvfree_rcu( (rcu_head_obj), rcu_head_name).
This is sufficient as such usages are unlikely.
Once all users are converted and we remove the old API, we can also revert this
checkpatch patch then.
[1] https://lore.kernel.org/rcu/CAEXW_YRhHaVuq+5f+VgCZM=SF+9xO+QXaxe0yE7oA9iCXK-XPg@mail.gmail.com/
[2] https://lore.kernel.org/rcu/CAEXW_YSY=q2_uaE2qo4XSGjzs4+C102YMVJ7kWwuT5LGmJGGew@mail.gmail.com/
Signed-off-by: Joel Fernandes (Google) <joel@joelfernandes.org>
---
scripts/checkpatch.pl | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index bd44d12965c9..9da0a3cb1615 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6388,6 +6388,15 @@ sub process {
}
}
+# check for soon-to-be-deprecated single-argument k[v]free_rcu() API
+ if ($line =~ /\bk[v]?free_rcu\s*\([^(]+\)/) {
+ if ($line =~ /\bk[v]?free_rcu\s*\([^,]+\)/) {
+ ERROR("DEPRECATED_API",
+ "Single-argument k[v]free_rcu() API is deprecated, please call the API with an rcu_head object passed, like: k[v]free_rcu(object_ptr, rcu_head_name); " . $herecurr);
+ }
+ }
+
+
# check for unnecessary "Out of Memory" messages
if ($line =~ /^\+.*\b$logFunctions\s*\(/ &&
$prevline =~ /^[ \+]\s*if\s*\(\s*(\!\s*|NULL\s*==\s*)?($Lval)(\s*==\s*NULL\s*)?\s*\)/ &&
--
2.40.0.rc0.216.gc4246ad0f0-goog
next reply other threads:[~2023-03-07 3:05 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 3:04 Joel Fernandes (Google) [this message]
2023-03-07 3:08 ` Joe Perches
2023-03-07 3:10 ` Joel Fernandes
2023-03-07 3:23 ` Joe Perches
2023-03-07 4:41 ` Joel Fernandes
2023-03-07 4:53 ` Joe Perches
2023-03-07 5:11 ` Joel Fernandes
2023-03-07 5:22 ` Joe Perches
2023-03-07 5:32 ` Joel Fernandes
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=20230307030457.3499834-1-joel@joelfernandes.org \
--to=joel@joelfernandes.org \
--cc=apw@canonical.com \
--cc=axboe@kernel.dk \
--cc=bryantan@vmware.com \
--cc=dwaipayanray1@gmail.com \
--cc=edumazet@google.com \
--cc=ja@ssi.bg \
--cc=joe@perches.com \
--cc=lariel@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lukas.bulwahn@gmail.com \
--cc=oleksiy.avramchenko@sony.com \
--cc=paulmck@kernel.org \
--cc=philipp.reisner@linbit.com \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=rpearsonhpe@gmail.com \
--cc=tytso@mit.edu \
--cc=urezki@gmail.com \
/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®