Skip to content

Commit 6b898c0

Browse files
danvetgregkh
authored andcommitted
console: use might_sleep in console_lock
Instead of BUG_ON(in_interrupt()), since that doesn't check for all the newfangled stuff like preempt. Note that this is valid since the console_sem is essentially used like a real mutex with only two twists: - we allow trylock from hardirq context - across suspend/resume we lock the logical console_lock, but drop the semaphore protecting the locking state. Now that doesn't guarantee that no one is playing tricks in single-thread atomic contexts at suspend/resume/boot time, but - I couldn't find anything suspicious with some grepping, - might_sleep shouldn't die, - and I think the upside of catching more potential issues is worth the risk of getting a might_sleep backtrace that would have been save (and then dealing with that fallout). Cc: Dave Airlie <airlied@gmail.com> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Alan Cox <alan@lxorguk.ukuu.org.uk> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent ecbbfd4 commit 6b898c0

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

kernel/printk.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1914,7 +1914,8 @@ static int __cpuinit console_cpu_notify(struct notifier_block *self,
19141914
*/
19151915
void console_lock(void)
19161916
{
1917-
BUG_ON(in_interrupt());
1917+
might_sleep();
1918+
19181919
down(&console_sem);
19191920
if (console_suspended)
19201921
return;

0 commit comments

Comments
 (0)