Skip to content

Commit b779479

Browse files
mrutland-armctmarinas
authored andcommitted
arm64: stacktrace: move dump_backtrace() to kunwind_stack_walk()
Currently dump_backtrace() can only print the PC value at each step of the unwind, as this is all the information that arch_stack_walk() passes to the dump_backtrace_entry() callback. In future we'd like to print some additional information, such as the origin of entries (e.g. PC, LR, FP) and/or the reliability thereof. In preparation for doing so, this patch moves dump_backtrace() over to kunwind_stack_walk(), which passes the full kunwind_state to the callback. There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Mark Brown <broonie@kernel.org> Reviewed-by: Miroslav Benes <mbenes@suse.cz> Reviewed-by: Puranjay Mohan <puranjay12@gmail.com> Cc: Ard Biesheuvel <ardb@kernel.org> Cc: Josh Poimboeuf <jpoimboe@kernel.org> Cc: Kalesh Singh <kaleshsingh@google.com> Cc: Madhavan T. Venkataraman <madvenka@linux.microsoft.com> Cc: Marc Zyngier <maz@kernel.org> Cc: Will Deacon <will@kernel.org> Link: https://lore.kernel.org/r/20241017092538.1859841-7-mark.rutland@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
1 parent 886c2b0 commit b779479

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/arm64/kernel/stacktrace.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,10 @@ noinline noinstr void arch_bpf_stack_walk(bool (*consume_entry)(void *cookie, u6
294294
kunwind_stack_walk(arch_bpf_unwind_consume_entry, &data, current, NULL);
295295
}
296296

297-
static bool dump_backtrace_entry(void *arg, unsigned long where)
297+
static bool dump_backtrace_entry(const struct kunwind_state *state, void *arg)
298298
{
299299
char *loglvl = arg;
300-
printk("%s %pSb\n", loglvl, (void *)where);
300+
printk("%s %pSb\n", loglvl, (void *)state->common.pc);
301301
return true;
302302
}
303303

@@ -316,7 +316,7 @@ void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk,
316316
return;
317317

318318
printk("%sCall trace:\n", loglvl);
319-
arch_stack_walk(dump_backtrace_entry, (void *)loglvl, tsk, regs);
319+
kunwind_stack_walk(dump_backtrace_entry, (void *)loglvl, tsk, regs);
320320

321321
put_task_stack(tsk);
322322
}

0 commit comments

Comments
 (0)