aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2014-11-24 21:00:34 -0500
committerSteven Rostedt <rostedt@goodmis.org>2014-12-01 14:08:58 -0500
commit6a06bdbf7f9c669743f58084991ba280f2925586 (patch)
tree90dcca551768f0056ba993622062c7458eef4834
parentf1ab00af816ec8e1ad53229963c863fdd6bcf222 (diff)
ftrace/fgraph/x86: Have prepare_ftrace_return() take ip as first parameter
The function graph helper function prepare_ftrace_return() which does the work to hijack the parent pointer has that parent pointer as its first parameter. Instead, if we make it the second parameter and have ip as the first parameter (self_addr), then it can use the %rdi from save_mcount_regs that loads it already. Link: http://lkml.kernel.org/r/alpine.DEB.2.11.1411262304010.3961@nanos Reviewed-by: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
-rw-r--r--arch/x86/kernel/ftrace.c4
-rw-r--r--arch/x86/kernel/mcount_64.S11
2 files changed, 6 insertions, 9 deletions
diff --git a/arch/x86/kernel/ftrace.c b/arch/x86/kernel/ftrace.c
index 60881d919432..2142376dc8c6 100644
--- a/arch/x86/kernel/ftrace.c
+++ b/arch/x86/kernel/ftrace.c
@@ -871,7 +871,7 @@ static void *addr_from_call(void *ptr)
871 return ptr + MCOUNT_INSN_SIZE + calc.offset; 871 return ptr + MCOUNT_INSN_SIZE + calc.offset;
872} 872}
873 873
874void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, 874void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
875 unsigned long frame_pointer); 875 unsigned long frame_pointer);
876 876
877/* 877/*
@@ -964,7 +964,7 @@ int ftrace_disable_ftrace_graph_caller(void)
964 * Hook the return address and push it in the stack of return addrs 964 * Hook the return address and push it in the stack of return addrs
965 * in current thread info. 965 * in current thread info.
966 */ 966 */
967void prepare_ftrace_return(unsigned long *parent, unsigned long self_addr, 967void prepare_ftrace_return(unsigned long self_addr, unsigned long *parent,
968 unsigned long frame_pointer) 968 unsigned long frame_pointer)
969{ 969{
970 unsigned long old; 970 unsigned long old;
diff --git a/arch/x86/kernel/mcount_64.S b/arch/x86/kernel/mcount_64.S
index ddc766efa1f1..94ea120fa21f 100644
--- a/arch/x86/kernel/mcount_64.S
+++ b/arch/x86/kernel/mcount_64.S
@@ -124,7 +124,7 @@
124 /* 124 /*
125 * Now %rdi (the first parameter) has the return address of 125 * Now %rdi (the first parameter) has the return address of
126 * where ftrace_call returns. But the callbacks expect the 126 * where ftrace_call returns. But the callbacks expect the
127 * the address of the call itself. 127 * address of the call itself.
128 */ 128 */
129 subq $MCOUNT_INSN_SIZE, %rdi 129 subq $MCOUNT_INSN_SIZE, %rdi
130 .endm 130 .endm
@@ -289,21 +289,18 @@ END(function_hook)
289 289
290#ifdef CONFIG_FUNCTION_GRAPH_TRACER 290#ifdef CONFIG_FUNCTION_GRAPH_TRACER
291ENTRY(ftrace_graph_caller) 291ENTRY(ftrace_graph_caller)
292 /* Saves rbp into %rdx */ 292 /* Saves rbp into %rdx and fills first parameter */
293 save_mcount_regs 293 save_mcount_regs
294 294
295#ifdef CC_USING_FENTRY 295#ifdef CC_USING_FENTRY
296 leaq MCOUNT_REG_SIZE+8(%rsp), %rdi 296 leaq MCOUNT_REG_SIZE+8(%rsp), %rsi
297 movq $0, %rdx /* No framepointers needed */ 297 movq $0, %rdx /* No framepointers needed */
298#else 298#else
299 /* Save address of the return address of traced function */ 299 /* Save address of the return address of traced function */
300 leaq 8(%rdx), %rdi 300 leaq 8(%rdx), %rsi
301 /* ftrace does sanity checks against frame pointers */ 301 /* ftrace does sanity checks against frame pointers */
302 movq (%rdx), %rdx 302 movq (%rdx), %rdx
303#endif 303#endif
304 movq RIP(%rsp), %rsi
305 subq $MCOUNT_INSN_SIZE, %rsi
306
307 call prepare_ftrace_return 304 call prepare_ftrace_return
308 305
309 restore_mcount_regs 306 restore_mcount_regs