Skip to content

riscv: ftrace: make stack walk more robust.

Puranjay Mohan linux-riscv lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 3 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/2riscv: stacktrace: use arch_stack_walk() in place of walk_stackframearch/riscv/include/asm/stacktrace.h arch/riscv/kernel/perf_callchain.c arch/riscv/kernel/stacktrace.c+15 -151 reply
2/2riscv: stacktrace: make walk_stackframe() more robustarch/riscv/kernel/stacktrace.c+49 -61 reply

Reviews trailers per patch

None of the 2 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchBjörn Töpel
SeriesR-b
1/2
2/2

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 0/2] riscv: ftrace: make stack walk more robust.

The current stack walker in riscv implemented in walk_stackframe() provides the PC to a callback function when it unwinds the stacks. This doesn't allow implementing stack walkers that need access to more information like the frame pointer, etc.

This series makes walk_stackframe() provide a unwinde_state structure to callback functions. This structure has all the information that walk_stackframe() can provide.

Currently, there are four users of walk_stackframe(): return_address(), perf_callchain_kernel(), dump_backtrace(), and __get_wchan(). All of these have been converted to use arch_stack_walk() rather than calling walk_stackframe() directly.

We need this to implement arch_bpf_stack_walk() that provides a callback that needs the FP, SP, and PC. This will be needed for implementing BFP exceptions for RISCV.

There are no functional changes in this series.

I have tested this by crashing the kernel and looking at the stack trace with and without CONFIG_FRAME_POINTER

Puranjay Mohan (2):
riscv: stacktrace: use arch_stack_walk() in place of walk_stackframe
riscv: stacktrace: make walk_stackframe() more robust

 arch/riscv/include/asm/stacktrace.h |  2 -
 arch/riscv/kernel/perf_callchain.c  |  2 +-
 arch/riscv/kernel/stacktrace.c      | 75 +++++++++++++++++++++++------
 3 files changed, 61 insertions(+), 18 deletions(-)
Signature · 1 line
2.40.1