riscv/ftrace: Set FTRACE_FORCE_LIST_FUNC if DYNAMIC_FTRACE_WITH_REGS is not set
PATCH 1/1 riscv/ftrace: Set FTRACE_FORCE_LIST_FUNC if DYNAMIC_FTRACE_WITH_REGS is not set
With the following configuration options:
CONFIG_FUNCTION_TRACER=y
CONFIG_DYNAMIC_FTRACE is not set
CONFIG_DYNAMIC_FTRACE_WITH_REGS is not set
Setting function tracer leads to Linux being stuck:
echo function > /sys/kernel/tracing/current_tracer
The reason is: for static tracing, RISC-V mcount only support passing up ip and parent_ip, if it does not force list func, some C side effects occurs, where a function is called without passing a valid third parameter, then kernel will trap into page fault when jump from mcount to function_trace_call().
Fix this stuck issue by force kernel to use indirect list trace function, when CONFIG_DYNAMIC_FTRACE_WITH_REGS is not set.
--- arch/riscv/include/asm/ftrace.h | 3 +++ 1 file changed, 3 insertions(+)
arch/riscv/include/asm/ftrace.h +3 -0
@@ -23,7 +23,10 @@#define MCOUNT_NAME mcount#endif +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS #define ARCH_SUPPORTS_FTRACE_OPS 1 +#endif +#ifndef __ASSEMBLY__void MCOUNT_NAME (void );static inline unsigned long ftrace_call_adjust (unsigned long addr)
Signature · 1 line
2.17.1