[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <84348n9510.fsf@jogness.linutronix.de>
Date: Mon, 15 Sep 2025 16:20:35 +0206
From: John Ogness <john.ogness@...utronix.de>
To: Breno Leitao <leitao@...ian.org>
Cc: Petr Mladek <pmladek@...e.com>, Sergey Senozhatsky
<senozhatsky@...omium.org>, Steven Rostedt <rostedt@...dmis.org>, Mike
Galbraith <efault@....de>, linux-kernel@...r.kernel.org, Greg
Kroah-Hartman <gregkh@...uxfoundation.org>
Subject: Re: [PATCH printk v1 1/1] printk: nbcon: Allow unsafe
write_atomic() for panic
On 2025-09-15, Breno Leitao <leitao@...ian.org> wrote:
> 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?
@allow_unsafe_takeover is only true at the very end of panic. In all
other cases, the ->write_atomic() callback is ignored as if it wasn't
implemented. That means it will rely on the deferred printing kthread to
handle it.
> 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?
When the system is not panicing, CON_NBCON_ATOMIC_UNSAFE has the effect
of acting as if you never implemented ->write_atomic(). So yes, only
->write_thread() will handle everything in a deferred context. If the
system never panics, your ->write_atomic() will never be called.
John
Powered by blists - more mailing lists