printk: nbcon: Add unsafe flushing on panic
authorJohn Ogness <john.ogness@linutronix.de>
Tue, 20 Aug 2024 06:29:52 +0000 (08:35 +0206)
committerPetr Mladek <pmladek@suse.com>
Wed, 21 Aug 2024 12:56:24 +0000 (14:56 +0200)
commit5dde3b7354133846079fa51e55e74ef90a836759
tree28e69b6323463f7e8b403154158eb7028b46ae0c
parentd2e85ca7a736d2d889bac9aef6ede0a67f6870b2
printk: nbcon: Add unsafe flushing on panic

Add nbcon_atomic_flush_unsafe() to flush all nbcon consoles
using the write_atomic() callback and allowing unsafe hostile
takeovers. Call this at the end of panic() as a final attempt
to flush any pending messages.

Note that legacy consoles use unsafe methods for flushing
from the beginning of panic (see bust_spinlocks()). Therefore,
systems using both legacy and nbcon consoles may still fail to
see panic messages due to unsafe legacy console usage.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20240820063001.36405-27-john.ogness@linutronix.de
Signed-off-by: Petr Mladek <pmladek@suse.com>
include/linux/printk.h
kernel/panic.c
kernel/printk/nbcon.c