Skip to content

Commit

Permalink
printk, lockdep: Disable lock debugging on zap_locks()
Browse files Browse the repository at this point in the history
zap_locks() is used by printk() in a last ditch effort to get data
out, clearly we cannot trust lock state after this so make it disable
lock debugging.

Also don't treat printk recursion through lockdep as a normal
recursion bug but try hard to get the lockdep splat out.

Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/n/tip-kqxwmo4xz37e1s8w0xopvr0q@git.kernel.org
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Peter Zijlstra authored and Ingo Molnar committed Nov 14, 2011
1 parent 7f80850 commit 94d24fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
4 changes: 4 additions & 0 deletions include/linux/lockdep.h
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ extern void lockdep_trace_alloc(gfp_t mask);

#define lockdep_assert_held(l) WARN_ON(debug_locks && !lockdep_is_held(l))

#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)

#else /* !LOCKDEP */

static inline void lockdep_off(void)
Expand Down Expand Up @@ -392,6 +394,8 @@ struct lock_class_key { };

#define lockdep_assert_held(l) do { } while (0)

#define lockdep_recursing(tsk) (0)

#endif /* !LOCKDEP */

#ifdef CONFIG_LOCK_STAT
Expand Down
3 changes: 2 additions & 1 deletion kernel/printk.c
Original file line number Diff line number Diff line change
Expand Up @@ -688,6 +688,7 @@ static void zap_locks(void)

oops_timestamp = jiffies;

debug_locks_off();
/* If a crash is occurring, make sure we can't deadlock */
raw_spin_lock_init(&logbuf_lock);
/* And make sure that we print immediately */
Expand Down Expand Up @@ -856,7 +857,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
* recursion and return - but flag the recursion so that
* it can be printed at the next appropriate moment:
*/
if (!oops_in_progress) {
if (!oops_in_progress && !lockdep_recursing(current)) {
recursion_bug = 1;
goto out_restore_irqs;
}
Expand Down

0 comments on commit 94d24fc

Please sign in to comment.