Wu Zhangjin wrote:
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 <email@example.com>
Signed-off-by: Wu Zhangjin <firstname.lastname@example.org>
arch/mips/kernel/ftrace.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/arch/mips/kernel/ftrace.c b/arch/mips/kernel/ftrace.c
index bc91e4a..be3fa7a 100644
@@ -304,7 +304,14 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr,
unsigned long self_ra,
- trace.func = self_ra;
+ * Get the recorded ip of the current mcount calling site in the
+ * __mcount_loc section, which will be used to filter the function
+ * entries configured through the tracing/set_graph_function interface.
+ insns = (in_kernel_space(self_ra)) ? 2 : MCOUNT_OFFSET_INSNS + 1;
You're still keeping the parens around the function call. Why? :-)