From: John Ogness <john.ogness@linutronix.de>
To: Petr Mladek <pmladek@suse.com>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Petr Mladek <pmladek@suse.com>,
Feng Tang <feng.tang@linux.alibaba.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] panic: Remove redundant panic-cpu backtrace
Date: Fri, 05 Sep 2025 15:55:11 +0206 [thread overview]
Message-ID: <844ithf1rc.fsf@jogness.linutronix.de> (raw)
In-Reply-To: <20250903100418.410026-1-pmladek@suse.com>
On 2025-09-03, Petr Mladek <pmladek@suse.com> wrote:
> From: Sergey Senozhatsky <senozhatsky@chromium.org>
>
> Backtraces from all CPUs are printed during panic() when
> SYS_INFO_ALL_CPU_BT is set. It shows the backtrace for
> the panic-CPU even when it has already been explicitly
> printed before.
>
> Do not change the legacy code which prints the backtrace
> in various context, for example, as part of Oops report,
> right after panic message. It will always be visible in
> the crash dump.
>
> Instead, remember when the backtrace was printed, and skip
> it when dumping the optional backtraces on all CPUs.
>
> Signed-off-by: Sergey Senozhatsky <senozhatsky@chromium.org>
> Link: https://lore.kernel.org/r/20250731030314.3818040-1-senozhatsky@chromium.org
> [pmladek@suse.com: Handle situations when the backtrace was not printed for the panic CPU.]
> Signed-off-by: Petr Mladek <pmladek@suse.com>
> ---
> diff --git a/kernel/panic.c b/kernel/panic.c
> index 72fcbb5a071b..e3cec9bc05ef 100644
> --- a/kernel/panic.c
> +++ b/kernel/panic.c
> @@ -422,13 +432,15 @@ void vpanic(const char *fmt, va_list args)
> buf[len - 1] = '\0';
>
> pr_emerg("Kernel panic - not syncing: %s\n", buf);
> -#ifdef CONFIG_DEBUG_BUGVERBOSE
> /*
> * Avoid nested stack-dumping if a panic occurs during oops processing
> */
> - if (!test_taint(TAINT_DIE) && oops_in_progress <= 1)
> + if (test_taint(TAINT_DIE) || oops_in_progress > 1) {
> + panic_this_cpu_backtrace_printed = true;
> + } else if (IS_ENABLED(CONFIG_DEBUG_BUGVERBOSE)) {
> dump_stack();
> -#endif
> + panic_this_cpu_backtrace_printed = true;
> + }
It took me a while to wrap my brain around this new logic. I guess in
part because the comment above only tells a part of the story. I tried
to write a suggestion for the comment, but it ended up being just as
confusing as the code. So, I guess we just leave it...
It seems this patch has already been picked up in the mm-tree (with a
patch on top), but if not:
Reviewed-by: John Ogness <john.ogness@linutronix.de>
prev parent reply other threads:[~2025-09-05 13:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-03 10:04 [PATCH v2] panic: Remove redundant panic-cpu backtrace Petr Mladek
2025-09-04 2:06 ` Feng Tang
2025-09-04 2:34 ` Sergey Senozhatsky
2025-09-05 13:49 ` John Ogness [this message]
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=844ithf1rc.fsf@jogness.linutronix.de \
--to=john.ogness@linutronix.de \
--cc=akpm@linux-foundation.org \
--cc=feng.tang@linux.alibaba.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.com \
--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