Skip to content

Commit 1483b38

Browse files
committed
Merge branch 'core-printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
* 'core-printk-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: printk, lockdep: Switch to tracked irq ops printk, lockdep: Remove superfluous preempt_disable() printk, lockdep: Disable lock debugging on zap_locks()
2 parents 4a2164a + 1a9a8ae commit 1483b38

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

include/linux/lockdep.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,6 +343,8 @@ extern void lockdep_trace_alloc(gfp_t mask);
343343

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

346+
#define lockdep_recursing(tsk) ((tsk)->lockdep_recursion)
347+
346348
#else /* !LOCKDEP */
347349

348350
static inline void lockdep_off(void)
@@ -392,6 +394,8 @@ struct lock_class_key { };
392394

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

397+
#define lockdep_recursing(tsk) (0)
398+
395399
#endif /* !LOCKDEP */
396400

397401
#ifdef CONFIG_LOCK_STAT

kernel/printk.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -688,6 +688,7 @@ static void zap_locks(void)
688688

689689
oops_timestamp = jiffies;
690690

691+
debug_locks_off();
691692
/* If a crash is occurring, make sure we can't deadlock */
692693
raw_spin_lock_init(&logbuf_lock);
693694
/* And make sure that we print immediately */
@@ -840,9 +841,8 @@ asmlinkage int vprintk(const char *fmt, va_list args)
840841
boot_delay_msec();
841842
printk_delay();
842843

843-
preempt_disable();
844844
/* This stops the holder of console_sem just where we want him */
845-
raw_local_irq_save(flags);
845+
local_irq_save(flags);
846846
this_cpu = smp_processor_id();
847847

848848
/*
@@ -856,7 +856,7 @@ asmlinkage int vprintk(const char *fmt, va_list args)
856856
* recursion and return - but flag the recursion so that
857857
* it can be printed at the next appropriate moment:
858858
*/
859-
if (!oops_in_progress) {
859+
if (!oops_in_progress && !lockdep_recursing(current)) {
860860
recursion_bug = 1;
861861
goto out_restore_irqs;
862862
}
@@ -962,9 +962,8 @@ asmlinkage int vprintk(const char *fmt, va_list args)
962962

963963
lockdep_on();
964964
out_restore_irqs:
965-
raw_local_irq_restore(flags);
965+
local_irq_restore(flags);
966966

967-
preempt_enable();
968967
return printed_len;
969968
}
970969
EXPORT_SYMBOL(printk);

0 commit comments

Comments
 (0)