[Top] [All Lists]

Re: [PATCH] mips/ftrace: Fix function tracing return address to match

To: Steven Rostedt <>
Subject: Re: [PATCH] mips/ftrace: Fix function tracing return address to match
From: David Daney <>
Date: Thu, 18 Jul 2013 13:14:52 -0700
Cc:,, Corey Minyard <>, David Daney <>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=BmHSSlmo4ZjUU+u+rhu7BkmaxwK97h2RJFRi0gVkr3Y=; b=emR7u2cIvUJR2EF5qraTcrqda3HZ+PNymjmxxYXnsRVip+5jbtJ/TY1P//W4vpRhh0 Qz5Vm9u+jHB/OQ/VN6mf5rkX+eTf+SmDIph2cwKeyE5SzPyqkila953Rj6PmorzM0jzh g5/lE1wEsNgMjlGkze0tgXRbEk4HJQZGTzCzHt4dAJbn1ykcoyTVf0kujm3u0kmzE2ox mSrcoE+2bWySZOyN5VkBJI+RjOQj4PT7TCWrc9Fss3hpEht6qrCPgc0CSbW60aWz0muQ MOxl9k6XEKsLQ6vBP3jbyvcyYaxM8M7qXDOb43LSk9otQgSFODqLCjVyYVsyZKZ9ti7U MIiw==
In-reply-to: <1374178262.6458.266.camel@gandalf.local.home>
List-archive: <>
List-help: <>
List-id: linux-mips <>
List-owner: <>
List-post: <>
List-software: Ecartis version 1.0.0
List-subscribe: <>
List-unsubscribe: <>
Original-recipient: rfc822;
References: <> <1374178262.6458.266.camel@gandalf.local.home>
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130514 Thunderbird/17.0.6
On 07/18/2013 01:11 PM, Steven Rostedt wrote:
On Mon, 2013-07-15 at 15:17 -0700, David Daney wrote:
From: Corey Minyard <>

Dynamic function tracing was not working on MIPS.  When doing dynamic
tracing, the tracer attempts to match up the passed in address with
the one the compiler creates in the mcount tables.  The MIPS code was
passing in the return address from the tracing function call, but the
compiler tables were the address of the function call.  So they
wouldn't match.

Just subtracting 8 from the return address will give the address of
the function call.  Easy enough.

Signed-off-by: Corey Minyard <>
[ Adjusted code comment and patch Subject.]
Signed-off-by: David Daney <>
  arch/mips/kernel/mcount.S | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/mips/kernel/mcount.S b/arch/mips/kernel/mcount.S
index a03e93c..539b629 100644
--- a/arch/mips/kernel/mcount.S
+++ b/arch/mips/kernel/mcount.S
@@ -83,7 +83,7 @@ _mcount:

-       move    a0, ra          /* arg1: self return address */
+       PTR_SUBU a0, ra, 8      /* arg1: self address */
        .globl ftrace_call
        nop     /* a placeholder for the call to a real tracing function */

I applied this patch to my Yeeloong Lemote laptop and it causes the
system to crash. Not sure why. I'll try to investigate.

There is an mcount ABI difference based on which GCC version you are using, although I wouldn't think it would effect this bit.

We are using GCC-4.7 FWIW.

David Daney

-- Steve

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