Skip to content

Commit 4f132d8

Browse files
committed
Merge branch 'rework/threaded-printk' into for-linus
2 parents 3a9a3f5 + 2079395 commit 4f132d8

1 file changed

Lines changed: 7 additions & 10 deletions

File tree

kernel/printk/printk.c

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3023,21 +3023,18 @@ bool printk_get_next_message(struct printk_message *pmsg, u64 seq,
30233023
}
30243024

30253025
/*
3026-
* Legacy console printing from printk() caller context does not respect
3027-
* raw_spinlock/spinlock nesting. For !PREEMPT_RT the lockdep warning is a
3028-
* false positive. For PREEMPT_RT the false positive condition does not
3029-
* occur.
3030-
*
3031-
* This map is used to temporarily establish LD_WAIT_SLEEP context for the
3032-
* console write() callback when legacy printing to avoid false positive
3033-
* lockdep complaints, thus allowing lockdep to continue to function for
3034-
* real issues.
3026+
* The legacy console always acquires a spinlock_t from its printing
3027+
* callback. This violates lock nesting if the caller acquired an always
3028+
* spinning lock (raw_spinlock_t) while invoking printk(). This is not a
3029+
* problem on PREEMPT_RT because legacy consoles print always from a
3030+
* dedicated thread and never from within printk(). Therefore we tell
3031+
* lockdep that a sleeping spin lock (spinlock_t) is valid here.
30353032
*/
30363033
#ifdef CONFIG_PREEMPT_RT
30373034
static inline void printk_legacy_allow_spinlock_enter(void) { }
30383035
static inline void printk_legacy_allow_spinlock_exit(void) { }
30393036
#else
3040-
static DEFINE_WAIT_OVERRIDE_MAP(printk_legacy_map, LD_WAIT_SLEEP);
3037+
static DEFINE_WAIT_OVERRIDE_MAP(printk_legacy_map, LD_WAIT_CONFIG);
30413038

30423039
static inline void printk_legacy_allow_spinlock_enter(void)
30433040
{

0 commit comments

Comments
 (0)