Skip to content

Commit 23b2188

Browse files
AndybnACTpalmer-dabbelt
authored andcommitted
riscv: stacktrace: convert arch_stack_walk() to noinstr
arch_stack_walk() is called intensively in function_graph when the kernel is compiled with CONFIG_TRACE_IRQFLAGS. As a result, the kernel logs a lot of arch_stack_walk and its sub-functions into the ftrace buffer. However, these functions should not appear on the trace log because they are part of the ftrace itself. This patch references what arm64 does for the smae function. So it further prevent the re-enter kprobe issue, which is also possible on riscv. Related-to: commit 0fbcd8a ("arm64: Prohibit instrumentation on arch_stack_walk()") Fixes: 6803413 ("riscv: add CALLER_ADDRx support") Signed-off-by: Andy Chiu <[email protected]> Reviewed-by: Alexandre Ghiti <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 1613e60 commit 23b2188

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

arch/riscv/kernel/stacktrace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ unsigned long __get_wchan(struct task_struct *task)
156156
return pc;
157157
}
158158

159-
noinline void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
159+
noinline noinstr void arch_stack_walk(stack_trace_consume_fn consume_entry, void *cookie,
160160
struct task_struct *task, struct pt_regs *regs)
161161
{
162162
walk_stackframe(task, regs, consume_entry, cookie);

0 commit comments

Comments
 (0)