aboutsummaryrefslogtreecommitdiff
path: root/arch/loongarch/include
diff options
context:
space:
mode:
authorGravatar Qing Zhang <zhangqing@loongson.cn> 2022-12-10 22:40:16 +0800
committerGravatar Huacai Chen <chenhuacai@loongson.cn> 2022-12-14 08:41:53 +0800
commitac7127e1cc65aeb578998c992a05dbc80fa18f0f (patch)
tree3cc8f20d43cf9a78558dfe799d3b4fe1bcad6fec /arch/loongarch/include
parentLoongArch/ftrace: Add HAVE_DYNAMIC_FTRACE_WITH_REGS support (diff)
downloadlinux-ac7127e1cc65aeb578998c992a05dbc80fa18f0f.tar.gz
linux-ac7127e1cc65aeb578998c992a05dbc80fa18f0f.tar.bz2
linux-ac7127e1cc65aeb578998c992a05dbc80fa18f0f.zip
LoongArch/ftrace: Add HAVE_DYNAMIC_FTRACE_WITH_ARGS support
Allow for arguments to be passed in to ftrace_regs by default. If this is set, then arguments and stack can be found from the pt_regs. 1. HAVE_DYNAMIC_FTRACE_WITH_ARGS don't need special hook for graph tracer entry point, but instead we can use graph_ops::func function to install the return_hooker. 2. Livepatch requires this option in the future. Signed-off-by: Qing Zhang <zhangqing@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn>
Diffstat (limited to 'arch/loongarch/include')
-rw-r--r--arch/loongarch/include/asm/ftrace.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/arch/loongarch/include/asm/ftrace.h b/arch/loongarch/include/asm/ftrace.h
index dd4a0c8efd24..ee7feface27a 100644
--- a/arch/loongarch/include/asm/ftrace.h
+++ b/arch/loongarch/include/asm/ftrace.h
@@ -37,6 +37,23 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent);
#endif /* CONFIG_DYNAMIC_FTRACE */
+#ifdef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
+struct ftrace_ops;
+
+struct ftrace_regs {
+ struct pt_regs regs;
+};
+
+static __always_inline struct pt_regs *arch_ftrace_get_regs(struct ftrace_regs *fregs)
+{
+ return &fregs->regs;
+}
+
+#define ftrace_graph_func ftrace_graph_func
+void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
+ struct ftrace_ops *op, struct ftrace_regs *fregs);
+#endif
+
#endif /* __ASSEMBLY__ */
#endif /* CONFIG_FUNCTION_TRACER */