Re: [PATCH V2] mips: function tracer: Fix broken function tracing

From: Steven Rostedt
Date: Thu Jan 17 2013 - 10:35:33 EST


On Thu, 2013-01-17 at 09:58 -0500, Alan Cooper wrote:
> When the kernel first boots we have to be able to handle the gcc
> generated jalr, addui sequence until ftrace_init gets a chance to run
> and change the sequence. At this point mcount just adjusts the stack
> and returns. When ftrace_init runs, we convert the jalr/addui to nops.
> Then whenever tracing is enabled we convert the first nop to a "jalr
> mcount+8". The mcount+8 entry point skips the stack adjust.
>

I was confused by that too.

>
> On Thu, Jan 17, 2013 at 1:27 AM, Geert Uytterhoeven

> >
> >> @@ -69,7 +68,7 @@ NESTED(ftrace_caller, PT_SIZE, ra)
> >> .globl _mcount
> >> _mcount:
> >> b ftrace_stub
> >> - nop
> >> + addiu sp,sp,8

Can you add a comment here:

/* When tracing is activated, it calls ftrace_caller+8 (aka here) */

> >> lw t1, function_trace_stop
> >> bnez t1, ftrace_stub
> >> nop
> >

-- Steve


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/