Skip to content

Commit 8076972

Browse files
jognesspmladek
authored andcommitted
printk: Update @console_may_schedule in console_trylock_spinning()
console_trylock_spinning() may takeover the console lock from a schedulable context. Update @console_may_schedule to make sure it reflects a trylock acquire. Reported-by: Mukesh Ojha <quic_mojha@quicinc.com> Closes: https://lore.kernel.org/lkml/20240222090538.23017-1-quic_mojha@quicinc.com Fixes: dbdda84 ("printk: Add console owner and waiter logic to load balance console writes") Signed-off-by: John Ogness <john.ogness@linutronix.de> Reviewed-by: Mukesh Ojha <quic_mojha@quicinc.com> Reviewed-by: Petr Mladek <pmladek@suse.com> Link: https://lore.kernel.org/r/875xybmo2z.fsf@jogness.linutronix.de Signed-off-by: Petr Mladek <pmladek@suse.com>
1 parent b054677 commit 8076972

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

kernel/printk/printk.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2009,6 +2009,12 @@ static int console_trylock_spinning(void)
20092009
*/
20102010
mutex_acquire(&console_lock_dep_map, 0, 1, _THIS_IP_);
20112011

2012+
/*
2013+
* Update @console_may_schedule for trylock because the previous
2014+
* owner may have been schedulable.
2015+
*/
2016+
console_may_schedule = 0;
2017+
20122018
return 1;
20132019
}
20142020

0 commit comments

Comments
 (0)