From: John Ogness <john.ogness@linutronix.de>
To: Breno Leitao <leitao@debian.org>
Cc: Petr Mladek <pmladek@suse.com>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Steven Rostedt <rostedt@goodmis.org>,
Mike Galbraith <efault@gmx.de>,
linux-kernel@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Subject: Re: [PATCH printk v1 1/1] printk: nbcon: Allow unsafe write_atomic() for panic
Date: Mon, 15 Sep 2025 16:20:35 +0206 [thread overview]
Message-ID: <84348n9510.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <74htjoj66srvussqvivbhlkdkj6lkm6ox4jdv2sedb4yzccdmr@sgzbd44mivfs>
On 2025-09-15, Breno Leitao <leitao@debian.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
next prev parent reply other threads:[~2025-09-15 14:14 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-12 12:18 [PATCH printk v1 0/1] Allow unsafe ->write_atomic() for panic John Ogness
2025-09-12 12:18 ` [PATCH printk v1 1/1] printk: nbcon: Allow unsafe write_atomic() " John Ogness
2025-09-15 14:01 ` Breno Leitao
2025-09-15 14:14 ` John Ogness [this message]
2025-09-15 15:46 ` Breno Leitao
2025-09-15 19:09 ` John Ogness
2025-09-16 13:25 ` Petr Mladek
2025-09-16 15:05 ` Petr Mladek
2025-09-17 12:47 ` John Ogness
2025-09-17 13:51 ` Petr Mladek
2025-09-22 10:44 ` John Ogness
2025-09-22 11:45 ` Petr Mladek
2025-09-23 12:30 ` Breno Leitao
2025-09-17 14:44 ` [PATCH printk v1 0/1] Allow unsafe ->write_atomic() " Breno Leitao
2025-09-26 9:21 ` John Ogness
2025-09-26 15:17 ` Breno Leitao
2025-09-29 12:18 ` Petr Mladek
2025-09-29 13:36 ` 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=84348n9510.fsf@jogness.linutronix.de \
--to=john.ogness@linutronix.de \
--cc=efault@gmx.de \
--cc=gregkh@linuxfoundation.org \
--cc=leitao@debian.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=senozhatsky@chromium.org \
/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