All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] ftrace: cleanup ftrace_graph_caller enable and disable
@ 2022-02-24  9:32 ` Chengming Zhou
  0 siblings, 0 replies; 20+ messages in thread
From: Chengming Zhou @ 2022-02-24  9:32 UTC (permalink / raw)
  To: rostedt, mark.rutland, mingo, tglx, catalin.marinas, will,
	dave.hansen, broonie
  Cc: x86, linux-arm-kernel, linux-kernel, songmuchun, qirui.001,
	Chengming Zhou

The ftrace_enable_ftrace_graph_caller() and
ftrace_disable_ftrace_graph_caller() are used to do special
hooks for graph tracer, which are not needed on some ARCHs
that use graph_ops:func function to install return_hooker.

So introduce the weak version in Ftrace core code to prepare
for cleanup.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
 kernel/trace/ftrace.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index f9feb197b2da..60ae009e6684 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2704,6 +2704,26 @@ int __weak ftrace_arch_code_modify_post_process(void)
 	return 0;
 }
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+/*
+ * archs can override this function if they must do something
+ * to enable hook for graph tracer.
+ */
+int __weak ftrace_enable_ftrace_graph_caller(void)
+{
+	return 0;
+}
+
+/*
+ * archs can override this function if they must do something
+ * to disable hook for graph tracer.
+ */
+int __weak ftrace_disable_ftrace_graph_caller(void)
+{
+	return 0;
+}
+#endif
+
 void ftrace_modify_all_code(int command)
 {
 	int update = command & FTRACE_UPDATE_TRACE_FUNC;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 1/3] ftrace: cleanup ftrace_graph_caller enable and disable
@ 2022-02-24  9:32 ` Chengming Zhou
  0 siblings, 0 replies; 20+ messages in thread
From: Chengming Zhou @ 2022-02-24  9:32 UTC (permalink / raw)
  To: rostedt, mark.rutland, mingo, tglx, catalin.marinas, will,
	dave.hansen, broonie
  Cc: x86, linux-arm-kernel, linux-kernel, songmuchun, qirui.001,
	Chengming Zhou

The ftrace_enable_ftrace_graph_caller() and
ftrace_disable_ftrace_graph_caller() are used to do special
hooks for graph tracer, which are not needed on some ARCHs
that use graph_ops:func function to install return_hooker.

So introduce the weak version in Ftrace core code to prepare
for cleanup.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
 kernel/trace/ftrace.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index f9feb197b2da..60ae009e6684 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -2704,6 +2704,26 @@ int __weak ftrace_arch_code_modify_post_process(void)
 	return 0;
 }
 
+#ifdef CONFIG_FUNCTION_GRAPH_TRACER
+/*
+ * archs can override this function if they must do something
+ * to enable hook for graph tracer.
+ */
+int __weak ftrace_enable_ftrace_graph_caller(void)
+{
+	return 0;
+}
+
+/*
+ * archs can override this function if they must do something
+ * to disable hook for graph tracer.
+ */
+int __weak ftrace_disable_ftrace_graph_caller(void)
+{
+	return 0;
+}
+#endif
+
 void ftrace_modify_all_code(int command)
 {
 	int update = command & FTRACE_UPDATE_TRACE_FUNC;
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 2/3] x86/ftrace: cleanup graph tracer
  2022-02-24  9:32 ` Chengming Zhou
@ 2022-02-24  9:32   ` Chengming Zhou
  -1 siblings, 0 replies; 20+ messages in thread
From: Chengming Zhou @ 2022-02-24  9:32 UTC (permalink / raw)
  To: rostedt, mark.rutland, mingo, tglx, catalin.marinas, will,
	dave.hansen, broonie
  Cc: x86, linux-arm-kernel, linux-kernel, songmuchun, qirui.001,
	Chengming Zhou

Put CONFIG_DYNAMIC_FTRACE related code after prepare_ftrace_return(),
in which we define ftrace_graph_func() for graph_ops in
DYNAMIC_FTRACE_WITH_ARGS case, then define ftrace_graph_caller
enable and disable functions in the #else case to override.

Since ftrace_graph_caller enable and disable functions have weak
versions in Ftrace core code, we don't need to override them in the
DYNAMIC_FTRACE_WITH_ARGS case. This patch is just a cleanup,
doesn't have functional changes actually.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
 arch/x86/kernel/ftrace.c | 78 +++++++++++++++++-----------------------
 1 file changed, 32 insertions(+), 46 deletions(-)

diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 7cc540e6de0c..e49c9d3e986b 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -583,51 +583,6 @@ void arch_ftrace_trampoline_free(struct ftrace_ops *ops)
 #endif /* CONFIG_DYNAMIC_FTRACE */
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
-
-#ifdef CONFIG_DYNAMIC_FTRACE
-
-#ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
-extern void ftrace_graph_call(void);
-static const char *ftrace_jmp_replace(unsigned long ip, unsigned long addr)
-{
-	return text_gen_insn(JMP32_INSN_OPCODE, (void *)ip, (void *)addr);
-}
-
-static int ftrace_mod_jmp(unsigned long ip, void *func)
-{
-	const char *new;
-
-	new = ftrace_jmp_replace(ip, (unsigned long)func);
-	text_poke_bp((void *)ip, new, MCOUNT_INSN_SIZE, NULL);
-	return 0;
-}
-
-int ftrace_enable_ftrace_graph_caller(void)
-{
-	unsigned long ip = (unsigned long)(&ftrace_graph_call);
-
-	return ftrace_mod_jmp(ip, &ftrace_graph_caller);
-}
-
-int ftrace_disable_ftrace_graph_caller(void)
-{
-	unsigned long ip = (unsigned long)(&ftrace_graph_call);
-
-	return ftrace_mod_jmp(ip, &ftrace_stub);
-}
-#else /* !CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS */
-int ftrace_enable_ftrace_graph_caller(void)
-{
-	return 0;
-}
-
-int ftrace_disable_ftrace_graph_caller(void)
-{
-	return 0;
-}
-#endif /* CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS */
-#endif /* !CONFIG_DYNAMIC_FTRACE */
-
 /*
  * Hook the return address and push it in the stack of return addrs
  * in current thread info.
@@ -666,6 +621,8 @@ void prepare_ftrace_return(unsigned long ip, unsigned long *parent,
 	ftrace_test_recursion_unlock(bit);
 }
 
+#ifdef CONFIG_DYNAMIC_FTRACE
+
 #ifdef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
 void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
 		       struct ftrace_ops *op, struct ftrace_regs *fregs)
@@ -675,6 +632,35 @@ void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
 
 	prepare_ftrace_return(ip, (unsigned long *)stack, 0);
 }
-#endif
+#else
+extern void ftrace_graph_call(void);
+static const char *ftrace_jmp_replace(unsigned long ip, unsigned long addr)
+{
+	return text_gen_insn(JMP32_INSN_OPCODE, (void *)ip, (void *)addr);
+}
 
+static int ftrace_mod_jmp(unsigned long ip, void *func)
+{
+	const char *new;
+
+	new = ftrace_jmp_replace(ip, (unsigned long)func);
+	text_poke_bp((void *)ip, new, MCOUNT_INSN_SIZE, NULL);
+	return 0;
+}
+
+int ftrace_enable_ftrace_graph_caller(void)
+{
+	unsigned long ip = (unsigned long)(&ftrace_graph_call);
+
+	return ftrace_mod_jmp(ip, &ftrace_graph_caller);
+}
+
+int ftrace_disable_ftrace_graph_caller(void)
+{
+	unsigned long ip = (unsigned long)(&ftrace_graph_call);
+
+	return ftrace_mod_jmp(ip, &ftrace_stub);
+}
+#endif /* CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS */
+#endif /* CONFIG_DYNAMIC_FTRACE */
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 2/3] x86/ftrace: cleanup graph tracer
@ 2022-02-24  9:32   ` Chengming Zhou
  0 siblings, 0 replies; 20+ messages in thread
From: Chengming Zhou @ 2022-02-24  9:32 UTC (permalink / raw)
  To: rostedt, mark.rutland, mingo, tglx, catalin.marinas, will,
	dave.hansen, broonie
  Cc: x86, linux-arm-kernel, linux-kernel, songmuchun, qirui.001,
	Chengming Zhou

Put CONFIG_DYNAMIC_FTRACE related code after prepare_ftrace_return(),
in which we define ftrace_graph_func() for graph_ops in
DYNAMIC_FTRACE_WITH_ARGS case, then define ftrace_graph_caller
enable and disable functions in the #else case to override.

Since ftrace_graph_caller enable and disable functions have weak
versions in Ftrace core code, we don't need to override them in the
DYNAMIC_FTRACE_WITH_ARGS case. This patch is just a cleanup,
doesn't have functional changes actually.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
 arch/x86/kernel/ftrace.c | 78 +++++++++++++++++-----------------------
 1 file changed, 32 insertions(+), 46 deletions(-)

diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 7cc540e6de0c..e49c9d3e986b 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -583,51 +583,6 @@ void arch_ftrace_trampoline_free(struct ftrace_ops *ops)
 #endif /* CONFIG_DYNAMIC_FTRACE */
 
 #ifdef CONFIG_FUNCTION_GRAPH_TRACER
-
-#ifdef CONFIG_DYNAMIC_FTRACE
-
-#ifndef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
-extern void ftrace_graph_call(void);
-static const char *ftrace_jmp_replace(unsigned long ip, unsigned long addr)
-{
-	return text_gen_insn(JMP32_INSN_OPCODE, (void *)ip, (void *)addr);
-}
-
-static int ftrace_mod_jmp(unsigned long ip, void *func)
-{
-	const char *new;
-
-	new = ftrace_jmp_replace(ip, (unsigned long)func);
-	text_poke_bp((void *)ip, new, MCOUNT_INSN_SIZE, NULL);
-	return 0;
-}
-
-int ftrace_enable_ftrace_graph_caller(void)
-{
-	unsigned long ip = (unsigned long)(&ftrace_graph_call);
-
-	return ftrace_mod_jmp(ip, &ftrace_graph_caller);
-}
-
-int ftrace_disable_ftrace_graph_caller(void)
-{
-	unsigned long ip = (unsigned long)(&ftrace_graph_call);
-
-	return ftrace_mod_jmp(ip, &ftrace_stub);
-}
-#else /* !CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS */
-int ftrace_enable_ftrace_graph_caller(void)
-{
-	return 0;
-}
-
-int ftrace_disable_ftrace_graph_caller(void)
-{
-	return 0;
-}
-#endif /* CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS */
-#endif /* !CONFIG_DYNAMIC_FTRACE */
-
 /*
  * Hook the return address and push it in the stack of return addrs
  * in current thread info.
@@ -666,6 +621,8 @@ void prepare_ftrace_return(unsigned long ip, unsigned long *parent,
 	ftrace_test_recursion_unlock(bit);
 }
 
+#ifdef CONFIG_DYNAMIC_FTRACE
+
 #ifdef CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS
 void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
 		       struct ftrace_ops *op, struct ftrace_regs *fregs)
@@ -675,6 +632,35 @@ void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
 
 	prepare_ftrace_return(ip, (unsigned long *)stack, 0);
 }
-#endif
+#else
+extern void ftrace_graph_call(void);
+static const char *ftrace_jmp_replace(unsigned long ip, unsigned long addr)
+{
+	return text_gen_insn(JMP32_INSN_OPCODE, (void *)ip, (void *)addr);
+}
 
+static int ftrace_mod_jmp(unsigned long ip, void *func)
+{
+	const char *new;
+
+	new = ftrace_jmp_replace(ip, (unsigned long)func);
+	text_poke_bp((void *)ip, new, MCOUNT_INSN_SIZE, NULL);
+	return 0;
+}
+
+int ftrace_enable_ftrace_graph_caller(void)
+{
+	unsigned long ip = (unsigned long)(&ftrace_graph_call);
+
+	return ftrace_mod_jmp(ip, &ftrace_graph_caller);
+}
+
+int ftrace_disable_ftrace_graph_caller(void)
+{
+	unsigned long ip = (unsigned long)(&ftrace_graph_call);
+
+	return ftrace_mod_jmp(ip, &ftrace_stub);
+}
+#endif /* CONFIG_HAVE_DYNAMIC_FTRACE_WITH_ARGS */
+#endif /* CONFIG_DYNAMIC_FTRACE */
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
  2022-02-24  9:32 ` Chengming Zhou
