aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips
diff options
context:
space:
mode:
authorWu Zhangjin <wuzhangjin@gmail.com>2011-01-21 13:01:53 -0500
committerRalf Baechle <ralf@linux-mips.org>2011-03-14 16:07:24 -0400
commitb9f07eb2f25a64098e2ba223c1a2fe2a8f249e01 (patch)
tree1b52def8282e9faa067acb9fc360cbc10ff03fc1 /arch/mips
parent7f21a60968221eabad5c53fe760db3d094994011 (diff)
MIPS, Tracing: Fix set_graph_function of function graph tracer
trace.func should be set to the recorded ip of the mcount calling site in the __mcount_loc section to filter the function entries configured through the tracing/set_graph_function interface, but before, this is set to the self_ra(the return address of mcount), which has made set_graph_function not work as expected. This fixes it via calculating the right recorded ip in the __mcount_loc section and assign it to trace.func. Reported-by: Zhiping Zhong <xzhong86@163.com> Signed-off-by: Wu Zhangjin <wuzhangjin@gmail.com> Cc: Steven Rostedt <srostedt@redhat.com> Cc: Sergei Shtylyov <sshtylyov@mvista.com> Cc: linux-mips@linux-mips.org Patchwork: https://patchwork.linux-mips.org/patch/2017/ Signed-off-by: Ralf Baechle <ralf@duck.linux-mips.net>
Diffstat (limited to 'arch/mips')
-rw-r--r--arch/mips/kernel/ftrace.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index bc91e4aa08e9..94ca2b018af7 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
@@ -257,7 +257,7 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra,
257 struct ftrace_graph_ent trace; 257 struct ftrace_graph_ent trace;
258 unsigned long return_hooker = (unsigned long) 258 unsigned long return_hooker = (unsigned long)
259 &return_to_handler; 259 &return_to_handler;
260 int faulted; 260 int faulted, insns;
261 261
262 if (unlikely(atomic_read(&current->tracing_graph_pause))) 262 if (unlikely(atomic_read(&current->tracing_graph_pause)))
263 return; 263 return;
@@ -304,7 +304,14 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, unsigned long self_ra,
304 return; 304 return;
305 } 305 }
306 306
307 trace.func = self_ra; 307 /*
308 * Get the recorded ip of the current mcount calling site in the
309 * __mcount_loc section, which will be used to filter the function
310 * entries configured through the tracing/set_graph_function interface.
311 */
312
313 insns = in_kernel_space(self_ra) ? 2 : MCOUNT_OFFSET_INSNS + 1;
314 trace.func = self_ra - (MCOUNT_INSN_SIZE * insns);
308 315
309 /* Only trace if the calling function expects to */ 316 /* Only trace if the calling function expects to */
310 if (!ftrace_graph_entry(&trace)) { 317 if (!ftrace_graph_entry(&trace)) {