From: Feng Tang <feng.tang@linux.alibaba.com>
To: Andrew Morton <akpm@linux-foundation.org>,
Petr Mladek <pmladek@suse.com>,
Steven Rostedt <rostedt@goodmis.org>,
Lance Yang <lance.yang@linux.dev>,
Jonathan Corbet <corbet@lwn.net>,
linux-kernel@vger.kernel.org
Cc: paulmck@kernel.org, john.ogness@linutronix.de,
Feng Tang <feng.tang@linux.alibaba.com>
Subject: [PATCH V2 1/5] panic: clean up code for console replay
Date: Mon, 16 Jun 2025 09:08:36 +0800 [thread overview]
Message-ID: <20250616010840.38258-2-feng.tang@linux.alibaba.com> (raw)
In-Reply-To: <20250616010840.38258-1-feng.tang@linux.alibaba.com>
Currently the panic_print_sys_info() was called twice with different
parameters to handle console replay case, which is kind of confusing.
Add panic_console_replay() explicitly to make the code straightforward.
Suggested-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Feng Tang <feng.tang@linux.alibaba.com>
---
kernel/panic.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/kernel/panic.c b/kernel/panic.c
index b0b9a8bf4560..af0d5206a624 100644
--- a/kernel/panic.c
+++ b/kernel/panic.c
@@ -238,14 +238,14 @@ void nmi_panic(struct pt_regs *regs, const char *msg)
}
EXPORT_SYMBOL(nmi_panic);
-static void panic_print_sys_info(bool console_flush)
+static void panic_console_replay(void)
{
- if (console_flush) {
- if (panic_print & PANIC_PRINT_ALL_PRINTK_MSG)
- console_flush_on_panic(CONSOLE_REPLAY_ALL);
- return;
- }
+ if (panic_print & PANIC_PRINT_ALL_PRINTK_MSG)
+ console_flush_on_panic(CONSOLE_REPLAY_ALL);
+}
+static void panic_print_sys_info(void)
+{
if (panic_print & PANIC_PRINT_TASK_INFO)
show_state();
@@ -410,7 +410,7 @@ void panic(const char *fmt, ...)
*/
atomic_notifier_call_chain(&panic_notifier_list, 0, buf);
- panic_print_sys_info(false);
+ panic_print_sys_info();
kmsg_dump_desc(KMSG_DUMP_PANIC, buf);
@@ -439,7 +439,7 @@ void panic(const char *fmt, ...)
debug_locks_off();
console_flush_on_panic(CONSOLE_FLUSH_PENDING);
- panic_print_sys_info(true);
+ panic_console_replay();
if (!panic_blink)
panic_blink = no_blink;
--
2.39.5 (Apple Git-154)
next prev parent reply other threads:[~2025-06-16 1:08 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-16 1:08 [PATCH V2 0/5] generalize panic_print's dump function to be used by other kernel parts Feng Tang
2025-06-16 1:08 ` Feng Tang [this message]
2025-06-20 14:19 ` [PATCH V2 1/5] panic: clean up code for console replay Petr Mladek
2025-06-16 1:08 ` [PATCH V2 2/5] panic: generalize panic_print's function to show sys info Feng Tang
2025-06-20 15:21 ` Petr Mladek
2025-06-23 3:07 ` Feng Tang
2025-06-16 1:08 ` [PATCH V2 3/5] sys_info: add help to translate sys_info string to bitmap Feng Tang
2025-06-16 4:25 ` kernel test robot
2025-06-16 15:08 ` Feng Tang
2025-06-23 14:04 ` Petr Mladek
2025-06-24 1:48 ` Feng Tang
2025-06-16 1:08 ` [PATCH V2 4/5] panic: add 'panic_sys_info=' setup option for sysctl and kernel cmdline Feng Tang
2025-06-23 15:04 ` Petr Mladek
2025-06-24 1:55 ` Feng Tang
2025-06-16 1:08 ` [PATCH V2 5/5] panic: add note that panic_print interface is deprecated Feng Tang
2025-06-16 1:45 ` Lance Yang
2025-06-16 2:39 ` Feng Tang
2025-06-23 15:13 ` Petr Mladek
2025-06-23 15:22 ` Petr Mladek
2025-06-24 1:58 ` Feng Tang
2025-06-25 9:30 ` Feng Tang
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=20250616010840.38258-2-feng.tang@linux.alibaba.com \
--to=feng.tang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=corbet@lwn.net \
--cc=john.ogness@linutronix.de \
--cc=lance.yang@linux.dev \
--cc=linux-kernel@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=pmladek@suse.com \
--cc=rostedt@goodmis.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®