@ 2022-02-24  9:32   ` Chengming Zhou
  -1 siblings, 0 replies; 20+ messages in thread
From: Chengming Zhou @ 2022-02-24  9:32 UTC (permalink / raw)
  To: rostedt, mark.rutland, mingo, tglx, catalin.marinas, will,
	dave.hansen, broonie
  Cc: x86, linux-arm-kernel, linux-kernel, songmuchun, qirui.001,
	Chengming Zhou

As we do in commit 0c0593b45c9b ("x86/ftrace: Make function graph
use ftrace directly"), we don't need special hook for graph tracer,
but instead we use graph_ops:func function to install return_hooker.

Since commit 3b23e4991fb6 ("arm64: implement ftrace with regs") add
implementation for FTRACE_WITH_REGS on arm64, we can easily adopt
the same cleanup on arm64. And this cleanup only changes the
FTRACE_WITH_REGS implementation, so the mcount-based implementation
is unaffected.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
Changes in v3:
 - Add comments in ftrace_graph_func() as suggested by Steve.

Changes in v2:
 - Remove FTRACE_WITH_REGS ftrace_graph_caller asm as suggested by Mark.
---
 arch/arm64/include/asm/ftrace.h  |  7 +++++++
 arch/arm64/kernel/entry-ftrace.S | 17 -----------------
 arch/arm64/kernel/ftrace.c       | 17 +++++++++++++++++
 3 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h
index 1494cfa8639b..dbc45a4157fa 100644
--- a/arch/arm64/include/asm/ftrace.h
+++ b/arch/arm64/include/asm/ftrace.h
@@ -80,8 +80,15 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
 
 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
 struct dyn_ftrace;
+struct ftrace_ops;
+struct ftrace_regs;
+
 int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
 #define ftrace_init_nop ftrace_init_nop
+
+void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
+		       struct ftrace_ops *op, struct ftrace_regs *fregs);
+#define ftrace_graph_func ftrace_graph_func
 #endif
 
 #define ftrace_return_address(n) return_address(n)
diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
index e535480a4069..d42a205ef625 100644
--- a/arch/arm64/kernel/entry-ftrace.S
+++ b/arch/arm64/kernel/entry-ftrace.S
@@ -97,12 +97,6 @@ SYM_CODE_START(ftrace_common)
 SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
 	bl	ftrace_stub
 
-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
-SYM_INNER_LABEL(ftrace_graph_call, SYM_L_GLOBAL) // ftrace_graph_caller();
-	nop				// If enabled, this will be replaced
-					// "b ftrace_graph_caller"
-#endif
-
 /*
  * At the callsite x0-x8 and x19-x30 were live. Any C code will have preserved
  * x19-x29 per the AAPCS, and we created frame records upon entry, so we need
@@ -127,17 +121,6 @@ ftrace_common_return:
 	ret	x9
 SYM_CODE_END(ftrace_common)
 
-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
-SYM_CODE_START(ftrace_graph_caller)
-	ldr	x0, [sp, #S_PC]
-	sub	x0, x0, #AARCH64_INSN_SIZE	// ip (callsite's BL insn)
-	add	x1, sp, #S_LR			// parent_ip (callsite's LR)
-	ldr	x2, [sp, #PT_REGS_SIZE]	   	// parent fp (callsite's FP)
-	bl	prepare_ftrace_return
-	b	ftrace_common_return
-SYM_CODE_END(ftrace_graph_caller)
-#endif
-
 #else /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
 
 /*
diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
index 4506c4a90ac1..35eb7c9b5e53 100644
--- a/arch/arm64/kernel/ftrace.c
+++ b/arch/arm64/kernel/ftrace.c
@@ -268,6 +268,22 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
 }
 
 #ifdef CONFIG_DYNAMIC_FTRACE
+
+#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
+void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
+		       struct ftrace_ops *op, struct ftrace_regs *fregs)
+{
+	/*
+	 * Athough graph_ops doesn't have FTRACE_OPS_FL_SAVE_REGS set in flags,
+	 * regs can't be NULL in DYNAMIC_FTRACE_WITH_REGS. By design, it should
+	 * be fixed when DYNAMIC_FTRACE_WITH_ARGS is implemented.
+	 */
+	struct pt_regs *regs = arch_ftrace_get_regs(fregs);
+	unsigned long *parent = (unsigned long *)&procedure_link_pointer(regs);
+
+	prepare_ftrace_return(ip, parent, frame_pointer(regs));
+}
+#else
 /*
  * Turn on/off the call to ftrace_graph_caller() in ftrace_caller()
  * depending on @enable.
@@ -297,5 +313,6 @@ int ftrace_disable_ftrace_graph_caller(void)
 {
 	return ftrace_modify_graph_caller(false);
 }
+#endif /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
 #endif /* CONFIG_DYNAMIC_FTRACE */
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
@ 2022-02-24  9:32   ` Chengming Zhou
  0 siblings, 0 replies; 20+ messages in thread
From: Chengming Zhou @ 2022-02-24  9:32 UTC (permalink / raw)
  To: rostedt, mark.rutland, mingo, tglx, catalin.marinas, will,
	dave.hansen, broonie
  Cc: x86, linux-arm-kernel, linux-kernel, songmuchun, qirui.001,
	Chengming Zhou

