linux-mips
[Top] [All Lists]

Re: [PATCH 5/5] tracing, MIPS: Fix set_graph_function of function graph

To: Wu Zhangjin <wuzhangjin@gmail.com>
Subject: Re: [PATCH 5/5] tracing, MIPS: Fix set_graph_function of function graph tracer
From: Sergei Shtylyov <sshtylyov@mvista.com>
Date: Thu, 20 Jan 2011 14:03:19 +0300
Cc: Ralf Baechle <ralf@linux-mips.org>, Steven Rostedt <srostedt@redhat.com>, linux-mips@linux-mips.org
In-reply-to: <9967898043e58db7b311d35695e9422e67cef5f6.1295464855.git.wuzhangjin@gmail.com>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <cover.1295464855.git.wuzhangjin@gmail.com> <9967898043e58db7b311d35695e9422e67cef5f6.1295464855.git.wuzhangjin@gmail.com>
Sender: linux-mips-bounce@linux-mips.org
User-agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.13) Gecko/20101207 Thunderbird/3.1.7
Hello.

On 19-01-2011 22:28, 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 expects.

   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>
---
  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..62775d7 100644
--- a/arch/mips/kernel/ftrace.c
+++ b/arch/mips/kernel/ftrace.c
[...]
@@ -304,7 +304,14 @@ void prepare_ftrace_return(unsigned long *parent_ra_addr, 
unsigned long self_ra,
                return;
        }

-       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);

   Unneeded parens.

+       trace.func = self_ra - (MCOUNT_INSN_SIZE * insns);

   Here too.

WBR, Sergei

<Prev in Thread] Current Thread [Next in Thread>