aboutsummaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorPeter Zijlstra <peterz@infradead.org>2009-03-20 06:13:20 -0400
committerIngo Molnar <mingo@elte.hu>2009-03-30 17:19:24 -0400
commit2f8501815256af8498904e68bd0984b1afffd6f8 (patch)
treeffc9b4d8d80906fc2743b34dcdc93fdd2294f2c6 /kernel
parent19cefdffbfe0f7e280f21e80875937e8700e99e2 (diff)
lockdep: fix deadlock in lockdep_trace_alloc
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> Cc: Nick Piggin <npiggin@suse.de> LKML-Reference: <1237544000.24626.52.camel@twins> Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/lockdep.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/kernel/lockdep.c b/kernel/lockdep.c
index 022d2ed7fd8b..3673a3f44d9d 100644
--- a/kernel/lockdep.c
+++ b/kernel/lockdep.c
@@ -2260,7 +2260,7 @@ void trace_softirqs_off(unsigned long ip)
2260 debug_atomic_inc(&redundant_softirqs_off); 2260 debug_atomic_inc(&redundant_softirqs_off);
2261} 2261}
2262 2262
2263void lockdep_trace_alloc(gfp_t gfp_mask) 2263static void __lockdep_trace_alloc(gfp_t gfp_mask, unsigned long flags)
2264{ 2264{
2265 struct task_struct *curr = current; 2265 struct task_struct *curr = current;
2266 2266
@@ -2279,12 +2279,29 @@ void lockdep_trace_alloc(gfp_t gfp_mask)
2279 if (!(gfp_mask & __GFP_FS)) 2279 if (!(gfp_mask & __GFP_FS))
2280 return; 2280 return;
2281 2281
2282 if (DEBUG_LOCKS_WARN_ON(irqs_disabled())) 2282 if (DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)))
2283 return; 2283 return;
2284 2284
2285 mark_held_locks(curr, RECLAIM_FS); 2285 mark_held_locks(curr, RECLAIM_FS);
2286} 2286}
2287 2287
2288static void check_flags(unsigned long flags);
2289
2290void lockdep_trace_alloc(gfp_t gfp_mask)
2291{
2292 unsigned long flags;
2293
2294 if (unlikely(current->lockdep_recursion))
2295 return;
2296
2297 raw_local_irq_save(flags);
2298 check_flags(flags);
2299 current->lockdep_recursion = 1;
2300 __lockdep_trace_alloc(gfp_mask, flags);
2301 current->lockdep_recursion = 0;
2302 raw_local_irq_restore(flags);
2303}
2304
2288static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock) 2305static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock)
2289{ 2306{
2290 /* 2307 /*