As we do in commit 0c0593b45c9b ("x86/ftrace: Make function graph
use ftrace directly"), we don't need special hook for graph tracer,
but instead we use graph_ops:func function to install return_hooker.

Since commit 3b23e4991fb6 ("arm64: implement ftrace with regs") add
implementation for FTRACE_WITH_REGS on arm64, we can easily adopt
the same cleanup on arm64. And this cleanup only changes the
FTRACE_WITH_REGS implementation, so the mcount-based implementation
is unaffected.

Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
---
Changes in v3:
 - Add comments in ftrace_graph_func() as suggested by Steve.

Changes in v2:
 - Remove FTRACE_WITH_REGS ftrace_graph_caller asm as suggested by Mark.
---
 arch/arm64/include/asm/ftrace.h  |  7 +++++++
 arch/arm64/kernel/entry-ftrace.S | 17 -----------------
 arch/arm64/kernel/ftrace.c       | 17 +++++++++++++++++
 3 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h
index 1494cfa8639b..dbc45a4157fa 100644
--- a/arch/arm64/include/asm/ftrace.h
+++ b/arch/arm64/include/asm/ftrace.h
@@ -80,8 +80,15 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
 
 #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
 struct dyn_ftrace;
+struct ftrace_ops;
+struct ftrace_regs;
+
 int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
 #define ftrace_init_nop ftrace_init_nop
+
+void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
+		       struct ftrace_ops *op, struct ftrace_regs *fregs);
+#define ftrace_graph_func ftrace_graph_func
 #endif
 
 #define ftrace_return_address(n) return_address(n)
diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
index e535480a4069..d42a205ef625 100644
--- a/arch/arm64/kernel/entry-ftrace.S
+++ b/arch/arm64/kernel/entry-ftrace.S
@@ -97,12 +97,6 @@ SYM_CODE_START(ftrace_common)
 SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
 	bl	ftrace_stub
 
-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
-SYM_INNER_LABEL(ftrace_graph_call, SYM_L_GLOBAL) // ftrace_graph_caller();
-	nop				// If enabled, this will be replaced
-					// "b ftrace_graph_caller"
-#endif
-
 /*
  * At the callsite x0-x8 and x19-x30 were live. Any C code will have preserved
  * x19-x29 per the AAPCS, and we created frame records upon entry, so we need
@@ -127,17 +121,6 @@ ftrace_common_return:
 	ret	x9
 SYM_CODE_END(ftrace_common)
 
-#ifdef CONFIG_FUNCTION_GRAPH_TRACER
-SYM_CODE_START(ftrace_graph_caller)
-	ldr	x0, [sp, #S_PC]
-	sub	x0, x0, #AARCH64_INSN_SIZE	// ip (callsite's BL insn)
-	add	x1, sp, #S_LR			// parent_ip (callsite's LR)
-	ldr	x2, [sp, #PT_REGS_SIZE]	   	// parent fp (callsite's FP)
-	bl	prepare_ftrace_return
-	b	ftrace_common_return
-SYM_CODE_END(ftrace_graph_caller)
-#endif
-
 #else /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
 
 /*
diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
index 4506c4a90ac1..35eb7c9b5e53 100644
--- a/arch/arm64/kernel/ftrace.c
+++ b/arch/arm64/kernel/ftrace.c
@@ -268,6 +268,22 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
 }
 
 #ifdef CONFIG_DYNAMIC_FTRACE
+
+#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
+void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
+		       struct ftrace_ops *op, struct ftrace_regs *fregs)
+{
+	/*
+	 * Athough graph_ops doesn't have FTRACE_OPS_FL_SAVE_REGS set in flags,
+	 * regs can't be NULL in DYNAMIC_FTRACE_WITH_REGS. By design, it should
+	 * be fixed when DYNAMIC_FTRACE_WITH_ARGS is implemented.
+	 */
+	struct pt_regs *regs = arch_ftrace_get_regs(fregs);
+	unsigned long *parent = (unsigned long *)&procedure_link_pointer(regs);
+
+	prepare_ftrace_return(ip, parent, frame_pointer(regs));
+}
+#else
 /*
  * Turn on/off the call to ftrace_graph_caller() in ftrace_caller()
  * depending on @enable.
@@ -297,5 +313,6 @@ int ftrace_disable_ftrace_graph_caller(void)
 {
 	return ftrace_modify_graph_caller(false);
 }
+#endif /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
 #endif /* CONFIG_DYNAMIC_FTRACE */
 #endif /* CONFIG_FUNCTION_GRAPH_TRACER */
-- 
2.20.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
  2022-02-24  9:32   ` Chengming Zhou
@ 2022-03-22 12:48     ` Chengming Zhou
  -1 siblings, 0 replies; 20+ messages in thread
From: Chengming Zhou @ 2022-03-22 12:48 UTC (permalink / raw)
  To: rostedt, mark.rutland, mingo, tglx, catalin.marinas, will,
	dave.hansen, broonie
  Cc: x86, linux-arm-kernel, linux-kernel, songmuchun, qirui.001

Hello,

ping... have any comments?

Thanks.

