Re: [PATCH] xtensa: improve stack dumping

From: Joe Perches
Date: Wed Nov 06 2019 - 17:34:12 EST


On Wed, 2019-11-06 at 10:16 -0800, Max Filippov wrote:
> Collect whole stack dump lines in a buffer and print the whole buffer
> when it's ready with pr_info instead of pr_cont. This makes stack dump
> lines consistent in SMP case and relies less on pr_cont/printk
> differences related to timestamps.
> Make size of stack dump configurable.
> Drop extra newline output in show_trace as its output format does not
> depend on CONFIG_KALLSYMS.
[]
> diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
[]
> @@ -512,10 +510,12 @@ void show_stack(struct task_struct *task, unsigned long *sp)
> for (i = 0; i < kstack_depth_to_print; i++) {
> if (kstack_end(sp))
> break;
> - pr_cont(" %08lx", *sp++);
> + sprintf(buf + (i % 8) * 9, " %08lx", *sp++);
> if (i % 8 == 7)
> - pr_cont("\n");
> + pr_info("%s\n", buf);
> }
> + if (i % 8)
> + pr_info("%s\n", buf);

Could this be done using hex_dump_to_buffer
by precalculating kstack_end ?