All of lore.kernel.org
 help / color / mirror / Atom feed
From: John Ogness <john.ogness@linutronix.de>
To: Sebastian Andrzej Siewior <bigeasy@linutronix.de>,
	Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>,
	Steven Rostedt <rostedt@goodmis.org>,
	Pavel Tikhomirov <ptikhomirov@virtuozzo.com>,
	Oleg Nesterov <oleg@redhat.com>,
	Christian Brauner <brauner@kernel.org>,
	oe-lkp@lists.linux.dev, lkp@intel.com,
	linux-serial@vger.kernel.org, oliver.sang@intel.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] nbcon/reboot: Flush nbcon consoles synchronously on reboot
Date: Mon, 12 Oct 2026 16:20:16 +0206	[thread overview]
Message-ID: <87h5irxayv.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <87jynnxd5v.fsf@jogness.linutronix.de>

On 2026-10-12, John Ogness <john.ogness@linutronix.de> wrote:
>> while this seems okay, didn't we have pr_flush() to flush the output on
>> shutdown/ reboot?
>
> We have the syscore.ops.shutdown registered notifier that gracefully
> shuts down the kthread printers and transitions to atomic printing.
>
> There is a pr_flush() in kernel_power_off(), but actually that is no
> longer needed and should be removed.

After reviewing [0] I am reminded why pr_flush() exists in
kernel_power_off(). It is purely for legacy consoles on PREEMPT_RT.

I am wondering if instead printk_kthreads_shutdown() should make an
effort in this case (legacy + PREEMPT_RT):

diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index 0bbf6409d467a..10b655f05fa56 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -3776,6 +3776,15 @@ static void printk_kthreads_shutdown(void *data)
 		 */
 		nbcon_atomic_flush_pending();
 	}
+
+	/*
+	 * If legacy kthread printing is in use, give it a chance to
+	 * flush any backlog. The kthread is not stopped because when
+	 * forced, it is the only way legacy consoles can print.
+	 */
+	if (force_legacy_kthread() && printk_legacy_kthread)
+		pr_flush(1000, true);
+
 	console_list_unlock();
 }

That would still not cover the final "Power down", so probably the
pr_flush() should also continue to exist in kernel_power_off(). But it
is PREEMPT_RT + legacy specific, so I am not too happy about it.

John

[0] https://lore.kernel.org/lkml/a68e2e94-b4c6-4791-b581-ecbf3fee28e9@paulmck-laptop

  reply	other threads:[~2026-10-12 14:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 15:08 [PATCH] nbcon/reboot: Flush nbcon consoles synchronously on reboot Petr Mladek
2026-10-08 15:16 ` sashiko-bot
2026-10-08 15:19 ` Bradley Morgan
2026-10-09  9:16   ` Petr Mladek
2026-10-09 10:52     ` Sebastian Andrzej Siewior
2026-10-09  6:51 ` Sebastian Andrzej Siewior
2026-10-09  9:08   ` Petr Mladek
2026-10-09 12:59     ` Sebastian Andrzej Siewior
2026-10-09 13:28     ` John Ogness
2026-10-09 15:27       ` Petr Mladek
2026-10-12 13:26   ` John Ogness
2026-10-12 14:14     ` John Ogness [this message]
2026-10-12 13:20 ` 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=87h5irxayv.fsf@jogness.linutronix.de \
    --to=john.ogness@linutronix.de \
    --cc=bigeasy@linutronix.de \
    --cc=brauner@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=oe-lkp@lists.linux.dev \
    --cc=oleg@redhat.com \
    --cc=oliver.sang@intel.com \
    --cc=pmladek@suse.com \
    --cc=ptikhomirov@virtuozzo.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.