On 2022/2/24 5:32 下午, Chengming Zhou wrote:
> As we do in commit 0c0593b45c9b ("x86/ftrace: Make function graph
> use ftrace directly"), we don't need special hook for graph tracer,
> but instead we use graph_ops:func function to install return_hooker.
> 
> Since commit 3b23e4991fb6 ("arm64: implement ftrace with regs") add
> implementation for FTRACE_WITH_REGS on arm64, we can easily adopt
> the same cleanup on arm64. And this cleanup only changes the
> FTRACE_WITH_REGS implementation, so the mcount-based implementation
> is unaffected.
> 
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
> ---
> Changes in v3:
>  - Add comments in ftrace_graph_func() as suggested by Steve.
> 
> Changes in v2:
>  - Remove FTRACE_WITH_REGS ftrace_graph_caller asm as suggested by Mark.
> ---
>  arch/arm64/include/asm/ftrace.h  |  7 +++++++
>  arch/arm64/kernel/entry-ftrace.S | 17 -----------------
>  arch/arm64/kernel/ftrace.c       | 17 +++++++++++++++++
>  3 files changed, 24 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h
> index 1494cfa8639b..dbc45a4157fa 100644
> --- a/arch/arm64/include/asm/ftrace.h
> +++ b/arch/arm64/include/asm/ftrace.h
> @@ -80,8 +80,15 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
>  
>  #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
>  struct dyn_ftrace;
> +struct ftrace_ops;
> +struct ftrace_regs;
> +
>  int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
>  #define ftrace_init_nop ftrace_init_nop
> +
> +void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
> +		       struct ftrace_ops *op, struct ftrace_regs *fregs);
> +#define ftrace_graph_func ftrace_graph_func
>  #endif
>  
>  #define ftrace_return_address(n) return_address(n)
> diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
> index e535480a4069..d42a205ef625 100644
> --- a/arch/arm64/kernel/entry-ftrace.S
> +++ b/arch/arm64/kernel/entry-ftrace.S
> @@ -97,12 +97,6 @@ SYM_CODE_START(ftrace_common)
>  SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
>  	bl	ftrace_stub
>  
> -#ifdef CONFIG_FUNCTION_GRAPH_TRACER
> -SYM_INNER_LABEL(ftrace_graph_call, SYM_L_GLOBAL) // ftrace_graph_caller();
> -	nop				// If enabled, this will be replaced
> -					// "b ftrace_graph_caller"
> -#endif
> -
>  /*
>   * At the callsite x0-x8 and x19-x30 were live. Any C code will have preserved
>   * x19-x29 per the AAPCS, and we created frame records upon entry, so we need
> @@ -127,17 +121,6 @@ ftrace_common_return:
>  	ret	x9
>  SYM_CODE_END(ftrace_common)
>  
> -#ifdef CONFIG_FUNCTION_GRAPH_TRACER
> -SYM_CODE_START(ftrace_graph_caller)
> -	ldr	x0, [sp, #S_PC]
> -	sub	x0, x0, #AARCH64_INSN_SIZE	// ip (callsite's BL insn)
> -	add	x1, sp, #S_LR			// parent_ip (callsite's LR)
> -	ldr	x2, [sp, #PT_REGS_SIZE]	   	// parent fp (callsite's FP)
> -	bl	prepare_ftrace_return
> -	b	ftrace_common_return
> -SYM_CODE_END(ftrace_graph_caller)
> -#endif
> -
>  #else /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
>  
>  /*
> diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
> index 4506c4a90ac1..35eb7c9b5e53 100644
> --- a/arch/arm64/kernel/ftrace.c
> +++ b/arch/arm64/kernel/ftrace.c
> @@ -268,6 +268,22 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
>  }
>  
>  #ifdef CONFIG_DYNAMIC_FTRACE
> +
> +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> +void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
> +		       struct ftrace_ops *op, struct ftrace_regs *fregs)
> +{
> +	/*
> +	 * Athough graph_ops doesn't have FTRACE_OPS_FL_SAVE_REGS set in flags,
> +	 * regs can't be NULL in DYNAMIC_FTRACE_WITH_REGS. By design, it should
> +	 * be fixed when DYNAMIC_FTRACE_WITH_ARGS is implemented.
> +	 */
> +	struct pt_regs *regs = arch_ftrace_get_regs(fregs);
> +	unsigned long *parent = (unsigned long *)&procedure_link_pointer(regs);
> +
> +	prepare_ftrace_return(ip, parent, frame_pointer(regs));
> +}
> +#else
>  /*
>   * Turn on/off the call to ftrace_graph_caller() in ftrace_caller()
>   * depending on @enable.
> @@ -297,5 +313,6 @@ int ftrace_disable_ftrace_graph_caller(void)
>  {
>  	return ftrace_modify_graph_caller(false);
>  }
> +#endif /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
>  #endif /* CONFIG_DYNAMIC_FTRACE */
>  #endif /* CONFIG_FUNCTION_GRAPH_TRACER */

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
@ 2022-03-22 12:48     ` Chengming Zhou
  0 siblings, 0 replies; 20+ messages in thread
From: Chengming Zhou @ 2022-03-22 12:48 UTC (permalink / raw)
  To: rostedt, mark.rutland, mingo, tglx, catalin.marinas, will,
	dave.hansen, broonie
  Cc: x86, linux-arm-kernel, linux-kernel, songmuchun, qirui.001

Hello,

ping... have any comments?

Thanks.

On 2022/2/24 5:32 下午, Chengming Zhou wrote:
> As we do in commit 0c0593b45c9b ("x86/ftrace: Make function graph
> use ftrace directly"), we don't need special hook for graph tracer,
> but instead we use graph_ops:func function to install return_hooker.
> 
> Since commit 3b23e4991fb6 ("arm64: implement ftrace with regs") add
> implementation for FTRACE_WITH_REGS on arm64, we can easily adopt
> the same cleanup on arm64. And this cleanup only changes the
> FTRACE_WITH_REGS implementation, so the mcount-based implementation
> is unaffected.
> 
> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
> ---
> Changes in v3:
>  - Add comments in ftrace_graph_func() as suggested by Steve.
> 
> Changes in v2:
>  - Remove FTRACE_WITH_REGS ftrace_graph_caller asm as suggested by Mark.
> ---
>  arch/arm64/include/asm/ftrace.h  |  7 +++++++
>  arch/arm64/kernel/entry-ftrace.S | 17 -----------------
>  arch/arm64/kernel/ftrace.c       | 17 +++++++++++++++++
>  3 files changed, 24 insertions(+), 17 deletions(-)
> 
> diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h
> index 1494cfa8639b..dbc45a4157fa 100644
> --- a/arch/arm64/include/asm/ftrace.h
> +++ b/arch/arm64/include/asm/ftrace.h
> @@ -80,8 +80,15 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
>  
>  #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
>  struct dyn_ftrace;
> +struct ftrace_ops;
> +struct ftrace_regs;
> +
>  int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
>  #define ftrace_init_nop ftrace_init_nop
> +
> +void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
> +		       struct ftrace_ops *op, struct ftrace_regs *fregs);
> +#define ftrace_graph_func ftrace_graph_func
>  #endif
>  
>  #define ftrace_return_address(n) return_address(n)
> diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
> index e535480a4069..d42a205ef625 100644
> --- a/arch/arm64/kernel/entry-ftrace.S
> +++ b/arch/arm64/kernel/entry-ftrace.S
> @@ -97,12 +97,6 @@ SYM_CODE_START(ftrace_common)
>  SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
>  	bl	ftrace_stub
>  
> -#ifdef CONFIG_FUNCTION_GRAPH_TRACER
> -SYM_INNER_LABEL(ftrace_graph_call, SYM_L_GLOBAL) // ftrace_graph_caller();
> -	nop				// If enabled, this will be replaced
> -					// "b ftrace_graph_caller"
> -#endif
> -
>  /*
>   * At the callsite x0-x8 and x19-x30 were live. Any C code will have preserved
>   * x19-x29 per the AAPCS, and we created frame records upon entry, so we need
> @@ -127,17 +121,6 @@ ftrace_common_return:
>  	ret	x9
>  SYM_CODE_END(ftrace_common)
>  
> -#ifdef CONFIG_FUNCTION_GRAPH_TRACER
> -SYM_CODE_START(ftrace_graph_caller)
> -	ldr	x0, [sp, #S_PC]
> -	sub	x0, x0, #AARCH64_INSN_SIZE	// ip (callsite's BL insn)
> -	add	x1, sp, #S_LR			// parent_ip (callsite's LR)
> -	ldr	x2, [sp, #PT_REGS_SIZE]	   	// parent fp (callsite's FP)
> -	bl	prepare_ftrace_return
> -	b	ftrace_common_return
> -SYM_CODE_END(ftrace_graph_caller)
> -#endif
> -
>  #else /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
>  
>  /*
> diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
> index 4506c4a90ac1..35eb7c9b5e53 100644
> --- a/arch/arm64/kernel/ftrace.c
> +++ b/arch/arm64/kernel/ftrace.c
> @@ -268,6 +268,22 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
>  }
>  
>  #ifdef CONFIG_DYNAMIC_FTRACE
> +
> +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> +void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
> +		       struct ftrace_ops *op, struct ftrace_regs *fregs)
> +{
> +	/*
> +	 * Athough graph_ops doesn't have FTRACE_OPS_FL_SAVE_REGS set in flags,
> +	 * regs can't be NULL in DYNAMIC_FTRACE_WITH_REGS. By design, it should
> +	 * be fixed when DYNAMIC_FTRACE_WITH_ARGS is implemented.
> +	 */
> +	struct pt_regs *regs = arch_ftrace_get_regs(fregs);
> +	unsigned long *parent = (unsigned long *)&procedure_link_pointer(regs);
> +
> +	prepare_ftrace_return(ip, parent, frame_pointer(regs));
> +}
> +#else
>  /*
>   * Turn on/off the call to ftrace_graph_caller() in ftrace_caller()
>   * depending on @enable.
> @@ -297,5 +313,6 @@ int ftrace_disable_ftrace_graph_caller(void)
>  {
>  	return ftrace_modify_graph_caller(false);
>  }
> +#endif /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
>  #endif /* CONFIG_DYNAMIC_FTRACE */
>  #endif /* CONFIG_FUNCTION_GRAPH_TRACER */

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
  2022-03-22 12:48     ` Chengming Zhou
