Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: David Daney <ddaney.cavm@gmail.com>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: linux-mips@linux-mips.org, ralf@linux-mips.org,
	Corey Minyard <cminyard@mvista.com>,
	David Daney <david.daney@cavium.com>
Subject: Re: [PATCH] mips/ftrace: Fix function tracing return address to match
Date: Thu, 18 Jul 2013 13:14:52 -0700	[thread overview]
Message-ID: <51E84CBC.80206@gmail.com> (raw)
In-Reply-To: <1374178262.6458.266.camel@gandalf.local.home>

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 <cminyard@mvista.com>
>>
>> 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 <cminyard@mvista.com>
>> [david.daney@cavium.com: Adjusted code comment and patch Subject.]
>> Signed-off-by: David Daney <david.daney@cavium.com>
>> ---
>>   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:
>>   	PTR_S	MCOUNT_RA_ADDRESS_REG, PT_R12(sp)
>>   #endif
>>
>> -	move	a0, ra		/* arg1: self return address */
>> +	PTR_SUBU a0, ra, 8	/* arg1: self address */
>>   	.globl ftrace_call
>>   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
>
>
>
>

  reply	other threads:[~2013-07-18 20:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-07-15 22:17 [PATCH] mips/ftrace: Fix function tracing return address to match David Daney
2013-07-18 20:11 ` Steven Rostedt
2013-07-18 20:14   ` David Daney [this message]
2013-07-18 20:26     ` Steven Rostedt
2013-07-18 20:27       ` Steven Rostedt
2013-07-18 20:37       ` David Daney
2013-07-18 20:37         ` David Daney
2013-07-19  0:24   ` Corey Minyard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51E84CBC.80206@gmail.com \
    --to=ddaney.cavm@gmail.com \
    --cc=cminyard@mvista.com \
    --cc=david.daney@cavium.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.org \
    --cc=rostedt@goodmis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox