Skip to contentSkip to conversation

ftrace/x86: Fix missing ops arg on static function tracing

PATCH In review Namhyung Kim 2 participants 5 messages Nov 14, 2015 – Nov 16, 2015 x86

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ftrace/x86: Fix missing ops arg on static function tracing

The commit f1ab00af816e ("ftrace/x86: Get rid of ftrace_caller_setup") moved code that loads ftrace_ops into 3rd parameter but it missed to do for static tracing.

---
 arch/x86/kernel/mcount_64.S | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/mcount_64.S +3 -0
index 94ea120fa21f..6c1ccf9e5427 100644
@@ -278,6 +278,9 @@ trace:
 	/* save_mcount_regs fills in first two parameters */
 	save_mcount_regs
 
+	/* Load the ftrace_ops into the 3rd parameter */
+	movq function_trace_op(%rip), %rdx
+
 	call   *ftrace_trace_function
 
 	restore_mcount_regs
Signature · 1 line
2.6.2
#1 lore raw
Quoted 14 lines · On Sat, 14 Nov 2015 18:32:28 +0900 Namhyung Kim <[email protected]> wrote:

The commit f1ab00af816e ("ftrace/x86: Get rid of ftrace_caller_setup") moved code that loads ftrace_ops into 3rd parameter but it missed to do for static tracing.

---
 arch/x86/kernel/mcount_64.S | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/mcount_64.S +0 -0
index 94ea120fa21f..6c1ccf9e5427 100644

arch/x86/kernel/mcount_64.S trace: · line 284

Quoted 7 lines
arch/x86/kernel/mcount_64.S +3 -0
@@ -278,6 +278,9 @@ trace:
 	/* save_mcount_regs fills in first two parameters */
 	save_mcount_regs
 
+	/* Load the ftrace_ops into the 3rd parameter */
+	movq function_trace_op(%rip), %rdx
+
 	call   *ftrace_trace_function

This isn't needed, nor will the parameter be used if added. A comment should probably be added here instead.

/*
* When DYNAMIC_FTRACE is not defined, ARCH_SUPPORTS_FTRACE_OPS is not
* set (see include/asm/ftrace.h). Only the ip and parent ip are used
* and the list function is called when function tracing is enabled. */

-- Steve

Quoted 2 lines
arch/x86/kernel/mcount_64.S +0 -0
 	restore_mcount_regs
#2 lore raw
Quoted 6 lines · On Mon, 16 Nov 2015 10:54:53 -0500 Steven Rostedt <[email protected]> wrote:

/*
* When DYNAMIC_FTRACE is not defined, ARCH_SUPPORTS_FTRACE_OPS is not
* set (see include/asm/ftrace.h). Only the ip and parent ip are used
* and the list function is called when function tracing is enabled. */

Namhyung, if you want to send a patch that adds this comment feel free to do so.

-- Steve

#3 lore raw
In reply to Steven Rostedt
Quoted 6 lines · On Mon, 16 Nov 2015 10:54:53 -0500 Steven Rostedt <[email protected]> wrote:

This isn't needed, nor will the parameter be used if added. A comment should probably be added here instead.

/*
* When DYNAMIC_FTRACE is not defined, ARCH_SUPPORTS_FTRACE_OPS is not
* set (see include/asm/ftrace.h). Only the ip and parent ip are used

Probably should also add "and include/linux/ftrace.h" as that's where the ARCH_SUPPORTS_FTRACE_OPS is described.

-- Steve

Quoted 3 lines

* and the list function is called when function tracing is enabled. */

#4 lore raw
In reply to Steven Rostedt

Hi Steve,

Quoted 28 lines · Steven Rostedt
Quoted 14 lines · On Sat, 14 Nov 2015 18:32:28 +0900 Namhyung Kim <[email protected]> wrote:

The commit f1ab00af816e ("ftrace/x86: Get rid of ftrace_caller_setup") moved code that loads ftrace_ops into 3rd parameter but it missed to do for static tracing.

---
 arch/x86/kernel/mcount_64.S | 3 +++
 1 file changed, 3 insertions(+)
arch/x86/kernel/mcount_64.S +0 -0
index 94ea120fa21f..6c1ccf9e5427 100644

arch/x86/kernel/mcount_64.S trace: · line 284

Quoted 7 lines
arch/x86/kernel/mcount_64.S +3 -0
@@ -278,6 +278,9 @@ trace:
 	/* save_mcount_regs fills in first two parameters */
 	save_mcount_regs
 
+	/* Load the ftrace_ops into the 3rd parameter */
+	movq function_trace_op(%rip), %rdx
+
 	call   *ftrace_trace_function

This isn't needed, nor will the parameter be used if added. A comment should probably be added here instead.

Quoted 5 lines

/*
* When DYNAMIC_FTRACE is not defined, ARCH_SUPPORTS_FTRACE_OPS is not
* set (see include/asm/ftrace.h). Only the ip and parent ip are used
* and the list function is called when function tracing is enabled. */

Ah, ok.

I sent this patch during reading update_ftrace_function(). I was wondering why function_trace_op is set but not passed to the trace function. It seems that the ops is not needed for x86 but s390 still needs it regardless of DYNAMIC_FTRACE.

I'll send a patch with the above comment.

Thanks,
Namhyung