From: John Ogness <john.ogness@linutronix.de>
To: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>,
Ryan Roberts <ryan.roberts@arm.com>,
Breno Leitao <leitao@debian.org>,
printk@lists.linux.dev, linux-kernel@vger.kernel.org,
Huacai Chen <chenhuacai@kernel.org>,
WANG Xuerui <kernel@xen0n.name>,
Madhavan Srinivasan <maddy@linux.ibm.com>,
Michael Ellerman <mpe@ellerman.id.au>,
Nicholas Piggin <npiggin@gmail.com>,
"Christophe Leroy (CS GROUP)" <chleroy@kernel.org>,
"Ritesh Harjani (IBM)" <ritesh.list@gmail.com>,
Shrikanth Hegde <sshegde@linux.ibm.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jason Wessel <jason.wessel@windriver.com>,
Daniel Thompson <danielt@kernel.org>,
Douglas Anderson <dianders@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>,
Mukesh Kumar Chaurasiya <mchauras@linux.ibm.com>,
Feng Tang <feng.tang@linux.alibaba.com>,
Rio <rioo.tsukatsukii@gmail.com>,
Bradley Morgan <brads@mainlining.org>,
Pnina Feder <pnina.feder@mobileye.com>,
Gal Pressman <gal@nvidia.com>, Petr Pavlu <petr.pavlu@suse.com>,
Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
Oleg Nesterov <oleg@redhat.com>,
"Cen Zhang (Microsoft)" <blbllhy@gmail.com>,
loongarch@lists.linux.dev, linuxppc-dev@lists.ozlabs.org,
kgdb-bugreport@lists.sourceforge.net,
Randy Dunlap <rdunlap@infradead.org>,
Alessandro Carminati <acarmina@redhat.com>,
Baoquan He <baoquan.he@linux.dev>,
Mike Rapoport <rppt@kernel.org>,
Pasha Tatashin <pasha.tatashin@soleen.com>,
Pratyush Yadav <pratyush@kernel.org>,
Dave Young <ruirui.yang@linux.dev>,
kexec@lists.infradead.org,
Gustavo Luiz Duarte <gustavold@gmail.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
netdev@vger.kernel.org
Subject: [PATCH printk v2 0/6] Introduce policies for unsafe flushing
Date: Wed, 11 Nov 2026 19:25:16 +0106 [thread overview]
Message-ID: <20261111181942.593695-1-john.ogness@linutronix.de> (raw)
v1 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 6/6. 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.
Changes since v1:
- Make console.unsafe_flush_flags unsigned.
- Add missing kerneldoc description for printk_trigger_flush().
- Remove the WARN_ON_ONCE() in
nbcon_context_try_acquire_hostile() since hostile takeovers
are now possible from non-panic contexts.
- Also provide a flush reason for console_flush_on_panic().
- Add a global variable @legacy_flush_reason to track reason
for legacy flushing.
- Explicitly set PR_FLUSH_RUNTIME to 0 since it is now used to
initialize @legacy_flush_reason.
- Temporarily set @legacy_flush_reason during legacy flushing
of console_flush_on_panic() and printk_trigger_flush().
- Also set/check ctxt->allow_unsafe_takeover in
nbcon_legacy_emit_next_record() to enforce flush policies
for legacy flushing.
John Ogness
[0] https://lore.kernel.org/lkml/20261109123127.489676-1-john.ogness@linutronix.de
[1] https://lore.kernel.org/lkml/20260915100140.3631650-1-ryan.roberts@arm.com
John Ogness (6):
printk: Introduce and specify flush reasons
console: Introduce unsafe flush policy flags
printk: Evaluate flush policy in nbcon_allow_unsafe_takeover()
printk: Remove nbcon_atomic_flush_unsafe()
printk: Add panic+kexec flush point
netconsole: Always perform unsafe flushing on panic/kdb/restart
arch/loongarch/kernel/reset.c | 2 +-
arch/powerpc/kernel/traps.c | 2 +-
arch/powerpc/kernel/watchdog.c | 2 +-
drivers/net/netconsole.c | 4 +
include/linux/console.h | 39 +++++++---
include/linux/printk.h | 27 +++++--
kernel/crash_core.c | 1 +
kernel/debug/debug_core.c | 2 +-
kernel/panic.c | 8 +-
kernel/printk/internal.h | 5 +-
kernel/printk/nbcon.c | 129 ++++++++++++++++++++++-----------
kernel/printk/printk.c | 38 +++++++---
kernel/reboot.c | 2 +-
lib/nmi_backtrace.c | 2 +-
14 files changed, 181 insertions(+), 82 deletions(-)
base-commit: d01f86a7da8161aac8c6304b377cf58fb75861ca
--
2.47.3
next reply other threads:[~2026-11-11 18:19 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-11 18:19 John Ogness [this message]
2026-11-11 18:19 ` [PATCH printk v2 1/6] printk: Introduce and specify flush reasons John Ogness
2026-11-11 18:19 ` [PATCH printk v2 2/6] console: Introduce unsafe flush policy flags John Ogness
2026-11-11 18:19 ` [PATCH printk v2 3/6] printk: Evaluate flush policy in nbcon_allow_unsafe_takeover() John Ogness
2026-11-11 18:19 ` [PATCH printk v2 4/6] printk: Remove nbcon_atomic_flush_unsafe() John Ogness
2026-11-11 18:19 ` [PATCH printk v2 5/6] printk: Add panic+kexec flush point John Ogness
2026-11-11 18:19 ` [PATCH printk v2 6/6] netconsole: Always perform unsafe flushing on panic/kdb/restart John Ogness
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261111181942.593695-1-john.ogness@linutronix.de \
--to=john.ogness@linutronix.de \
--cc=acarmina@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=andrew+netdev@lunn.ch \
--cc=baoquan.he@linux.dev \
--cc=blbllhy@gmail.com \
--cc=brads@mainlining.org \
--cc=chenhuacai@kernel.org \
--cc=chleroy@kernel.org \
--cc=danielt@kernel.org \
--cc=davem@davemloft.net \
--cc=dianders@chromium.org \
--cc=edumazet@kernel.org \
--cc=feng.tang@linux.alibaba.com \
--cc=gal@nvidia.com \
--cc=gregkh@linuxfoundation.org \
--cc=gustavold@gmail.com \
--cc=jason.wessel@windriver.com \
--cc=kernel@xen0n.name \
--cc=kexec@lists.infradead.org \
--cc=kgdb-bugreport@lists.sourceforge.net \
--cc=kuba@kernel.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=loongarch@lists.linux.dev \
--cc=maddy@linux.ibm.com \
--cc=mchauras@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=npiggin@gmail.com \
--cc=oleg@redhat.com \
--cc=pabeni@redhat.com \
--cc=pasha.tatashin@soleen.com \
--cc=petr.pavlu@suse.com \
--cc=pmladek@suse.com \
--cc=pnina.feder@mobileye.com \
--cc=pratyush@kernel.org \
--cc=printk@lists.linux.dev \
--cc=ptikhomirov@virtuozzo.com \
--cc=rdunlap@infradead.org \
--cc=rioo.tsukatsukii@gmail.com \
--cc=ritesh.list@gmail.com \
--cc=rostedt@goodmis.org \
--cc=rppt@kernel.org \
--cc=ruirui.yang@linux.dev \
--cc=ryan.roberts@arm.com \
--cc=senozhatsky@chromium.org \
--cc=sshegde@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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®