Skip to content

Commit ef2ff0f

Browse files
0x7f454c46KAGA-KOKO
authored andcommitted
x86/dumpstack: Show registers dump with trace's log level
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). After all preparations are done, provide log_lvl parameter for show_regs_if_on_stack() and wire up to actual log level used as an argument for show_trace_log_lvl(). [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 44e2153 commit ef2ff0f

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

arch/x86/kernel/dumpstack.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void show_iret_regs(struct pt_regs *regs, const char *log_lvl)
134134
}
135135

136136
static void show_regs_if_on_stack(struct stack_info *info, struct pt_regs *regs,
137-
bool partial)
137+
bool partial, const char *log_lvl)
138138
{
139139
/*
140140
* These on_stack() checks aren't strictly necessary: the unwind code
@@ -146,7 +146,7 @@ static void show_regs_if_on_stack(struct stack_info *info, struct pt_regs *regs,
146146
* they can be printed in the right context.
147147
*/
148148
if (!partial && on_stack(info, regs, sizeof(*regs))) {
149-
__show_regs(regs, SHOW_REGS_SHORT, KERN_DEFAULT);
149+
__show_regs(regs, SHOW_REGS_SHORT, log_lvl);
150150

151151
} else if (partial && on_stack(info, (void *)regs + IRET_FRAME_OFFSET,
152152
IRET_FRAME_SIZE)) {
@@ -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, KERN_DEFAULT);
158+
show_iret_regs(regs, log_lvl);
159159
}
160160
}
161161

@@ -210,7 +210,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
210210
printk("%s <%s>\n", log_lvl, stack_name);
211211

212212
if (regs)
213-
show_regs_if_on_stack(&stack_info, regs, partial);
213+
show_regs_if_on_stack(&stack_info, regs, partial, log_lvl);
214214

215215
/*
216216
* Scan the stack, printing any text addresses we find. At the
@@ -271,7 +271,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
271271
/* if the frame has entry regs, print them */
272272
regs = unwind_get_entry_regs(&state, &partial);
273273
if (regs)
274-
show_regs_if_on_stack(&stack_info, regs, partial);
274+
show_regs_if_on_stack(&stack_info, regs, partial, log_lvl);
275275
}
276276

277277
if (stack_name)

0 commit comments

Comments
 (0)