linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Paul E. McKenney" <paulmck@linux.ibm.com>
To: linux-kernel@vger.kernel.org
Cc: mingo@kernel.org, jiangshanlai@gmail.com, dipankar@in.ibm.com,
	akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
	josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
	rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
	fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org,
	"Paul E. McKenney" <paulmck@linux.ibm.com>,
	Andy Whitcroft <apw@canonical.com>, Joe Perches <joe@perches.com>
Subject: [PATCH tip/core/rcu 14/14] checkpatch.pl: Suggest lockdep instead of asserting !spin_is_locked()
Date: Sun, 11 Nov 2018 11:29:04 -0800	[thread overview]
Message-ID: <20181111192904.3199-14-paulmck@linux.ibm.com> (raw)
In-Reply-To: <20181111192839.GA32144@linux.ibm.com>

This commit points people who might otherwise code up something like
WARN_ON(!spin_is_locked(&mylock)) to lockdep_assert_held(&mylock).

Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Cc: Andy Whitcroft <apw@canonical.com>
Cc: Joe Perches <joe@perches.com>
---
 scripts/checkpatch.pl | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index dd29e3c28166..377f373db6c0 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6389,6 +6389,12 @@ sub process {
 			     "please use device_initcall() or more appropriate function instead of __initcall() (see include/linux/init.h)\n" . $herecurr);
 		}
 
+# check for spin_is_locked(), suggest lockdep instead
+		if ($line =~ /\bspin_is_locked\(/) {
+			WARN("USE_LOCKDEP",
+			     "Where possible, use lockdep_assert_held instead of assertions based on spin_is_locked\n" . $herecurr);
+		}
+
 # check for deprecated apis
 		if ($line =~ /\b($deprecated_apis_search)\b\s*\(/) {
 			my $deprecated_api = $1;
-- 
2.17.1


      parent reply	other threads:[~2018-11-11 19:29 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-11 19:28 [PATCH tip/core/rcu 0/14] Miscellaneous fixes for v4.21/v5.0 Paul E. McKenney
2018-11-11 19:28 ` [PATCH tip/core/rcu 01/14] rcu: Stop expedited grace periods from relying on stop-machine Paul E. McKenney
2018-11-11 19:28 ` [PATCH tip/core/rcu 02/14] MAINTAINERS: Update from @linux.vnet.ibm.com to @linux.ibm.com Paul E. McKenney
2018-11-11 19:28 ` [PATCH tip/core/rcu 03/14] rcu: Avoid double multiply by HZ Paul E. McKenney
2018-11-11 19:28 ` [PATCH tip/core/rcu 04/14] rcu: Parameterize rcu_check_gp_start_stall() Paul E. McKenney
2018-11-11 19:28 ` [PATCH tip/core/rcu 05/14] rcu: Add state name to show_rcu_gp_kthreads() output Paul E. McKenney
2018-11-11 19:28 ` [PATCH tip/core/rcu 06/14] rcu: Add jiffies-since-GP-activity to show_rcu_gp_kthreads() Paul E. McKenney
2018-11-11 19:28 ` [PATCH tip/core/rcu 07/14] rcu: Adjust the comment of function rcu_is_watching Paul E. McKenney
2018-11-11 19:28 ` [PATCH tip/core/rcu 08/14] rcu: Trace end of grace period before end of grace period Paul E. McKenney
2018-11-11 19:28 ` [PATCH tip/core/rcu 09/14] rcu: Speed up expedited GPs when interrupting RCU reader Paul E. McKenney
2018-11-11 19:29 ` [PATCH tip/core/rcu 10/14] rcu: Replace this_cpu_ptr() with __this_cpu_read() Paul E. McKenney
2018-11-11 19:29 ` [PATCH tip/core/rcu 11/14] rcu: Avoid signed integer overflow in rcu_preempt_deferred_qs() Paul E. McKenney
2018-11-11 19:29 ` [PATCH tip/core/rcu 12/14] MAINTAINERS: Add Joel Fernandes as RCU reviewer Paul E. McKenney
2018-11-11 19:29 ` [PATCH tip/core/rcu 13/14] checkpatch: Create table of obsolete APIs and apply to RCU Paul E. McKenney
2018-11-11 19:29 ` Paul E. McKenney [this message]

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=20181111192904.3199-14-paulmck@linux.ibm.com \
    --to=paulmck@linux.ibm.com \
    --cc=akpm@linux-foundation.org \
    --cc=apw@canonical.com \
    --cc=dhowells@redhat.com \
    --cc=dipankar@in.ibm.com \
    --cc=edumazet@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jiangshanlai@gmail.com \
    --cc=joe@perches.com \
    --cc=joel@joelfernandes.org \
    --cc=josh@joshtriplett.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mingo@kernel.org \
    --cc=oleg@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).