Skip to content

Commit 10102a8

Browse files
0x7f454c46pmladek
authored andcommitted
printk: Add printk.console_no_auto_verbose boot parameter
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 <[email protected]> Cc: John Ogness <[email protected]> Cc: Petr Mladek <[email protected]> Cc: Sergey Senozhatsky <[email protected]> Cc: Steven Rostedt <[email protected]> Signed-off-by: Dmitry Safonov <[email protected]> Suggested-by: Petr Mladek <[email protected]> Reviewed-by: Sergey Senozhatsky <[email protected]> Reviewed-by: Petr Mladek <[email protected]> Tested-by: Petr Mladek <[email protected]> Signed-off-by: Petr Mladek <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent c9110df commit 10102a8

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4101,6 +4101,15 @@
41014101
Format: <bool> (1/Y/y=enable, 0/N/n=disable)
41024102
default: disabled
41034103

4104+
printk.console_no_auto_verbose=
4105+
Disable console loglevel raise on oops, panic
4106+
or lockdep-detected issues (only if lock debug is on).
4107+
With an exception to setups with low baudrate on
4108+
serial console, keeping this 0 is a good choice
4109+
in order to provide more debug information.
4110+
Format: <bool>
4111+
default: 0 (auto_verbose is enabled)
4112+
41044113
printk.devkmsg={on,off,ratelimit}
41054114
Control writing to /dev/kmsg.
41064115
on - unlimited logging to /dev/kmsg from userspace

include/linux/printk.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,7 @@ extern int console_printk[];
6969
#define minimum_console_loglevel (console_printk[2])
7070
#define default_console_loglevel (console_printk[3])
7171

72-
static inline void console_verbose(void)
73-
{
74-
if (console_loglevel)
75-
console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;
76-
}
72+
extern void console_verbose(void);
7773

7874
/* strlen("ratelimit") + 1 */
7975
#define DEVKMSG_STR_MAX_SIZE 10

kernel/printk/printk.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2404,6 +2404,18 @@ module_param_named(console_suspend, console_suspend_enabled,
24042404
MODULE_PARM_DESC(console_suspend, "suspend console during suspend"
24052405
" and hibernate operations");
24062406

2407+
static bool printk_console_no_auto_verbose;
2408+
2409+
void console_verbose(void)
2410+
{
2411+
if (console_loglevel && !printk_console_no_auto_verbose)
2412+
console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;
2413+
}
2414+
EXPORT_SYMBOL_GPL(console_verbose);
2415+
2416+
module_param_named(console_no_auto_verbose, printk_console_no_auto_verbose, bool, 0644);
2417+
MODULE_PARM_DESC(console_no_auto_verbose, "Disable console loglevel raise to highest on oops/panic/etc");
2418+
24072419
/**
24082420
* suspend_console - suspend the console subsystem
24092421
*

0 commit comments

Comments
 (0)