public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* lockdep: fix deadlock in lockdep_trace_alloc
@ 2009-03-20 10:13 Peter Zijlstra
  2009-03-20 10:26 ` [PATCH] " Peter Zijlstra
                   ` (2 more replies)
  0 siblings, 3 replies; 9+ messages in thread
From: Peter Zijlstra @ 2009-03-20 10:13 UTC (permalink / raw)
  To: Heiko Carstens, Ingo Molnar; +Cc: Nick Piggin, lkml,

Heiko reported that we grab the graph lock with irqs enabled.

Fix this by providng the same wrapper as all other lockdep entry
functions have.

Reported-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
---
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 3e1cc47..a39cb6d 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2258,7 +2258,7 @@ void trace_softirqs_off(unsigned long ip)
 		debug_atomic_inc(&redundant_softirqs_off);
 }
 
-void lockdep_trace_alloc(gfp_t gfp_mask)
+static void __lockdep_trace_alloc(gfp_t gfp_mask)
 {
 	struct task_struct *curr = current;
 
@@ -2283,6 +2283,20 @@ void lockdep_trace_alloc(gfp_t gfp_mask)
 	mark_held_locks(curr, RECLAIM_FS);
 }
 
+void lockdep_trace_alloc(gfp_t gfp_mask)
+{
+	unsigned long flags;
+
+	if (unlikely(current->lockdep_recursion))
+		return;
+
+	raw_local_irq_save(flags);
+	current->lockdep_recursion = 1;
+	__lockdep_trace_alloc(gfp_mask);
+	current->lockdep_recursion = 0;
+	raw_local_irq_restore(flags);
+}
+
 static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock)
 {
 	/*


^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2009-03-30 21:25 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-20 10:13 lockdep: fix deadlock in lockdep_trace_alloc Peter Zijlstra
2009-03-20 10:26 ` [PATCH] " Peter Zijlstra
2009-03-20 13:07   ` Heiko Carstens
2009-03-20 13:45     ` Peter Zijlstra
2009-03-20 14:00       ` Heiko Carstens
2009-03-20 10:26 ` [tip:core/locking] " Peter Zijlstra
2009-03-21 12:33   ` [PATCH] lockdep: fix deadlock in lockdep_trace_alloc -v2 Peter Zijlstra
2009-03-21 16:18     ` [tip:core/locking] lockdep: fix deadlock in lockdep_trace_alloc, take 2 Peter Zijlstra
2009-03-30 21:24 ` [tip:core/locking-v2] lockdep: fix deadlock in lockdep_trace_alloc Peter Zijlstra

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox