From: Stephen Brennan <stephen.s.brennan@oracle.com>
To: linux-kernel@vger.kernel.org
Cc: Petr Mladek <pmladek@suse.com>,
Steven Rostedt <rostedt@goodmis.org>,
John Ogness <john.ogness@linutronix.de>,
Sergey Senozhatsky <senozhatsky@chromium.org>,
Stephen Brennan <stephen.s.brennan@oracle.com>
Subject: [PATCH] printk: save loglevel before console_verbose()
Date: Thu, 15 Feb 2024 16:51:28 -0800 [thread overview]
Message-ID: <20240216005128.1045812-1-stephen.s.brennan@oracle.com> (raw)
In panic() cases, console_verbose() is called, clobbering the
console_loglevel value. If the bug which led to the panic related to
printk, it can be useful to know the log level prior to the
console_verbose() call. Save it to allow debugging these cases.
Signed-off-by: Stephen Brennan <stephen.s.brennan@oracle.com>
---
kernel/printk/printk.c | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
index f2444b581e16..97bd9427f118 100644
--- a/kernel/printk/printk.c
+++ b/kernel/printk/printk.c
@@ -2521,11 +2521,19 @@ MODULE_PARM_DESC(console_suspend, "suspend console during suspend"
" and hibernate operations");
static bool printk_console_no_auto_verbose;
+int saved_console_loglevel;
void console_verbose(void)
{
- if (console_loglevel && !printk_console_no_auto_verbose)
+ if (console_loglevel && !printk_console_no_auto_verbose) {
+ /*
+ * Save the prior log level for later debugging. Avoid
+ * clobbering in case of multiple console_verbose() calls.
+ */
+ if (console_loglevel != CONSOLE_LOGLEVEL_MOTORMOUTH)
+ saved_console_loglevel = console_loglevel;
console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;
+ }
}
EXPORT_SYMBOL_GPL(console_verbose);
--
2.39.3
next reply other threads:[~2024-02-16 0:51 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-16 0:51 Stephen Brennan [this message]
2024-02-16 9:22 ` John Ogness
2024-02-16 16:02 ` Stephen Brennan
2024-02-27 16:39 ` Petr Mladek
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=20240216005128.1045812-1-stephen.s.brennan@oracle.com \
--to=stephen.s.brennan@oracle.com \
--cc=john.ogness@linutronix.de \
--cc=linux-kernel@vger.kernel.org \
--cc=pmladek@suse.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 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®