x86/dumpstack: Add log_lvl to __show_regs()
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, there is 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. [1]: https://lore.kernel.org/lkml/20190528002412.1625-1-dima@arista.com/ [2]: https://lore.kernel.org/linux-doc/20190724170249.9644-1-dima@arista.com/ Signed-off-by: Dmitry Safonov <dima@arista.com> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Acked-by: Petr Mladek <pmladek@suse.com> Link: https://lkml.kernel.org/r/20200629144847.492794-3-dima@arista.com
This commit is contained in:
committed by
Thomas Gleixner
parent
fd07f802a7
commit
44e215352c
@@ -146,7 +146,7 @@ static void show_regs_if_on_stack(struct stack_info *info, struct pt_regs *regs,
|
||||
* they can be printed in the right context.
|
||||
*/
|
||||
if (!partial && on_stack(info, regs, sizeof(*regs))) {
|
||||
__show_regs(regs, SHOW_REGS_SHORT);
|
||||
__show_regs(regs, SHOW_REGS_SHORT, KERN_DEFAULT);
|
||||
|
||||
} else if (partial && on_stack(info, (void *)regs + IRET_FRAME_OFFSET,
|
||||
IRET_FRAME_SIZE)) {
|
||||
@@ -345,7 +345,7 @@ void oops_end(unsigned long flags, struct pt_regs *regs, int signr)
|
||||
oops_exit();
|
||||
|
||||
/* Executive summary in case the oops scrolled away */
|
||||
__show_regs(&exec_summary_regs, SHOW_REGS_ALL);
|
||||
__show_regs(&exec_summary_regs, SHOW_REGS_ALL, KERN_DEFAULT);
|
||||
|
||||
if (!signr)
|
||||
return;
|
||||
@@ -437,9 +437,12 @@ void die_addr(const char *str, struct pt_regs *regs, long err, long gp_addr)
|
||||
|
||||
void show_regs(struct pt_regs *regs)
|
||||
{
|
||||
enum show_regs_mode 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);
|
||||
|
||||
/*
|
||||
* When in-kernel, we also print out the stack at the time of the fault..
|
||||
|
||||
Reference in New Issue
Block a user