printk: Keep non-panic-CPUs out of console lock
authorJohn Ogness <john.ogness@linutronix.de>
Mon, 17 Jul 2023 19:46:03 +0000 (21:52 +0206)
committerPetr Mladek <pmladek@suse.com>
Thu, 20 Jul 2023 11:06:22 +0000 (13:06 +0200)
commit51a1d258e50e03a0216bf42b6af9ff34ec402ac1
tree4ee8e6c60cb6b01cce664a7e6f802031b6268ac3
parent7b23a66db55ed0a55b020e913f0d6f6d52a1ad2c
printk: Keep non-panic-CPUs out of console lock

When in a panic situation, non-panic CPUs should avoid holding the
console lock so as not to contend with the panic CPU. This is already
implemented with abandon_console_lock_in_panic(), which is checked
after each printed line. However, non-panic CPUs should also avoid
trying to acquire the console lock during a panic.

Modify console_trylock() to fail and console_lock() to block() when
called from a non-panic CPU during a panic.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20230717194607.145135-4-john.ogness@linutronix.de
kernel/printk/printk.c