Re: [PATCH printk v1 1/1] printk: nbcon: Allow unsafe write_atomic() for panic

From: Breno Leitao

Date: Mon Sep 15 2025 - 10:01:27 EST


Hello John,

First of all, thanks for this patch.

On Fri, Sep 12, 2025 at 02:24:52PM +0206, John Ogness wrote:
> @@ -1606,6 +1610,13 @@ static void __nbcon_atomic_flush_pending(u64 stop_seq, bool allow_unsafe_takeove
> if (!console_is_usable(con, flags, true))
> continue;
>
> + /*
> + * It is only allowed to use unsafe ->write_atomic() from
> + * nbcon_atomic_flush_unsafe().
> + */
> + if ((flags & CON_NBCON_ATOMIC_UNSAFE) && !allow_unsafe_takeover)
> + continue;

What will happen with the "message" in this case? is it lost?

Let me clarify I understand the patch. The .write_atomic callback are
called in two cases:

1) Inside IRQ/NMI and scheduling context
2) During panics.

In both cases, they go throught __nbcon_atomic_flush_pending_con(),
right?

Let's say that netconsole implements CON_NBCON_ATOMIC_UNSAFE. What will
happen with printks() inside IRQs (when the system is NOT panicking).
Are they coming through __nbcon_atomic_flush_pending() and will be
skipped?

Also, are these messages even deferred for later flush?

Thanks,
--breno