riscv: stacktrace: fix usage of ftrace_graph_ret_addr()
PATCH 1/1 riscv: stacktrace: fix usage of ftrace_graph_ret_addr()
ftrace_graph_ret_addr() takes an idx integer pointer that is used to optimize the stack unwinding. Pass it a valid pointer to utilize the optimizations that might be available in the future.
The commit is making riscv's usage of ftrace_graph_ret_addr() match x86_64.
--- arch/riscv/kernel/stacktrace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/kernel/stacktrace.c +2 -1
@@ -32,6 +32,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, bool (*fn)(void *, unsigned long), void *arg) { unsigned long fp, sp, pc; +int graph_idx =0 ;int level =0 ;if (regs) {
@@ -68,7 +69,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, pc = regs->ra; }else { fp = frame->fp; - pc =ftrace_graph_ret_addr (current,NULL , frame->ra, + pc =ftrace_graph_ret_addr (current, &graph_idx, frame->ra, &frame->ra);if (pc == (unsigned long )ret_from_exception) {if (unlikely (!__kernel_text_address (pc) || !fn (arg, pc)))
Signature · 1 line
2.40.1
Quoted 8 lines · On Tue, 18 Jun 2024 14:58:20 +0000 Puranjay Mohan <[email protected]> wrote:
ftrace_graph_ret_addr()takes anidxinteger pointer that is used to optimize the stack unwinding. Pass it a valid pointer to utilize the optimizations that might be available in the future.The commit is making riscv's usage of
ftrace_graph_ret_addr()matchx86_64.Signed-off-by Puranjay Mohan <[email protected]>
Not only that, the updated code for ftrace_graph_ret_addr() will just return the passed in return address if it is NULL. Basically, it will not work without this.
-- Steve
Quoted 25 lines
--- arch/riscv/kernel/stacktrace.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)arch/riscv/kernel/stacktrace.c +2
-1@@ -32,6 +32,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, bool (*fn)(void *, unsigned long), void *arg) { unsigned long fp, sp, pc; +int graph_idx =0 ;int level =0 ;if (regs) {@@ -68,7 +69,7 @@ void notrace walk_stackframe(struct task_struct *task, struct pt_regs *regs, pc = regs->ra; }else { fp = frame->fp; - pc =ftrace_graph_ret_addr (current,NULL , frame->ra, + pc =ftrace_graph_ret_addr (current, &graph_idx, frame->ra, &frame->ra);if (pc == (unsigned long )ret_from_exception) {if (unlikely (!__kernel_text_address (pc) || !fn (arg, pc)))
This patch was applied to riscv/linux.git (fixes) by Palmer Dabbelt <[email protected]>:
Hello:
This patch was applied to riscv/linux.git (fixes)
by Palmer Dabbelt <[email protected]>:
Quoted 8 lines · On Tue, 18 Jun 2024 14:58:20 +0000 you wrote:
ftrace_graph_ret_addr()takes anidxinteger pointer that is used to optimize the stack unwinding. Pass it a valid pointer to utilize the optimizations that might be available in the future.The commit is making riscv's usage of
ftrace_graph_ret_addr()matchx86_64.[...]
Here is the summary with links:
- riscv: stacktrace: fix usage of ftrace_graph_ret_addr()
https://git.kernel.org/riscv/c/393da6cbb2ff
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html