Skip to content

Commit fd07f80

Browse files
0x7f454c46KAGA-KOKO
authored andcommitted
x86/dumpstack: Add log_lvl to show_iret_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_iret_regs() as a preparation to add it to __show_regs() and show_regs_if_on_stack(). [1]: https://lore.kernel.org/lkml/[email protected]/ [2]: https://lore.kernel.org/linux-doc/[email protected]/ Signed-off-by: Dmitry Safonov <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Acked-by: Petr Mladek <[email protected]> Link: https://lkml.kernel.org/r/[email protected]
1 parent ba47d84 commit fd07f80

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

arch/x86/include/asm/kdebug.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ void die_addr(const char *str, struct pt_regs *regs, long err, long gp_addr);
3737
extern int __must_check __die(const char *, struct pt_regs *, long);
3838
extern void show_stack_regs(struct pt_regs *regs);
3939
extern void __show_regs(struct pt_regs *regs, enum show_regs_mode);
40-
extern void show_iret_regs(struct pt_regs *regs);
40+
extern void show_iret_regs(struct pt_regs *regs, const char *log_lvl);
4141
extern unsigned long oops_begin(void);
4242
extern void oops_end(unsigned long, struct pt_regs *, int signr);
4343

arch/x86/kernel/dumpstack.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -126,10 +126,10 @@ void show_ip(struct pt_regs *regs, const char *loglvl)
126126
show_opcodes(regs, loglvl);
127127
}
128128

129-
void show_iret_regs(struct pt_regs *regs)
129+
void show_iret_regs(struct pt_regs *regs, const char *log_lvl)
130130
{
131-
show_ip(regs, KERN_DEFAULT);
132-
printk(KERN_DEFAULT "RSP: %04x:%016lx EFLAGS: %08lx", (int)regs->ss,
131+
show_ip(regs, log_lvl);
132+
printk("%sRSP: %04x:%016lx EFLAGS: %08lx", log_lvl, (int)regs->ss,
133133
regs->sp, regs->flags);
134134
}
135135

@@ -155,7 +155,7 @@ static void show_regs_if_on_stack(struct stack_info *info, struct pt_regs *regs,
155155
* full pt_regs might not have been saved yet. In that case
156156
* just print the iret frame.
157157
*/
158-
show_iret_regs(regs);
158+
show_iret_regs(regs, KERN_DEFAULT);
159159
}
160160
}
161161

arch/x86/kernel/process_64.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ void __show_regs(struct pt_regs *regs, enum show_regs_mode mode)
6969
unsigned int fsindex, gsindex;
7070
unsigned int ds, es;
7171

72-
show_iret_regs(regs);
72+
show_iret_regs(regs, KERN_DEFAULT);
7373

7474
if (regs->orig_ax != -1)
7575
pr_cont(" ORIG_RAX: %016lx\n", regs->orig_ax);

0 commit comments

Comments
 (0)