mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] printk: Allow direct printing for PREEMPT_RT during panic
@ 2024-10-10  3:55 takakura
  2024-10-10  8:41 ` John Ogness
  0 siblings, 1 reply; 3+ messages in thread
From: takakura @ 2024-10-10  3:55 UTC (permalink / raw)
  To: pmladek, rostedt, john.ogness, senozhatsky; +Cc: linux-kernel, Ryo Takakura

From: Ryo Takakura <takakura@valinux.co.jp>

If PREEMPT_RT was enabled, printing for legacy consoles are deferred
by default, including after printk_legacy_allow_panic_sync() during 
panic which allows direct printing afterwards in case of !PREEMPT_RT.
As a result, printing of messages during panic for PREEMPT_RT
is handled by the console_flush_on_panic() called at the end.

In case if kexec was loaded, console_flush_on_panic() will not be
called and starts booting into the second kernel without printing
the messages.

Allow direct printing for PREEMPT_RT during panic so that messages
before kexec gets printed.

Signed-off-by: Ryo Takakura <takakura@valinux.co.jp>
---

I was not sure if the behavior of deferred printing for PREEMPT_RT 
during panic was expected or not. I think printing messages would be 
useful even if kexec was loaded in case if it fails.

Thanks!

---
 kernel/printk/printk_safe.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/printk/printk_safe.c b/kernel/printk/printk_safe.c
index 2b35a9d3919d..67a0510a8e12 100644
--- a/kernel/printk/printk_safe.c
+++ b/kernel/printk/printk_safe.c
@@ -44,7 +44,7 @@ bool is_printk_legacy_deferred(void)
 	 * The per-CPU variable @printk_context can be read safely in any
 	 * context. CPU migration is always disabled when set.
 	 */
-	return (force_legacy_kthread() ||
+	return ((!this_cpu_in_panic() && force_legacy_kthread()) ||
 		this_cpu_read(printk_context) ||
 		in_nmi());
 }
-- 
2.34.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-10-10  9:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-10  3:55 [PATCH] printk: Allow direct printing for PREEMPT_RT during panic takakura
2024-10-10  8:41 ` John Ogness
2024-10-10  9:47   ` takakura

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome