linux/include
John Ogness 187de7c212 printk: nbcon: Allow unsafe write_atomic() for panic
There may be console drivers that have not yet figured out a way
to implement safe atomic printing (->write_atomic() callback).
These drivers could choose to only implement threaded printing
(->write_thread() callback), but then it is guaranteed that _no_
output will be printed during panic. Not even attempted.

As a result, developers may be tempted to implement unsafe
->write_atomic() callbacks and/or implement some sort of custom
deferred printing trickery to try to make it work. This goes
against the principle intention of the nbcon API as well as
endangers other nbcon drivers that are doing things correctly
(safely).

As a compromise, allow nbcon drivers to implement unsafe
->write_atomic() callbacks by providing a new console flag
CON_NBCON_ATOMIC_UNSAFE. When specified, the ->write_atomic()
callback for that console will _only_ be called during the
final "hope and pray" flush attempt at the end of a panic:
nbcon_atomic_flush_unsafe().

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Link: https://lore.kernel.org/lkml/b2qps3uywhmjaym4mht2wpxul4yqtuuayeoq4iv4k3zf5wdgh3@tocu6c7mj4lt
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/all/swdpckuwwlv3uiessmtnf2jwlx3jusw6u7fpk5iggqo4t2vdws@7rpjso4gr7qp/ [1]
Link: https://lore.kernel.org/all/20251103-fix_netpoll_aa-v4-1-4cfecdf6da7c@debian.org/ [2]
Link: https://patch.msgid.link/20251027161212.334219-2-john.ogness@linutronix.de
[pmladek@suse.com: Fix build with rework/nbcon-in-kdb branch.]
Signed-off-by: Petr Mladek <pmladek@suse.com>
2025-11-07 14:30:52 +01:00
..
acpi Merge branches 'acpi-scan', 'acpi-processor' and 'acpi-sysfs' 2025-09-29 15:12:52 +02:00
asm-generic Summary of significant series in this pull request: 2025-10-02 18:18:33 -07:00
clocksource clocksource/drivers/arm_arch_timer_mmio: Switch over to standalone driver 2025-09-23 12:31:50 +02:00
crypto Summary of significant series in this pull request: 2025-10-02 18:18:33 -07:00
cxl
drm amd-drm-next-6.18-2025-09-19: 2025-09-22 08:45:51 +10:00
dt-bindings soc: build fix for 6.18 2025-10-03 19:36:39 -07:00
hyperv
keys
kunit linux_kselftest-kunit-6.18-rc1 2025-10-01 19:15:11 -07:00
kvm KVM/arm64 updates for 6.18 2025-09-30 13:23:28 -04:00
linux printk: nbcon: Allow unsafe write_atomic() for panic 2025-11-07 14:30:52 +01:00
math-emu
media
memory
misc
net Networking changes for 6.18. 2025-10-02 15:17:01 -07:00
pcmcia
ras
rdma
rv kernel-6.18-rc1.clone3 2025-09-29 10:36:50 -07:00
scsi SCSI misc on 20251002 2025-10-03 19:17:48 -07:00
soc ARM: soc updates for 6.18 2025-10-01 17:41:15 -07:00
sound ASoC: Updates for v6.18 round 2 2025-09-28 15:41:17 +02:00
target
trace guest_memfd: 2025-10-04 08:52:16 -07:00
uapi guest_memfd: 2025-10-04 08:52:16 -07:00
ufs scsi: ufs: core: Fix data race in CPU latency PM QoS request handling 2025-09-24 21:59:14 -04:00
vdso Updates for the VDSO subsystem: 2025-09-30 16:58:21 -07:00
video
xen
Kbuild