]> git.baikalelectronics.ru Git - kernel.git/commit
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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 23 Sep 2023 09:11:07 +0000 (11:11 +0200)
commit13ebf3ff08b046fc798dc82a42d73713cb03eded
tree9c7d704fba514efdecb574d1e61c8ff0c35a3033
parentee42bfc791aa3cd78e29046f26a09d189beb3efb
printk: Keep non-panic-CPUs out of console lock

[ Upstream commit 51a1d258e50e03a0216bf42b6af9ff34ec402ac1 ]

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
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/printk/printk.c