aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/kernel/dumpstack.c
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@redhat.com>2016-10-20 12:34:42 -0400
committerIngo Molnar <mingo@kernel.org>2016-10-21 03:26:04 -0400
commit79439d8e15b51fa359a0f5d0c8f856c1f5b4bd56 (patch)
tree2610b3426c5dbf486a65c1d7c5034fd5d14ebe7b /arch/x86/kernel/dumpstack.c
parentacb4608ad1865a42af8e0a2db332a7c3a381e1f5 (diff)
x86/dumpstack: Print stack identifier on its own line
show_trace_log_lvl() prints the stack id (e.g. "<IRQ>") without a newline so that any stack address printed after it will appear on the same line. That causes the first stack address to be vertically misaligned with the rest, making it visually cluttered and slightly confusing: Call Trace: <IRQ> [<ffffffff814431c3>] dump_stack+0x86/0xc3 [<ffffffff8100828b>] perf_callchain_kernel+0x14b/0x160 [<ffffffff811e915f>] get_perf_callchain+0x15f/0x2b0 ... <EOI> [<ffffffff8189c6c3>] ? _raw_spin_unlock_irq+0x33/0x60 [<ffffffff810e1c84>] finish_task_switch+0xb4/0x250 [<ffffffff8106f7dc>] do_async_page_fault+0x2c/0xa0 It will look worse once we start printing pt_regs registers found in the middle of the stack: <IRQ> RIP: 0010:[<ffffffff8189c6c3>] [<ffffffff8189c6c3>] _raw_spin_unlock_irq+0x33/0x60 RSP: 0018:ffff88007876f720 EFLAGS: 00000206 RAX: ffff8800786caa40 RBX: ffff88007d5da140 RCX: 0000000000000007 ... Improve readability by adding a newline to the stack name: Call Trace: <IRQ> [<ffffffff814431c3>] dump_stack+0x86/0xc3 [<ffffffff8100828b>] perf_callchain_kernel+0x14b/0x160 [<ffffffff811e915f>] get_perf_callchain+0x15f/0x2b0 ... <EOI> [<ffffffff8189c6c3>] ? _raw_spin_unlock_irq+0x33/0x60 [<ffffffff810e1c84>] finish_task_switch+0xb4/0x250 [<ffffffff8106f7dc>] do_async_page_fault+0x2c/0xa0 Now that "continued" lines are no longer needed, we can also remove the hack of using the empty string (aka KERN_CONT) and replace it with KERN_DEFAULT. Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com> Cc: Andy Lutomirski <luto@kernel.org> Cc: Borislav Petkov <bp@alien8.de> Cc: Brian Gerst <brgerst@gmail.com> Cc: Denys Vlasenko <dvlasenk@redhat.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Link: http://lkml.kernel.org/r/9bdd6dee2c74555d45500939fcc155997dc7889e.1476973742.git.jpoimboe@redhat.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'arch/x86/kernel/dumpstack.c')
-rw-r--r--arch/x86/kernel/dumpstack.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/x86/kernel/dumpstack.c b/arch/x86/kernel/dumpstack.c
index 9b7cf5c28f5f..32511772b424 100644
--- a/arch/x86/kernel/dumpstack.c
+++ b/arch/x86/kernel/dumpstack.c
@@ -97,7 +97,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
97 97
98 stack_type_str(stack_info.type, &str_begin, &str_end); 98 stack_type_str(stack_info.type, &str_begin, &str_end);
99 if (str_begin) 99 if (str_begin)
100 printk("%s <%s> ", log_lvl, str_begin); 100 printk("%s <%s>\n", log_lvl, str_begin);
101 101
102 /* 102 /*
103 * Scan the stack, printing any text addresses we find. At the 103 * Scan the stack, printing any text addresses we find. At the
@@ -149,7 +149,7 @@ void show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
149 } 149 }
150 150
151 if (str_end) 151 if (str_end)
152 printk("%s <%s> ", log_lvl, str_end); 152 printk("%s <%s>\n", log_lvl, str_end);
153 } 153 }
154} 154}
155 155
@@ -164,12 +164,12 @@ void show_stack(struct task_struct *task, unsigned long *sp)
164 if (!sp && task == current) 164 if (!sp && task == current)
165 sp = get_stack_pointer(current, NULL); 165 sp = get_stack_pointer(current, NULL);
166 166
167 show_stack_log_lvl(task, NULL, sp, ""); 167 show_stack_log_lvl(task, NULL, sp, KERN_DEFAULT);
168} 168}
169 169
170void show_stack_regs(struct pt_regs *regs) 170void show_stack_regs(struct pt_regs *regs)
171{ 171{
172 show_stack_log_lvl(current, regs, NULL, ""); 172 show_stack_log_lvl(current, regs, NULL, KERN_DEFAULT);
173} 173}
174 174
175static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED; 175static arch_spinlock_t die_lock = __ARCH_SPIN_LOCK_UNLOCKED;