[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <a0e7b79b-2ce7-f349-b308-e5329defd3fe@arista.com>
Date: Thu, 25 Jun 2020 17:42:31 +0100
From: Dmitry Safonov <dima@...sta.com>
To: Jann Horn <jannh@...gle.com>
Cc: kernel list <linux-kernel@...r.kernel.org>,
Dmitry Safonov <0x7f454c46@...il.com>,
Andy Lutomirski <luto@...nel.org>,
Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
Petr Mladek <pmladek@...e.com>,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
Steven Rostedt <rostedt@...dmis.org>,
Tetsuo Handa <penguin-kernel@...ove.sakura.ne.jp>,
Thomas Gleixner <tglx@...utronix.de>,
the arch/x86 maintainers <x86@...nel.org>
Subject: Re: [PATCH 2/3] x86/dumpstack: Add log_lvl to __show_regs()
On 6/23/20 5:45 PM, Jann Horn wrote:
> On Tue, Jun 23, 2020 at 6:30 PM Dmitry Safonov <dima@...sta.com> wrote:
>> show_trace_log_lvl() provides x86 platform-specific way to unwind
>> backtrace with a given log level. Unfortunately, registers dump(s) are
>> not printed with the same log level - instead, KERN_DEFAULT is always
>> used.
>>
>> Arista's switches uses quite common setup with rsyslog, where only
>> urgent messages goes to console (console_log_level=KERN_ERR), everything
>> else goes into /var/log/ as the console baud-rate often is indecently
>> slow (9600 bps).
>>
>> Backtrace dumps without registers printed have proven to be as useful as
>> morning standups. Furthermore, in order to introduce KERN_UNSUPPRESSED
>> (which I believe is still the most elegant way to fix raciness of sysrq[1])
>> the log level should be passed down the stack to register dumping
>> functions. Besides, I have a potential use-case for printing traces
>> with KERN_DEBUG level [2] (where registers dump shouldn't appear with
>> higher log level).
>>
>> Add log_lvl parameter to __show_regs().
>> Keep the used log level intact to separate visible change.
>
> This change seems like a good idea to me; just one small nit:
>
> [...]
>> void show_regs(struct pt_regs *regs)
>> {
>> + int print_kernel_regs;
>> +
>> show_regs_print_info(KERN_DEFAULT);
>>
>> - __show_regs(regs, user_mode(regs) ? SHOW_REGS_USER : SHOW_REGS_ALL);
>> + print_kernel_regs = user_mode(regs) ? SHOW_REGS_USER : SHOW_REGS_ALL;
>> + __show_regs(regs, print_kernel_regs, KERN_DEFAULT);
>
> print_kernel_regs should probably have type "enum show_regs_mode"?
Makes sense, will fix in v2.
Thanks,
Dmitry
Powered by blists - more mailing lists