Message ID | 20220916005135.91945-1-liaochang1@huawei.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | riscv/ftrace: Set FTRACE_FORCE_LIST_FUNC if DYNAMIC_FTRACE_WITH_REGS is not set | expand |
diff --git a/arch/riscv/include/asm/ftrace.h b/arch/riscv/include/asm/ftrace.h index 04dad3380041..a9d365e46b52 100644 --- a/arch/riscv/include/asm/ftrace.h +++ b/arch/riscv/include/asm/ftrace.h @@ -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)
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. Fixes: 71e736a7d655 ("riscv/ftrace: Add ARCH_SUPPORTS_FTRACE_OPS support") Signed-off-by: Liao Chang <liaochang1@huawei.com> --- arch/riscv/include/asm/ftrace.h | 3 +++ 1 file changed, 3 insertions(+)