LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@elte.hu>
Subject: [PATCH 1/2] lockdep: implement full check without irq checking
Date: Thu, 23 Oct 2008 21:44:32 +0200	[thread overview]
Message-ID: <1224791072.6002.63.camel@johannes.berg> (raw)
In-Reply-To: <1224790541.6002.53.camel@johannes.berg>

This patch implements a new check type "3" which means "full validation
but without irq tracing" in order to allow some certain fake locks that
are only added for deadlock detection to not cause inconsistent state
warnings which would be inappropriate for them.

Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
---
 include/linux/lockdep.h |    4 ++++
 kernel/lockdep.c        |    2 +-
 2 files changed, 5 insertions(+), 1 deletion(-)

--- wireless-testing.orig/include/linux/lockdep.h	2008-10-23 21:06:25.837224864 +0200
+++ wireless-testing/include/linux/lockdep.h	2008-10-23 21:32:09.889809433 +0200
@@ -301,6 +301,7 @@ extern void lockdep_init_map(struct lock
  *   0: disabled
  *   1: simple checks (freeing, held-at-exit-time, etc.)
  *   2: full validation
+ *   3: full validation without irq tracing
  */
 extern void lock_acquire(struct lockdep_map *lock, unsigned int subclass,
 			 int trylock, int read, int check,
@@ -471,12 +472,15 @@ static inline void print_irqtrace_events
 #ifdef CONFIG_DEBUG_LOCK_ALLOC
 # ifdef CONFIG_PROVE_LOCKING
 #  define lock_map_acquire(l)		lock_acquire(l, 0, 0, 0, 2, NULL, _THIS_IP_)
+#  define lock_map_acquire_noirq(l)	lock_acquire(l, 0, 0, 0, 3, NULL, _THIS_IP_)
 # else
 #  define lock_map_acquire(l)		lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_)
+#  define lock_map_acquire_noirq(l)	lock_acquire(l, 0, 0, 0, 1, NULL, _THIS_IP_)
 # endif
 # define lock_map_release(l)			lock_release(l, 1, _THIS_IP_)
 #else
 # define lock_map_acquire(l)			do { } while (0)
+# define lock_map_acquire_noirq(l)		do { } while (0)
 # define lock_map_release(l)			do { } while (0)
 #endif
 
--- wireless-testing.orig/kernel/lockdep.c	2008-10-23 21:06:25.881976762 +0200
+++ wireless-testing/kernel/lockdep.c	2008-10-23 21:13:43.460100511 +0200
@@ -1695,7 +1695,7 @@ static int validate_chain(struct task_st
 	 * (If lookup_chain_cache() returns with 1 it acquires
 	 * graph_lock for us)
 	 */
-	if (!hlock->trylock && (hlock->check == 2) &&
+	if (!hlock->trylock && (hlock->check >= 2) &&
 	    lookup_chain_cache(curr, hlock, chain_key)) {
 		/*
 		 * Check whether last held lock:



  reply	other threads:[~2008-10-24  9:45 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-10-23 19:35 [PATCH 0/2] Timer sync lock checking Johannes Berg
2008-10-23 19:44 ` Johannes Berg [this message]
2008-10-29 15:23   ` [PATCH 1/2] lockdep: implement full check without irq checking Peter Zijlstra
2008-10-30 10:36     ` Johannes Berg
2008-10-30 11:15       ` Peter Zijlstra
2008-10-30 11:25         ` Johannes Berg
2008-10-23 19:46 ` [PATCH 2/2] timer: implement lockdep deadlock detection Johannes Berg
2008-10-23 20:37 ` [PATCH 3/2] tasklet: " Johannes Berg

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=1224791072.6002.63.camel@johannes.berg \
    --to=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=tglx@linutronix.de \
    --subject='Re: [PATCH 1/2] lockdep: implement full check without irq checking' \
    /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

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).