[PATCH] riscv: Move the "Call Trace" to dump_backrace().

Mina HuiMin-Chou minachou at andestech.com
Mon Jul 17 19:32:01 PDT 2023


From: Hui Min Mina Chou <minachou at andestech.com>

It would be appropriate to show "Call Trace" within the dump_backtrace
function to ensure that some kernel dumps include this information.

This patch is based on Chen Huang's comment [1] and Palmer Dabbelt's
patch [2].

[1] https://lore.kernel.org/lkml/mhng-75c14e1e-a23c-404b-a1f6-235e53bdb6f3@palmerdabbelt-glaptop/
[2] https://lore.kernel.org/lkml/20220419174842.488-1-palmer@rivosinc.com/

Signed-off-by: Hui Min Mina Chou <minachou at andestech.com>
---
 arch/riscv/kernel/stacktrace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/riscv/kernel/stacktrace.c b/arch/riscv/kernel/stacktrace.c
index 64a9c093aef9..ff136031a592 100644
--- a/arch/riscv/kernel/stacktrace.c
+++ b/arch/riscv/kernel/stacktrace.c
@@ -118,12 +118,12 @@ static bool print_trace_address(void *arg, unsigned long pc)
 noinline void dump_backtrace(struct pt_regs *regs, struct task_struct *task,
 		    const char *loglvl)
 {
+	pr_cont("%sCall Trace:\n", loglvl);
 	walk_stackframe(task, regs, print_trace_address, (void *)loglvl);
 }
 
 void show_stack(struct task_struct *task, unsigned long *sp, const char *loglvl)
 {
-	pr_cont("%sCall Trace:\n", loglvl);
 	dump_backtrace(NULL, task, loglvl);
 }
 
-- 
2.34.1




More information about the linux-riscv mailing list