@ 2022-03-22 13:41       ` Steven Rostedt
  -1 siblings, 0 replies; 20+ messages in thread
From: Steven Rostedt @ 2022-03-22 13:41 UTC (permalink / raw)
  To: Chengming Zhou
  Cc: mark.rutland, mingo, tglx, catalin.marinas, will, dave.hansen,
	broonie, x86, linux-arm-kernel, linux-kernel, songmuchun,
	qirui.001

On Tue, 22 Mar 2022 20:48:00 +0800
Chengming Zhou <zhouchengming@bytedance.com> wrote:

> Hello,
> 
> ping... have any comments?

Hi Chengming,

BTW, if you don't hear back for a week, it's OK to send a ping. You don't
need to wait a month. Usually, it's just that the maintainers have other
priorities and will try to look at it when they get a chance, but then
forget to do so :-/


> 
> Thanks.
> 
> On 2022/2/24 5:32 下午, Chengming Zhou wrote:
> > As we do in commit 0c0593b45c9b ("x86/ftrace: Make function graph
> > use ftrace directly"), we don't need special hook for graph tracer,
> > but instead we use graph_ops:func function to install return_hooker.
> > 
> > Since commit 3b23e4991fb6 ("arm64: implement ftrace with regs") add
> > implementation for FTRACE_WITH_REGS on arm64, we can easily adopt
> > the same cleanup on arm64. And this cleanup only changes the
> > FTRACE_WITH_REGS implementation, so the mcount-based implementation
> > is unaffected.
> > 
> > Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
> > ---
> > Changes in v3:
> >  - Add comments in ftrace_graph_func() as suggested by Steve.
> > 
> > Changes in v2:
> >  - Remove FTRACE_WITH_REGS ftrace_graph_caller asm as suggested by Mark.
> > ---
> >  arch/arm64/include/asm/ftrace.h  |  7 +++++++
> >  arch/arm64/kernel/entry-ftrace.S | 17 -----------------
> >  arch/arm64/kernel/ftrace.c       | 17 +++++++++++++++++
> >  3 files changed, 24 insertions(+), 17 deletions(-)
> > 
> > diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h
> > index 1494cfa8639b..dbc45a4157fa 100644
> > --- a/arch/arm64/include/asm/ftrace.h
> > +++ b/arch/arm64/include/asm/ftrace.h
> > @@ -80,8 +80,15 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
> >  
> >  #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> >  struct dyn_ftrace;
> > +struct ftrace_ops;
> > +struct ftrace_regs;
> > +
> >  int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
> >  #define ftrace_init_nop ftrace_init_nop
> > +
> > +void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
> > +		       struct ftrace_ops *op, struct ftrace_regs *fregs);
> > +#define ftrace_graph_func ftrace_graph_func
> >  #endif
> >  
> >  #define ftrace_return_address(n) return_address(n)
> > diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
> > index e535480a4069..d42a205ef625 100644
> > --- a/arch/arm64/kernel/entry-ftrace.S
> > +++ b/arch/arm64/kernel/entry-ftrace.S
> > @@ -97,12 +97,6 @@ SYM_CODE_START(ftrace_common)
> >  SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
> >  	bl	ftrace_stub
> >  
> > -#ifdef CONFIG_FUNCTION_GRAPH_TRACER
> > -SYM_INNER_LABEL(ftrace_graph_call, SYM_L_GLOBAL) // ftrace_graph_caller();
> > -	nop				// If enabled, this will be replaced
> > -					// "b ftrace_graph_caller"
> > -#endif
> > -
> >  /*
> >   * At the callsite x0-x8 and x19-x30 were live. Any C code will have preserved
> >   * x19-x29 per the AAPCS, and we created frame records upon entry, so we need
> > @@ -127,17 +121,6 @@ ftrace_common_return:
> >  	ret	x9
> >  SYM_CODE_END(ftrace_common)
> >  
> > -#ifdef CONFIG_FUNCTION_GRAPH_TRACER
> > -SYM_CODE_START(ftrace_graph_caller)
> > -	ldr	x0, [sp, #S_PC]
> > -	sub	x0, x0, #AARCH64_INSN_SIZE	// ip (callsite's BL insn)
> > -	add	x1, sp, #S_LR			// parent_ip (callsite's LR)
> > -	ldr	x2, [sp, #PT_REGS_SIZE]	   	// parent fp (callsite's FP)
> > -	bl	prepare_ftrace_return
> > -	b	ftrace_common_return
> > -SYM_CODE_END(ftrace_graph_caller)
> > -#endif
> > -
> >  #else /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
> >  
> >  /*
> > diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
> > index 4506c4a90ac1..35eb7c9b5e53 100644
> > --- a/arch/arm64/kernel/ftrace.c
> > +++ b/arch/arm64/kernel/ftrace.c
> > @@ -268,6 +268,22 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
> >  }
> >  
> >  #ifdef CONFIG_DYNAMIC_FTRACE
> > +
> > +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS

Is there a case were we have DYNAMIC_FTRACE but not
DYNAMIC_FTRACE_WITH_REGS?

> > +void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
> > +		       struct ftrace_ops *op, struct ftrace_regs *fregs)
> > +{
> > +	/*
> > +	 * Athough graph_ops doesn't have FTRACE_OPS_FL_SAVE_REGS set in flags,
> > +	 * regs can't be NULL in DYNAMIC_FTRACE_WITH_REGS. By design, it should
> > +	 * be fixed when DYNAMIC_FTRACE_WITH_ARGS is implemented.
> > +	 */
> > +	struct pt_regs *regs = arch_ftrace_get_regs(fregs);
> > +	unsigned long *parent = (unsigned long *)&procedure_link_pointer(regs);
> > +
> > +	prepare_ftrace_return(ip, parent, frame_pointer(regs));
> > +}
> > +#else

You deleted ftrace_graph_caller above from entry-ftrace.S, if we can get
here with some options, wouldn't that break the build?

-- Steve


> >  /*
> >   * Turn on/off the call to ftrace_graph_caller() in ftrace_caller()
> >   * depending on @enable.
> > @@ -297,5 +313,6 @@ int ftrace_disable_ftrace_graph_caller(void)
> >  {
> >  	return ftrace_modify_graph_caller(false);
> >  }
> > +#endif /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
> >  #endif /* CONFIG_DYNAMIC_FTRACE */
> >  #endif /* CONFIG_FUNCTION_GRAPH_TRACER */  


^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
@ 2022-03-22 13:41       ` Steven Rostedt
  0 siblings, 0 replies; 20+ messages in thread
From: Steven Rostedt @ 2022-03-22 13:41 UTC (permalink / raw)
  To: Chengming Zhou
  Cc: mark.rutland, mingo, tglx, catalin.marinas, will, dave.hansen,
	broonie, x86, linux-arm-kernel, linux-kernel, songmuchun,
	qirui.001

On Tue, 22 Mar 2022 20:48:00 +0800
Chengming Zhou <zhouchengming@bytedance.com> wrote:

> Hello,
> 
> ping... have any comments?

Hi Chengming,

BTW, if you don't hear back for a week, it's OK to send a ping. You don't
need to wait a month. Usually, it's just that the maintainers have other
priorities and will try to look at it when they get a chance, but then
forget to do so :-/


> 
> Thanks.
> 
> On 2022/2/24 5:32 下午, Chengming Zhou wrote:
> > As we do in commit 0c0593b45c9b ("x86/ftrace: Make function graph
> > use ftrace directly"), we don't need special hook for graph tracer,
> > but instead we use graph_ops:func function to install return_hooker.
> > 
> > Since commit 3b23e4991fb6 ("arm64: implement ftrace with regs") add
> > implementation for FTRACE_WITH_REGS on arm64, we can easily adopt
> > the same cleanup on arm64. And this cleanup only changes the
> > FTRACE_WITH_REGS implementation, so the mcount-based implementation
> > is unaffected.
> > 
> > Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
> > ---
> > Changes in v3:
> >  - Add comments in ftrace_graph_func() as suggested by Steve.
> > 
> > Changes in v2:
> >  - Remove FTRACE_WITH_REGS ftrace_graph_caller asm as suggested by Mark.
> > ---
> >  arch/arm64/include/asm/ftrace.h  |  7 +++++++
> >  arch/arm64/kernel/entry-ftrace.S | 17 -----------------
> >  arch/arm64/kernel/ftrace.c       | 17 +++++++++++++++++
> >  3 files changed, 24 insertions(+), 17 deletions(-)
> > 
> > diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h
> > index 1494cfa8639b..dbc45a4157fa 100644
> > --- a/arch/arm64/include/asm/ftrace.h
> > +++ b/arch/arm64/include/asm/ftrace.h
> > @@ -80,8 +80,15 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
> >  
> >  #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> >  struct dyn_ftrace;
> > +struct ftrace_ops;
> > +struct ftrace_regs;
> > +
> >  int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
> >  #define ftrace_init_nop ftrace_init_nop
> > +
> > +void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
> > +		       struct ftrace_ops *op, struct ftrace_regs *fregs);
> > +#define ftrace_graph_func ftrace_graph_func
> >  #endif
> >  
> >  #define ftrace_return_address(n) return_address(n)
> > diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
> > index e535480a4069..d42a205ef625 100644
> > --- a/arch/arm64/kernel/entry-ftrace.S
> > +++ b/arch/arm64/kernel/entry-ftrace.S
> > @@ -97,12 +97,6 @@ SYM_CODE_START(ftrace_common)
> >  SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
> >  	bl	ftrace_stub
> >  
> > -#ifdef CONFIG_FUNCTION_GRAPH_TRACER
> > -SYM_INNER_LABEL(ftrace_graph_call, SYM_L_GLOBAL) // ftrace_graph_caller();
> > -	nop				// If enabled, this will be replaced
> > -					// "b ftrace_graph_caller"
> > -#endif
> > -
> >  /*
> >   * At the callsite x0-x8 and x19-x30 were live. Any C code will have preserved
> >   * x19-x29 per the AAPCS, and we created frame records upon entry, so we need
> > @@ -127,17 +121,6 @@ ftrace_common_return:
> >  	ret	x9
> >  SYM_CODE_END(ftrace_common)
> >  
> > -#ifdef CONFIG_FUNCTION_GRAPH_TRACER
> > -SYM_CODE_START(ftrace_graph_caller)
> > -	ldr	x0, [sp, #S_PC]
> > -	sub	x0, x0, #AARCH64_INSN_SIZE	// ip (callsite's BL insn)
> > -	add	x1, sp, #S_LR			// parent_ip (callsite's LR)
> > -	ldr	x2, [sp, #PT_REGS_SIZE]	   	// parent fp (callsite's FP)
> > -	bl	prepare_ftrace_return
> > -	b	ftrace_common_return
> > -SYM_CODE_END(ftrace_graph_caller)
> > -#endif
> > -
> >  #else /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
> >  
> >  /*
> > diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
> > index 4506c4a90ac1..35eb7c9b5e53 100644
> > --- a/arch/arm64/kernel/ftrace.c
> > +++ b/arch/arm64/kernel/ftrace.c
> > @@ -268,6 +268,22 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
> >  }
> >  
> >  #ifdef CONFIG_DYNAMIC_FTRACE
> > +
> > +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS

Is there a case were we have DYNAMIC_FTRACE but not
DYNAMIC_FTRACE_WITH_REGS?

> > +void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
> > +		       struct ftrace_ops *op, struct ftrace_regs *fregs)
> > +{
> > +	/*
> > +	 * Athough graph_ops doesn't have FTRACE_OPS_FL_SAVE_REGS set in flags,
> > +	 * regs can't be NULL in DYNAMIC_FTRACE_WITH_REGS. By design, it should
> > +	 * be fixed when DYNAMIC_FTRACE_WITH_ARGS is implemented.
> > +	 */
> > +	struct pt_regs *regs = arch_ftrace_get_regs(fregs);
> > +	unsigned long *parent = (unsigned long *)&procedure_link_pointer(regs);
> > +
> > +	prepare_ftrace_return(ip, parent, frame_pointer(regs));
> > +}
> > +#else

