[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YNWeIks8NC1i2w96@alley>
Date: Fri, 25 Jun 2021 11:13:06 +0200
From: Petr Mladek <pmladek@...e.com>
To: Dmitry Safonov <dima@...sta.com>
Cc: linux-kernel@...r.kernel.org,
Dmitry Safonov <0x7f454c46@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
John Ogness <john.ogness@...utronix.de>,
Sergey Senozhatsky <senozhatsky@...omium.org>,
Steven Rostedt <rostedt@...dmis.org>
Subject: Re: [PATCH] printk: Add CONFIG_CONSOLE_LOGLEVEL_PANIC
On Tue 2021-06-22 15:33:50, Dmitry Safonov wrote:
> 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().
It makes sense.
> Provide CONFIG_CONSOLE_LOGLEVEL_PANIC, which allows to choose how
> verbose the kernel must be on oops/panic.
>
> Cc: Andrew Morton <akpm@...ux-foundation.org>
> Cc: John Ogness <john.ogness@...utronix.de>
> Cc: Petr Mladek <pmladek@...e.com>
> Cc: Sergey Senozhatsky <senozhatsky@...omium.org>
> Cc: Steven Rostedt <rostedt@...dmis.org>
> Signed-off-by: Dmitry Safonov <dima@...sta.com>
> ---
> include/linux/printk.h | 4 ++--
> lib/Kconfig.debug | 13 +++++++++++++
> 2 files changed, 15 insertions(+), 2 deletions(-)
>
> diff --git a/include/linux/printk.h b/include/linux/printk.h
> index fe7eb2351610..5a65a719f917 100644
> --- a/include/linux/printk.h
> +++ b/include/linux/printk.h
> @@ -76,8 +76,8 @@ static inline void console_silent(void)
>
> static inline void console_verbose(void)
> {
> - if (console_loglevel)
> - console_loglevel = CONSOLE_LOGLEVEL_MOTORMOUTH;
> + if (console_loglevel && (CONFIG_CONSOLE_LOGLEVEL_PANIC > 0))
> + console_loglevel = CONFIG_CONSOLE_LOGLEVEL_PANIC;
console_verbose() is called also in some other situations.
For example, check_hung_task(), oops_begin(), debug_locks_ff().
These do not always lead to panic.
At minimum, the name is misleading. It should be something
like CONFIG_CONSOLE_LOGLEVEL_VERBOSE.
But the question is whether we really want to limit the loglevel
also in the non-panic scenarios. IMHO, it is a bad idea.
A better solution would be to introduce console_verbose_panic()
and use it only when it is really going to panic. The function
should also use the lower value only when crash dump is really
successfully enabled.
> }
>
> /* strlen("ratelimit") + 1 */
> diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug
> index 678c13967580..0c12cafd9d8b 100644
> --- a/lib/Kconfig.debug
> +++ b/lib/Kconfig.debug
> @@ -61,6 +61,19 @@ config CONSOLE_LOGLEVEL_QUIET
> will be used as the loglevel. IOW passing "quiet" will be the
> equivalent of passing "loglevel=<CONSOLE_LOGLEVEL_QUIET>"
>
> +config CONSOLE_LOGLEVEL_PANIC
> + int "panic console loglevel (1-15)"
The range is 1-15 here.
> + range 0 15
But it is 0-15 here. If you use "range 1 15" you should not need the
check (CONFIG_CONSOLE_LOGLEVEL_PANIC > 0) in the code.
> + default "15"
> + help
> + loglevel to use in kernel panic or oopses.
> +
> + Usually in order to provide more debug information on console upon
> + panic, one wants to see everything being printed (loglevel = 15).
> + With an exception to setups with low baudrate on serial console,
> + keeping this value high is a good choice.
> + 0 value is to keep the loglevel during panic/oops unchanged.
The trick with 0 value just makes things more complicated. The default
"15" does the same job and should be good enough. The hard-coded
default is good enough for the other CONSOLE_LOGLEVEL_* settings.
Best Regards,
Petr
Powered by blists - more mailing lists