]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
printk: Add printk.console_no_auto_verbose boot parameter
authorDmitry Safonov <dima@arista.com>
Tue, 27 Jul 2021 13:06:35 +0000 (14:06 +0100)
committerPetr Mladek <pmladek@suse.com>
Thu, 29 Jul 2021 14:29:35 +0000 (16:29 +0200)
console_verbose() increases console loglevel to
CONSOLE_LOGLEVEL_MOTORMOUTH, which provides more information
to debug a panic/oops.

Unfortunately, in Arista we maintain some DUTs (Device Under Test) that
are configured to have 9600 baud rate. While verbose console messages
have their value to post-analyze crashes, on such setup they:
- may prevent panic/oops messages being printed
- take too long to flush on console resulting in watchdog reboot

In all our setups we use kdump which saves dmesg buffer after panic,
so in reality those extra messages on console provide no additional value,
but rather add risk of not getting to __crash_kexec().

Provide printk.console_no_auto_verbose boot parameter, which allows
to switch off printk being verbose on oops/panic/lockdep.

Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: John Ogness <john.ogness@linutronix.de>
Cc: Petr Mladek <pmladek@suse.com>
Cc: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Dmitry Safonov <dima@arista.com>
Suggested-by: Petr Mladek <pmladek@suse.com>
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Tested-by: Petr Mladek <pmladek@suse.com>
Signed-off-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20210727130635.675184-3-dima@arista.com
Documentation/admin-guide/kernel-parameters.txt
include/linux/printk.h
kernel/printk/printk.c

index 26453f250683d861db91af1f098c9a1a2f48965f..fdd80888217a1f83d3693cbe134b6a51612db360 100644 (file)
                        Format: <bool>  (1/Y/y=enable, 0/N/n=disable)
                        default: disabled
 
+       printk.console_no_auto_verbose=
+                       Disable console loglevel raise on oops, panic
+                       or lockdep-detected issues (only if lock debug is on).
+                       With an exception to setups with low baudrate on
+                       serial console, keeping this 0 is a good choice
+                       in order to provide more debug information.
+                       Format: <bool>
+                       default: 0 (auto_verbose is enabled)
+
        printk.devkmsg={on,off,ratelimit}
                        Control writing to /dev/kmsg.
                        on - unlimited logging to /dev/kmsg from userspace
index f3f1a1eb19bdc4c98ccc83c16220624cdf13fef5..a5e1c5adfc3fbe0e48fd0f968dbf6c82410c009d 100644 (file)
@@ -69,11 +69,7 @@ extern int console_printk[];
 #define minimum_console_loglevel (console_printk[2])
 #define default_console_loglevel (console_printk[3])
 
-static inline void console_verbose(void)
-{
-       if (console_loglevel)
-               console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;
-}
+extern void console_verbose(void);
 
 /* strlen("ratelimit") + 1 */
 #define DEVKMSG_STR_MAX_SIZE 10
index 142a58d124d95ae9b1e07e360903f02f7c5d8c28..a6b94c3c5ac546583b5a09a20c68ee3f10cb41e8 100644 (file)
@@ -2404,6 +2404,18 @@ module_param_named(console_suspend, console_suspend_enabled,
 MODULE_PARM_DESC(console_suspend, "suspend console during suspend"
        " and hibernate operations");
 
+static bool printk_console_no_auto_verbose;
+
+void console_verbose(void)
+{
+       if (console_loglevel && !printk_console_no_auto_verbose)
+               console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;
+}
+EXPORT_SYMBOL_GPL(console_verbose);
+
+module_param_named(console_no_auto_verbose, printk_console_no_auto_verbose, bool, 0644);
+MODULE_PARM_DESC(console_no_auto_verbose, "Disable console loglevel raise to highest on oops/panic/etc");
+
 /**
  * suspend_console - suspend the console subsystem
  *