You deleted ftrace_graph_caller above from entry-ftrace.S, if we can get
here with some options, wouldn't that break the build?

-- Steve


> >  /*
> >   * Turn on/off the call to ftrace_graph_caller() in ftrace_caller()
> >   * depending on @enable.
> > @@ -297,5 +313,6 @@ int ftrace_disable_ftrace_graph_caller(void)
> >  {
> >  	return ftrace_modify_graph_caller(false);
> >  }
> > +#endif /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
> >  #endif /* CONFIG_DYNAMIC_FTRACE */
> >  #endif /* CONFIG_FUNCTION_GRAPH_TRACER */  


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [External] Re: [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
  2022-03-22 13:41       ` Steven Rostedt
@ 2022-03-22 14:14         ` Chengming Zhou
  -1 siblings, 0 replies; 20+ messages in thread
From: Chengming Zhou @ 2022-03-22 14:14 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: mark.rutland, mingo, tglx, catalin.marinas, will, dave.hansen,
	broonie, x86, linux-arm-kernel, linux-kernel, songmuchun,
	qirui.001

On 2022/3/22 9:41 下午, Steven Rostedt wrote:
> On Tue, 22 Mar 2022 20:48:00 +0800
> Chengming Zhou <zhouchengming@bytedance.com> wrote:
> 
>> Hello,
>>
>> ping... have any comments?
> 
> Hi Chengming,
> 
> BTW, if you don't hear back for a week, it's OK to send a ping. You don't
> need to wait a month. Usually, it's just that the maintainers have other
> priorities and will try to look at it when they get a chance, but then
> forget to do so :-/

Hi Steve, ok, I got it ;-)

> 
> 
>>
>> Thanks.
>>
>> On 2022/2/24 5:32 下午, Chengming Zhou wrote:
>>> As we do in commit 0c0593b45c9b ("x86/ftrace: Make function graph
>>> use ftrace directly"), we don't need special hook for graph tracer,
>>> but instead we use graph_ops:func function to install return_hooker.
>>>
>>> Since commit 3b23e4991fb6 ("arm64: implement ftrace with regs") add
>>> implementation for FTRACE_WITH_REGS on arm64, we can easily adopt
>>> the same cleanup on arm64. And this cleanup only changes the
>>> FTRACE_WITH_REGS implementation, so the mcount-based implementation
>>> is unaffected.
>>>
>>> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
>>> ---
>>> Changes in v3:
>>>  - Add comments in ftrace_graph_func() as suggested by Steve.
>>>
>>> Changes in v2:
>>>  - Remove FTRACE_WITH_REGS ftrace_graph_caller asm as suggested by Mark.
>>> ---
>>>  arch/arm64/include/asm/ftrace.h  |  7 +++++++
>>>  arch/arm64/kernel/entry-ftrace.S | 17 -----------------
>>>  arch/arm64/kernel/ftrace.c       | 17 +++++++++++++++++
>>>  3 files changed, 24 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h
>>> index 1494cfa8639b..dbc45a4157fa 100644
>>> --- a/arch/arm64/include/asm/ftrace.h
>>> +++ b/arch/arm64/include/asm/ftrace.h
>>> @@ -80,8 +80,15 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
>>>  
>>>  #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
>>>  struct dyn_ftrace;
>>> +struct ftrace_ops;
>>> +struct ftrace_regs;
>>> +
>>>  int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
>>>  #define ftrace_init_nop ftrace_init_nop
>>> +
>>> +void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
>>> +		       struct ftrace_ops *op, struct ftrace_regs *fregs);
>>> +#define ftrace_graph_func ftrace_graph_func
>>>  #endif
>>>  
>>>  #define ftrace_return_address(n) return_address(n)
>>> diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
>>> index e535480a4069..d42a205ef625 100644
>>> --- a/arch/arm64/kernel/entry-ftrace.S
>>> +++ b/arch/arm64/kernel/entry-ftrace.S
>>> @@ -97,12 +97,6 @@ SYM_CODE_START(ftrace_common)
>>>  SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
>>>  	bl	ftrace_stub
>>>  
>>> -#ifdef CONFIG_FUNCTION_GRAPH_TRACER
>>> -SYM_INNER_LABEL(ftrace_graph_call, SYM_L_GLOBAL) // ftrace_graph_caller();
>>> -	nop				// If enabled, this will be replaced
>>> -					// "b ftrace_graph_caller"
>>> -#endif
>>> -
>>>  /*
>>>   * At the callsite x0-x8 and x19-x30 were live. Any C code will have preserved
>>>   * x19-x29 per the AAPCS, and we created frame records upon entry, so we need
>>> @@ -127,17 +121,6 @@ ftrace_common_return:
>>>  	ret	x9
>>>  SYM_CODE_END(ftrace_common)
>>>  
>>> -#ifdef CONFIG_FUNCTION_GRAPH_TRACER
>>> -SYM_CODE_START(ftrace_graph_caller)
>>> -	ldr	x0, [sp, #S_PC]
>>> -	sub	x0, x0, #AARCH64_INSN_SIZE	// ip (callsite's BL insn)
>>> -	add	x1, sp, #S_LR			// parent_ip (callsite's LR)
>>> -	ldr	x2, [sp, #PT_REGS_SIZE]	   	// parent fp (callsite's FP)
>>> -	bl	prepare_ftrace_return
>>> -	b	ftrace_common_return
>>> -SYM_CODE_END(ftrace_graph_caller)
>>> -#endif
>>> -
>>>  #else /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
>>>  
>>>  /*
>>> diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
>>> index 4506c4a90ac1..35eb7c9b5e53 100644
>>> --- a/arch/arm64/kernel/ftrace.c
>>> +++ b/arch/arm64/kernel/ftrace.c
>>> @@ -268,6 +268,22 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
>>>  }
>>>  
>>>  #ifdef CONFIG_DYNAMIC_FTRACE
>>> +
>>> +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> 
> Is there a case were we have DYNAMIC_FTRACE but not
> DYNAMIC_FTRACE_WITH_REGS?

Yes, when HAVE_DYNAMIC_FTRACE_WITH_REGS is not selected because of low gcc version.

> 
>>> +void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
>>> +		       struct ftrace_ops *op, struct ftrace_regs *fregs)
>>> +{
>>> +	/*
>>> +	 * Athough graph_ops doesn't have FTRACE_OPS_FL_SAVE_REGS set in flags,
>>> +	 * regs can't be NULL in DYNAMIC_FTRACE_WITH_REGS. By design, it should
>>> +	 * be fixed when DYNAMIC_FTRACE_WITH_ARGS is implemented.
>>> +	 */
>>> +	struct pt_regs *regs = arch_ftrace_get_regs(fregs);
>>> +	unsigned long *parent = (unsigned long *)&procedure_link_pointer(regs);
>>> +
>>> +	prepare_ftrace_return(ip, parent, frame_pointer(regs));
>>> +}
>>> +#else
> 
> You deleted ftrace_graph_caller above from entry-ftrace.S, if we can get
> here with some options, wouldn't that break the build?

The above ftrace_graph_caller deleted is only for CONFIG_DYNAMIC_FTRACE_WITH_REGS,
and I tried using a low gcc version that doesn't select HAVE_DYNAMIC_FTRACE_WITH_REGS,
it can build success.

Thanks.

