mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH printk v4 0/8] Introduce policies for unsafe flushing
@ 2026-11-21 16:35 John Ogness
  2026-11-21 16:35 ` [PATCH printk v4 1/8] printk: Introduce and specify flush reasons John Ogness
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: John Ogness @ 2026-11-21 16:35 UTC (permalink / raw)
  To: Petr Mladek
  Cc: Sergey Senozhatsky, Steven Rostedt, Ryan Roberts, Breno Leitao,
	printk, linux-kernel, Andrew Morton, Rio, Danilo Krummrich,
	Greg Kroah-Hartman, Bradley Morgan, Pnina Feder,
	Alessandro Carminati, Gal Pressman, Baoquan He, Mike Rapoport,
	Pasha Tatashin, Pratyush Yadav, Dave Young, Pavel Tikhomirov,
	Oleg Nesterov, Bradley Morgan, Alex Elder, Cen Zhang (Microsoft),
	Petr Pavlu, kexec, Gustavo Luiz Duarte, Andrew Lunn,
	David S. Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev

v3 is here [0].

Until now unsafe flushing is only performed at the very end of
panic(), before entering the infinite loop. For other situations
(such as panic-kexec or panic-reboot or emergency-reboot) no
unsafe flushing is performed. The reasoning for this is because
an unsafe flush could lead to fireworks, which could prevent the
kexec or reboot from occurring.

However, some users may be willing to take on such risks in order
to see panic output. Indeed, for the netconsole (which does not
support safe atomic printing) it is a regression that such unsafe
printing does not occur. [1] 

This series adds unsafe flushing policy flags per-console to
allow individual consoles to perform unsafe flushing for such
scenarios. The unsafe flushing is hard-code-enabled for the
netconsole in patch 8/8. The justification is that this is not
less safe than the legacy netconsole.

Later these policy flags could be easily exposed to userspace
via /sys/class/consoles/, once the sysfs per-console interface
is available.

The first 5 patches have no functional changes.

Changes since v3:

- Restore WARN for non-panic hostile takeover attempts and
  expand the comment so I don't attempt this again.

- Rename nbcon_allow_unsafe_takeover() to nbcon_allow_unsafe()
  because it now allows general unsafe usage and not
  specifically hostile takeovers.

- In __nbcon_atomic_flush_pending(), additionally use
  panic_on_this_cpu() to determine if a hostile takeover is
  allowed.

John Ogness

[0] https://lore.kernel.org/lkml/20261118230345.808560-1-john.ogness@linutronix.de
[1] https://lore.kernel.org/lkml/20260915100140.3631650-1-ryan.roberts@arm.com

John Ogness (8):
  printk: Introduce and specify flush reasons
  printk: nbcon: Move unsafe takeover check to higher level
  printk: Move unsafe takeover check out of console_is_usable()
  printk: nbcon: Use @reason instead of global variable to check flush
    policy
  printk: nbcon: Expand unsafe takeover check for general unsafe
  console: Support unsafe flushing for panic/emergency restarts
  printk: Add unsafe flush points for panic+kexec and emergency_restart
  netconsole: Perform unsafe flushing on panic and emergency restart

 drivers/net/netconsole.c |   2 +
 include/linux/console.h  |  60 +++++++++++++++++-----
 include/linux/printk.h   |  20 +++++++-
 kernel/crash_core.c      |   1 +
 kernel/panic.c           |   2 +-
 kernel/printk/nbcon.c    | 105 ++++++++++++++++++++++++++++-----------
 kernel/reboot.c          |   1 +
 7 files changed, 147 insertions(+), 44 deletions(-)


base-commit: 52904cd86a5f8c83fd956d1b2b9cd12593597e7b
-- 
2.47.3


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2026-11-21 16:36 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-21 16:35 [PATCH printk v4 0/8] Introduce policies for unsafe flushing John Ogness
2026-11-21 16:35 ` [PATCH printk v4 1/8] printk: Introduce and specify flush reasons John Ogness
2026-11-21 16:35 ` [PATCH printk v4 2/8] printk: nbcon: Move unsafe takeover check to higher level John Ogness
2026-11-21 16:35 ` [PATCH printk v4 3/8] printk: Move unsafe takeover check out of console_is_usable() John Ogness
2026-11-21 16:35 ` [PATCH printk v4 4/8] printk: nbcon: Use @reason instead of global variable to check flush policy John Ogness
2026-11-21 16:35 ` [PATCH printk v4 5/8] printk: nbcon: Expand unsafe takeover check for general unsafe John Ogness
2026-11-21 16:35 ` [PATCH printk v4 6/8] console: Support unsafe flushing for panic/emergency restarts John Ogness
2026-11-21 16:35 ` [PATCH printk v4 7/8] printk: Add unsafe flush points for panic+kexec and emergency_restart John Ogness
2026-11-21 16:35 ` [PATCH printk v4 8/8] netconsole: Perform unsafe flushing on panic and emergency restart John Ogness

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®