From: Ryo Takakura <ryotkkr98@gmail.com>
To: cuiguoqi@kylinos.cn
Cc: akpm@linux-foundation.org, bigeasy@linutronix.de,
catalin.marinas@arm.com, clrkwllms@kernel.org,
farbere@amazon.com, feng.tang@linux.alibaba.com,
guoqi0226@163.com, joel.granados@kernel.org,
john.ogness@linutronix.de, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, linux-rt-devel@lists.linux.dev,
namcao@linutronix.de, pmladek@suse.com, rostedt@goodmis.org,
sravankumarlpu@gmail.com, takakura@valinux.co.jp,
tglx@linutronix.de, will@kernel.org
Subject: Re: [PATCH] printk: Fix panic log flush to serial console during kdump in PREEMPT_RT kernels
Date: Tue, 19 Aug 2025 13:31:49 +0000 [thread overview]
Message-ID: <20250819133149.7452-1-ryotkkr98@gmail.com> (raw)
In-Reply-To: <20250807112247.170127-1-cuiguoqi@kylinos.cn>
Hi cuiguoqi!
I'm not an expert on the subject, but hope this helps.
On Thu, 7 Aug 2025 19:22:47 +0800, cuiguoqi wrote:
>When a system running a real-time (PREEMPT_RT) kernel panics and triggers kdump,
>the critical log messages (e.g., panic reason, stack traces) may fail to appear
>on the serial console.
>
>When kdump cannot be used properly, serial console logs are crucial,
>whether for diagnosing kdump issues or troubleshooting the underlying problem.
The console not being flushed in the case of kexec should be expected
as described [0]. Its about prioritizing kexec over serial output.
>This issue arises due to synchronization or deferred flushing of the printk buffer
>in real-time contexts, where preemptible console locks or delayed workqueues prevent
>timely log output before kexec transitions to the crash kernel.
>
> /**
> * kexec_image_info - For debugging output.
>@@ -176,6 +177,9 @@ void machine_kexec(struct kimage *kimage)
>
> pr_info("Bye!\n");
>
>+ if (IS_ENABLED(CONFIG_PREEMPT_RT) && in_kexec_crash)
>+ console_flush_on_panic(CONSOLE_FLUSH_PENDING);
>+
Calling console_flush_on_panic() while trying to kexec will
reduce its chance of success.
>diff --git a/kernel/panic.c b/kernel/panic.c
>index 72fcbb5..e0ad0df 100644
>--- a/kernel/panic.c
>+++ b/kernel/panic.c
>@@ -437,6 +437,8 @@ void vpanic(const char *fmt, va_list args)
> */
> kgdb_panic(buf);
>
>+ printk_legacy_allow_panic_sync();
>+
> /*
> * If we have crashed and we have a crash kernel loaded let it handle
> * everything else.
>@@ -450,8 +452,6 @@ void vpanic(const char *fmt, va_list args)
>
> panic_other_cpus_shutdown(_crash_kexec_post_notifiers);
>
>- printk_legacy_allow_panic_sync();
>-
The ordering here should be kept where we don't want CPUs other than
the one panicked flushing legacy consoles.
Sincerely,
Ryo Takakura
[0] https://lore.kernel.org/lkml/847cagmjsx.fsf@jogness.linutronix.de/
next prev parent reply other threads:[~2025-08-19 13:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-07 11:22 cuiguoqi
2025-08-19 13:31 ` Ryo Takakura [this message]
2025-08-19 13:39 ` Petr Mladek
2025-08-25 3:02 ` [PATCH] drivers: example: fix memory leak cuiguoqi
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=20250819133149.7452-1-ryotkkr98@gmail.com \
--to=ryotkkr98@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=bigeasy@linutronix.de \
--cc=catalin.marinas@arm.com \
--cc=clrkwllms@kernel.org \
--cc=cuiguoqi@kylinos.cn \
--cc=farbere@amazon.com \
--cc=feng.tang@linux.alibaba.com \
--cc=guoqi0226@163.com \
--cc=joel.granados@kernel.org \
--cc=john.ogness@linutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rt-devel@lists.linux.dev \
--cc=namcao@linutronix.de \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.org \
--cc=sravankumarlpu@gmail.com \
--cc=takakura@valinux.co.jp \
--cc=tglx@linutronix.de \
--cc=will@kernel.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
all inboxes | Powered by JetHome®