> 
> -- Steve
> 
> 
>>>  /*
>>>   * Turn on/off the call to ftrace_graph_caller() in ftrace_caller()
>>>   * depending on @enable.
>>> @@ -297,5 +313,6 @@ int ftrace_disable_ftrace_graph_caller(void)
>>>  {
>>>  	return ftrace_modify_graph_caller(false);
>>>  }
>>> +#endif /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
>>>  #endif /* CONFIG_DYNAMIC_FTRACE */
>>>  #endif /* CONFIG_FUNCTION_GRAPH_TRACER */  
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [External] Re: [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
@ 2022-03-22 14:14         ` Chengming Zhou
  0 siblings, 0 replies; 20+ messages in thread
From: Chengming Zhou @ 2022-03-22 14:14 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: mark.rutland, mingo, tglx, catalin.marinas, will, dave.hansen,
	broonie, x86, linux-arm-kernel, linux-kernel, songmuchun,
	qirui.001

On 2022/3/22 9:41 下午, Steven Rostedt wrote:
> On Tue, 22 Mar 2022 20:48:00 +0800
> Chengming Zhou <zhouchengming@bytedance.com> wrote:
> 
>> Hello,
>>
>> ping... have any comments?
> 
> Hi Chengming,
> 
> BTW, if you don't hear back for a week, it's OK to send a ping. You don't
> need to wait a month. Usually, it's just that the maintainers have other
> priorities and will try to look at it when they get a chance, but then
> forget to do so :-/

Hi Steve, ok, I got it ;-)

> 
> 
>>
>> Thanks.
>>
>> On 2022/2/24 5:32 下午, Chengming Zhou wrote:
>>> As we do in commit 0c0593b45c9b ("x86/ftrace: Make function graph
>>> use ftrace directly"), we don't need special hook for graph tracer,
>>> but instead we use graph_ops:func function to install return_hooker.
>>>
>>> Since commit 3b23e4991fb6 ("arm64: implement ftrace with regs") add
>>> implementation for FTRACE_WITH_REGS on arm64, we can easily adopt
>>> the same cleanup on arm64. And this cleanup only changes the
>>> FTRACE_WITH_REGS implementation, so the mcount-based implementation
>>> is unaffected.
>>>
>>> Signed-off-by: Chengming Zhou <zhouchengming@bytedance.com>
>>> ---
>>> Changes in v3:
>>>  - Add comments in ftrace_graph_func() as suggested by Steve.
>>>
>>> Changes in v2:
>>>  - Remove FTRACE_WITH_REGS ftrace_graph_caller asm as suggested by Mark.
>>> ---
>>>  arch/arm64/include/asm/ftrace.h  |  7 +++++++
>>>  arch/arm64/kernel/entry-ftrace.S | 17 -----------------
>>>  arch/arm64/kernel/ftrace.c       | 17 +++++++++++++++++
>>>  3 files changed, 24 insertions(+), 17 deletions(-)
>>>
>>> diff --git a/arch/arm64/include/asm/ftrace.h b/arch/arm64/include/asm/ftrace.h
>>> index 1494cfa8639b..dbc45a4157fa 100644
>>> --- a/arch/arm64/include/asm/ftrace.h
>>> +++ b/arch/arm64/include/asm/ftrace.h
>>> @@ -80,8 +80,15 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
>>>  
>>>  #ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
>>>  struct dyn_ftrace;
>>> +struct ftrace_ops;
>>> +struct ftrace_regs;
>>> +
>>>  int ftrace_init_nop(struct module *mod, struct dyn_ftrace *rec);
>>>  #define ftrace_init_nop ftrace_init_nop
>>> +
>>> +void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
>>> +		       struct ftrace_ops *op, struct ftrace_regs *fregs);
>>> +#define ftrace_graph_func ftrace_graph_func
>>>  #endif
>>>  
>>>  #define ftrace_return_address(n) return_address(n)
>>> diff --git a/arch/arm64/kernel/entry-ftrace.S b/arch/arm64/kernel/entry-ftrace.S
>>> index e535480a4069..d42a205ef625 100644
>>> --- a/arch/arm64/kernel/entry-ftrace.S
>>> +++ b/arch/arm64/kernel/entry-ftrace.S
>>> @@ -97,12 +97,6 @@ SYM_CODE_START(ftrace_common)
>>>  SYM_INNER_LABEL(ftrace_call, SYM_L_GLOBAL)
>>>  	bl	ftrace_stub
>>>  
>>> -#ifdef CONFIG_FUNCTION_GRAPH_TRACER
>>> -SYM_INNER_LABEL(ftrace_graph_call, SYM_L_GLOBAL) // ftrace_graph_caller();
>>> -	nop				// If enabled, this will be replaced
>>> -					// "b ftrace_graph_caller"
>>> -#endif
>>> -
>>>  /*
>>>   * At the callsite x0-x8 and x19-x30 were live. Any C code will have preserved
>>>   * x19-x29 per the AAPCS, and we created frame records upon entry, so we need
>>> @@ -127,17 +121,6 @@ ftrace_common_return:
>>>  	ret	x9
>>>  SYM_CODE_END(ftrace_common)
>>>  
>>> -#ifdef CONFIG_FUNCTION_GRAPH_TRACER
>>> -SYM_CODE_START(ftrace_graph_caller)
>>> -	ldr	x0, [sp, #S_PC]
>>> -	sub	x0, x0, #AARCH64_INSN_SIZE	// ip (callsite's BL insn)
>>> -	add	x1, sp, #S_LR			// parent_ip (callsite's LR)
>>> -	ldr	x2, [sp, #PT_REGS_SIZE]	   	// parent fp (callsite's FP)
>>> -	bl	prepare_ftrace_return
>>> -	b	ftrace_common_return
>>> -SYM_CODE_END(ftrace_graph_caller)
>>> -#endif
>>> -
>>>  #else /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
>>>  
>>>  /*
>>> diff --git a/arch/arm64/kernel/ftrace.c b/arch/arm64/kernel/ftrace.c
>>> index 4506c4a90ac1..35eb7c9b5e53 100644
>>> --- a/arch/arm64/kernel/ftrace.c
>>> +++ b/arch/arm64/kernel/ftrace.c
>>> @@ -268,6 +268,22 @@ void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
>>>  }
>>>  
>>>  #ifdef CONFIG_DYNAMIC_FTRACE
>>> +
>>> +#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
> 
> Is there a case were we have DYNAMIC_FTRACE but not
> DYNAMIC_FTRACE_WITH_REGS?

Yes, when HAVE_DYNAMIC_FTRACE_WITH_REGS is not selected because of low gcc version.

> 
>>> +void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
>>> +		       struct ftrace_ops *op, struct ftrace_regs *fregs)
>>> +{
>>> +	/*
>>> +	 * Athough graph_ops doesn't have FTRACE_OPS_FL_SAVE_REGS set in flags,
>>> +	 * regs can't be NULL in DYNAMIC_FTRACE_WITH_REGS. By design, it should
>>> +	 * be fixed when DYNAMIC_FTRACE_WITH_ARGS is implemented.
>>> +	 */
>>> +	struct pt_regs *regs = arch_ftrace_get_regs(fregs);
>>> +	unsigned long *parent = (unsigned long *)&procedure_link_pointer(regs);
>>> +
>>> +	prepare_ftrace_return(ip, parent, frame_pointer(regs));
>>> +}
>>> +#else
> 
> You deleted ftrace_graph_caller above from entry-ftrace.S, if we can get
> here with some options, wouldn't that break the build?

The above ftrace_graph_caller deleted is only for CONFIG_DYNAMIC_FTRACE_WITH_REGS,
and I tried using a low gcc version that doesn't select HAVE_DYNAMIC_FTRACE_WITH_REGS,
it can build success.

Thanks.

> 
> -- Steve
> 
> 
>>>  /*
>>>   * Turn on/off the call to ftrace_graph_caller() in ftrace_caller()
>>>   * depending on @enable.
>>> @@ -297,5 +313,6 @@ int ftrace_disable_ftrace_graph_caller(void)
>>>  {
>>>  	return ftrace_modify_graph_caller(false);
>>>  }
>>> +#endif /* CONFIG_DYNAMIC_FTRACE_WITH_REGS */
>>>  #endif /* CONFIG_DYNAMIC_FTRACE */
>>>  #endif /* CONFIG_FUNCTION_GRAPH_TRACER */  
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [External] Re: [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
  2022-03-22 14:14         ` Chengming Zhou
@ 2022-03-22 14:49           ` Steven Rostedt
  -1 siblings, 0 replies; 20+ messages in thread
From: Steven Rostedt @ 2022-03-22 14:49 UTC (permalink / raw)
  To: Chengming Zhou
  Cc: mark.rutland, mingo, tglx, catalin.marinas, will, dave.hansen,
	broonie, x86, linux-arm-kernel, linux-kernel, songmuchun,
	qirui.001

On Tue, 22 Mar 2022 22:14:11 +0800
Chengming Zhou <zhouchengming@bytedance.com> wrote:

> > You deleted ftrace_graph_caller above from entry-ftrace.S, if we can get
> > here with some options, wouldn't that break the build?  
> 
> The above ftrace_graph_caller deleted is only for CONFIG_DYNAMIC_FTRACE_WITH_REGS,
> and I tried using a low gcc version that doesn't select HAVE_DYNAMIC_FTRACE_WITH_REGS,
> it can build success.

OK, I didn't look too deep into this.

I don't have an issue with this patch, but it needs to go through the arm64
tree.

-- Steve

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [External] Re: [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
@ 2022-03-22 14:49           ` Steven Rostedt
  0 siblings, 0 replies; 20+ messages in thread
From: Steven Rostedt @ 2022-03-22 14:49 UTC (permalink / raw)
  To: Chengming Zhou
  Cc: mark.rutland, mingo, tglx, catalin.marinas, will, dave.hansen,
	broonie, x86, linux-arm-kernel, linux-kernel, songmuchun,
	qirui.001

On Tue, 22 Mar 2022 22:14:11 +0800
Chengming Zhou <zhouchengming@bytedance.com> wrote:

> > You deleted ftrace_graph_caller above from entry-ftrace.S, if we can get
> > here with some options, wouldn't that break the build?  
> 
> The above ftrace_graph_caller deleted is only for CONFIG_DYNAMIC_FTRACE_WITH_REGS,
> and I tried using a low gcc version that doesn't select HAVE_DYNAMIC_FTRACE_WITH_REGS,
> it can build success.

OK, I didn't look too deep into this.

I don't have an issue with this patch, but it needs to go through the arm64
tree.

-- Steve

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [External] Re: [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
  2022-03-22 14:49           ` Steven Rostedt
@ 2022-04-07  2:26             ` Chengming Zhou
  -1 siblings, 0 replies; 20+ messages in thread
From: Chengming Zhou @ 2022-04-07  2:26 UTC (permalink / raw)
  To: mark.rutland
  Cc: Steven Rostedt, mingo, tglx, catalin.marinas, will, dave.hansen,
	broonie, x86, linux-arm-kernel, linux-kernel, songmuchun,
	qirui.001

On 2022/3/22 22:49, Steven Rostedt wrote:
> On Tue, 22 Mar 2022 22:14:11 +0800
> Chengming Zhou <zhouchengming@bytedance.com> wrote:
> 
>>> You deleted ftrace_graph_caller above from entry-ftrace.S, if we can get
>>> here with some options, wouldn't that break the build?  
>>
>> The above ftrace_graph_caller deleted is only for CONFIG_DYNAMIC_FTRACE_WITH_REGS,
>> and I tried using a low gcc version that doesn't select HAVE_DYNAMIC_FTRACE_WITH_REGS,
>> it can build success.
> 
> OK, I didn't look too deep into this.
> 
> I don't have an issue with this patch, but it needs to go through the arm64
> tree.

Hi Mark, would you mind picking this up for arm64 tree?

Thanks.

> 
> -- Steve

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [External] Re: [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
@ 2022-04-07  2:26             ` Chengming Zhou
  0 siblings, 0 replies; 20+ messages in thread
From: Chengming Zhou @ 2022-04-07  2:26 UTC (permalink / raw)
  To: mark.rutland
  Cc: Steven Rostedt, mingo, tglx, catalin.marinas, will, dave.hansen,
	broonie, x86, linux-arm-kernel, linux-kernel, songmuchun,
	qirui.001

On 2022/3/22 22:49, Steven Rostedt wrote:
> On Tue, 22 Mar 2022 22:14:11 +0800
> Chengming Zhou <zhouchengming@bytedance.com> wrote:
> 
>>> You deleted ftrace_graph_caller above from entry-ftrace.S, if we can get
>>> here with some options, wouldn't that break the build?  
>>
>> The above ftrace_graph_caller deleted is only for CONFIG_DYNAMIC_FTRACE_WITH_REGS,
>> and I tried using a low gcc version that doesn't select HAVE_DYNAMIC_FTRACE_WITH_REGS,
>> it can build success.
> 
> OK, I didn't look too deep into this.
> 
> I don't have an issue with this patch, but it needs to go through the arm64
> tree.

Hi Mark, would you mind picking this up for arm64 tree?

Thanks.

> 
> -- Steve

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [External] Re: [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
  2022-04-07  2:26             ` Chengming Zhou
@ 2022-04-07  8:58               ` Mark Brown
  -1 siblings, 0 replies; 20+ messages in thread
From: Mark Brown @ 2022-04-07  8:58 UTC (permalink / raw)
  To: Chengming Zhou
  Cc: mark.rutland, Steven Rostedt, mingo, tglx, catalin.marinas, will,
	dave.hansen, x86, linux-arm-kernel, linux-kernel, songmuchun,
	qirui.001

[-- Attachment #1: Type: text/plain, Size: 447 bytes --]

On Thu, Apr 07, 2022 at 10:26:53AM +0800, Chengming Zhou wrote:
> On 2022/3/22 22:49, Steven Rostedt wrote:

> > I don't have an issue with this patch, but it needs to go through the arm64
> > tree.

> Hi Mark, would you mind picking this up for arm64 tree?

[Different Mark here...]
It's Catalin and Will who pick things up for the arm64 tree, AFAICT this
was sent before -rc1 so you'll probably need to resend it to make sure
it gets picked up.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [External] Re: [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
@ 2022-04-07  8:58               ` Mark Brown
  0 siblings, 0 replies; 20+ messages in thread
From: Mark Brown @ 2022-04-07  8:58 UTC (permalink / raw)
  To: Chengming Zhou
  Cc: mark.rutland, Steven Rostedt, mingo, tglx, catalin.marinas, will,
	dave.hansen, x86, linux-arm-kernel, linux-kernel, songmuchun,
	qirui.001


[-- Attachment #1.1: Type: text/plain, Size: 447 bytes --]

On Thu, Apr 07, 2022 at 10:26:53AM +0800, Chengming Zhou wrote:
> On 2022/3/22 22:49, Steven Rostedt wrote:

> > I don't have an issue with this patch, but it needs to go through the arm64
> > tree.

> Hi Mark, would you mind picking this up for arm64 tree?

[Different Mark here...]
It's Catalin and Will who pick things up for the arm64 tree, AFAICT this
was sent before -rc1 so you'll probably need to resend it to make sure
it gets picked up.

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [External] Re: [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
  2022-04-07  8:58               ` Mark Brown
@ 2022-04-07 12:39                 ` Chengming Zhou
  -1 siblings, 0 replies; 20+ messages in thread
From: Chengming Zhou @ 2022-04-07 12:39 UTC (permalink / raw)
  To: Mark Brown
  Cc: mark.rutland, Steven Rostedt, mingo, tglx, catalin.marinas, will,
	dave.hansen, x86, linux-arm-kernel, linux-kernel, songmuchun,
	qirui.001

On 2022/4/7 16:58, Mark Brown wrote:
> On Thu, Apr 07, 2022 at 10:26:53AM +0800, Chengming Zhou wrote:
>> On 2022/3/22 22:49, Steven Rostedt wrote:
> 
>>> I don't have an issue with this patch, but it needs to go through the arm64
>>> tree.
> 
>> Hi Mark, would you mind picking this up for arm64 tree?
> 
> [Different Mark here...]
> It's Catalin and Will who pick things up for the arm64 tree, AFAICT this
> was sent before -rc1 so you'll probably need to resend it to make sure
> it gets picked up.

Ok, I will resend it. Thanks for reminding.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* Re: [External] Re: [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly
@ 2022-04-07 12:39                 ` Chengming Zhou
  0 siblings, 0 replies; 20+ messages in thread
From: Chengming Zhou @ 2022-04-07 12:39 UTC (permalink / raw)
  To: Mark Brown
  Cc: mark.rutland, Steven Rostedt, mingo, tglx, catalin.marinas, will,
	dave.hansen, x86, linux-arm-kernel, linux-kernel, songmuchun,
	qirui.001

On 2022/4/7 16:58, Mark Brown wrote:
> On Thu, Apr 07, 2022 at 10:26:53AM +0800, Chengming Zhou wrote:
>> On 2022/3/22 22:49, Steven Rostedt wrote:
> 
>>> I don't have an issue with this patch, but it needs to go through the arm64
>>> tree.
> 
>> Hi Mark, would you mind picking this up for arm64 tree?
> 
> [Different Mark here...]
> It's Catalin and Will who pick things up for the arm64 tree, AFAICT this
> was sent before -rc1 so you'll probably need to resend it to make sure
> it gets picked up.

Ok, I will resend it. Thanks for reminding.

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2022-04-07 12:41 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-24  9:32 [PATCH v3 1/3] ftrace: cleanup ftrace_graph_caller enable and disable Chengming Zhou
2022-02-24  9:32 ` Chengming Zhou
2022-02-24  9:32 ` [PATCH v3 2/3] x86/ftrace: cleanup graph tracer Chengming Zhou
2022-02-24  9:32   ` Chengming Zhou
2022-02-24  9:32 ` [PATCH v3 3/3] arm64/ftrace: Make function graph use ftrace directly Chengming Zhou
2022-02-24  9:32   ` Chengming Zhou
2022-03-22 12:48   ` Chengming Zhou
2022-03-22 12:48     ` Chengming Zhou
2022-03-22 13:41     ` Steven Rostedt
2022-03-22 13:41       ` Steven Rostedt
2022-03-22 14:14       ` [External] " Chengming Zhou
2022-03-22 14:14         ` Chengming Zhou
2022-03-22 14:49         ` Steven Rostedt
2022-03-22 14:49           ` Steven Rostedt
2022-04-07  2:26           ` Chengming Zhou
2022-04-07  2:26             ` Chengming Zhou
2022-04-07  8:58             ` Mark Brown
2022-04-07  8:58               ` Mark Brown
2022-04-07 12:39               ` Chengming Zhou
2022-04-07 12:39                 ` Chengming Zhou

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.