Skip to content

Commit 64f004a

Browse files
committed
Merge branch 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull x86 debug changes from Ingo Molnar: "Stack printing fixlets" * 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: x86/kernel: Use kstack_end() in dumpstack_64.c x86/kernel: Fix output of show_stack_log_lvl()
2 parents b48488d + 6d4d198 commit 64f004a

3 files changed

Lines changed: 19 additions & 12 deletions

File tree

‎arch/x86/kernel/dumpstack.c‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,12 @@ unsigned int code_bytes = 64;
2525
int kstack_depth_to_print = 3 * STACKSLOTS_PER_LINE;
2626
static int die_counter;
2727

28-
static void printk_stack_address(unsigned long address, int reliable)
28+
static void printk_stack_address(unsigned long address, int reliable,
29+
void *data)
2930
{
30-
pr_cont(" [<%p>] %s%pB\n",
31-
(void *)address, reliable ? "" : "? ", (void *)address);
31+
printk("%s [<%p>] %s%pB\n",
32+
(char *)data, (void *)address, reliable ? "" : "? ",
33+
(void *)address);
3234
}
3335

3436
void printk_address(unsigned long address)
@@ -155,8 +157,7 @@ static int print_trace_stack(void *data, char *name)
155157
static void print_trace_address(void *data, unsigned long addr, int reliable)
156158
{
157159
touch_nmi_watchdog();
158-
printk(data);
159-
printk_stack_address(addr, reliable);
160+
printk_stack_address(addr, reliable, data);
160161
}
161162

162163
static const struct stacktrace_ops print_trace_ops = {

‎arch/x86/kernel/dumpstack_32.c‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,12 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
108108
for (i = 0; i < kstack_depth_to_print; i++) {
109109
if (kstack_end(stack))
110110
break;
111-
if (i && ((i % STACKSLOTS_PER_LINE) == 0))
112-
pr_cont("\n");
113-
pr_cont(" %08lx", *stack++);
111+
if ((i % STACKSLOTS_PER_LINE) == 0) {
112+
if (i != 0)
113+
pr_cont("\n");
114+
printk("%s %08lx", log_lvl, *stack++);
115+
} else
116+
pr_cont(" %08lx", *stack++);
114117
touch_nmi_watchdog();
115118
}
116119
pr_cont("\n");

‎arch/x86/kernel/dumpstack_64.c‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,15 @@ show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
280280
pr_cont(" <EOI> ");
281281
}
282282
} else {
283-
if (((long) stack & (THREAD_SIZE-1)) == 0)
283+
if (kstack_end(stack))
284284
break;
285285
}
286-
if (i && ((i % STACKSLOTS_PER_LINE) == 0))
287-
pr_cont("\n");
288-
pr_cont(" %016lx", *stack++);
286+
if ((i % STACKSLOTS_PER_LINE) == 0) {
287+
if (i != 0)
288+
pr_cont("\n");
289+
printk("%s %016lx", log_lvl, *stack++);
290+
} else
291+
pr_cont(" %016lx", *stack++);
289292
touch_nmi_watchdog();
290293
}
291294
preempt_enable();

0 commit comments

Comments
 (0)