[<prev] [next>] [day] [month] [year] [list]
Message-ID: <20220916005135.91945-1-liaochang1@huawei.com>
Date: Fri, 16 Sep 2022 08:51:35 +0800
From: Liao Chang <liaochang1@...wei.com>
To: <rostedt@...dmis.org>, <mingo@...hat.com>,
<paul.walmsley@...ive.com>, <palmer@...belt.com>,
<aou@...s.berkeley.edu>, <alankao@...estech.com>
CC: <linux-riscv@...ts.infradead.org>, <linux-kernel@...r.kernel.org>
Subject: [PATCH] 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.
Fixes: 71e736a7d655 ("riscv/ftrace: Add ARCH_SUPPORTS_FTRACE_OPS support")
Signed-off-by: Liao Chang <liaochang1@...wei.com>
---
arch/riscv/include/asm/ftrace.h | 3 +++
1 file changed, 3 insertions(+)
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)
--
2.17.1
Powered by blists - more mailing lists