Re: [PATCH printk v4 0/8] Introduce policies for unsafe flushing

From: Gustavo Luiz Duarte

Date: Mon Nov 23 2026 - 17:15:17 EST


On Sat, Nov 21, 2026 at 4:36 PM John Ogness <john.ogness@xxxxxxxxxxxxx> wrote:
>
> 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.

Thanks for following up on this, John!
This version looks good to me. Netconsole needs more work before we
can have a completely safe write_atomic(), but this will allow users
to make a choice between reboot safety and observability.

I tested it triggering a crash with and without kdump enabled, from
normal context and from NMI context (simulating panic on hardlockup).
In all cases it fixed the regression: messages were sent correctly via
netconsole with no unexpected errors or warnings.

For the series:
Reviewed-by: Gustavo Luiz Duarte <gustavold@xxxxxxxxx>
Tested-by: Gustavo Luiz Duarte <gustavold@xxxxxxxxx>