Commit 2f850181 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

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: default avatarHeiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Nick Piggin <npiggin@suse.de>
LKML-Reference: <1237544000.24626.52.camel@twins>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 19cefdff
...@@ -2260,7 +2260,7 @@ void trace_softirqs_off(unsigned long ip) ...@@ -2260,7 +2260,7 @@ void trace_softirqs_off(unsigned long ip)
debug_atomic_inc(&redundant_softirqs_off); debug_atomic_inc(&redundant_softirqs_off);
} }
void lockdep_trace_alloc(gfp_t gfp_mask) static void __lockdep_trace_alloc(gfp_t gfp_mask, unsigned long flags)
{ {
struct task_struct *curr = current; struct task_struct *curr = current;
...@@ -2279,12 +2279,29 @@ void lockdep_trace_alloc(gfp_t gfp_mask) ...@@ -2279,12 +2279,29 @@ void lockdep_trace_alloc(gfp_t gfp_mask)
if (!(gfp_mask & __GFP_FS)) if (!(gfp_mask & __GFP_FS))
return; return;
if (DEBUG_LOCKS_WARN_ON(irqs_disabled())) if (DEBUG_LOCKS_WARN_ON(irqs_disabled_flags(flags)))
return; return;
mark_held_locks(curr, RECLAIM_FS); mark_held_locks(curr, RECLAIM_FS);
} }
static void check_flags(unsigned long flags);
void lockdep_trace_alloc(gfp_t gfp_mask)
{
unsigned long flags;
if (unlikely(current->lockdep_recursion))
return;
raw_local_irq_save(flags);
check_flags(flags);
current->lockdep_recursion = 1;
__lockdep_trace_alloc(gfp_mask, flags);
current->lockdep_recursion = 0;
raw_local_irq_restore(flags);
}
static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock) static int mark_irqflags(struct task_struct *curr, struct held_lock *hlock)
{ {
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment