Re: [PATCH 2/2] ftrace: support for PowerPC

!MAILaRCHIVE_VOTE_RePLACE
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
To: Michael Ellerman <michael@...>
Cc: Ingo Molnar <mingo@...>, <proski@...>, <a.p.zijlstra@...>, <pq@...>, <linux-kernel@...>, Steven Rostedt <srostedt@...>, <linuxppc-dev@...>, <sandmann@...>, <paulus@...>
Date: Tuesday, May 20, 2008 - 10:32 am

On Wed, 21 May 2008, Michael Ellerman wrote:


Hi Michael,

I really appreciate this. It's been a few years since I did any real PPC
programming, so any comments are most definitely welcome.



The -pg flag makes calls to the mcount code. I didn't look too deeply, but
at least in my first prototypes the early boot up code would crash when
calling mcount. I found that simply keeping them from calling mcount made
things OK. Perhaps I'm just hiding the problem, but the tracing wont
happen anyway that early. We need to set up memory before tracing starts.


Ouch! Thanks, that's leftover from debugging.


I tried hard to make most of the complex logic stay in generic code.

What dynamic ftrace does is at start up the code is simply a nop. Then
after initialization of ftrace, it calls kstop-machine that will call into
the arch code to convert the nop to a call to a "record_ip" function.
That record_ip function will start recording the return address of the
mcount function (__builtin_return_address(0)).

Then later, once a second the ftraced wakes up and checks if any new
functions have been recorded. If they have been, then it calls
kstop_machine againg and for each recorded function, it passes in the
address that was recorded.

The arch is responsible for knowning how to translate the
__builtin_return_address(0) into the address of the location of the call,
to be able to modify that code.

On boot up, all functions call "mcount". The ftraced daemon will convert
those calls to nop, and when tracing is enabled, then they will be
converted to point directly to the tracing function.

This helps tremondously in making ftrace efficient.


Thanks for the update. I guess I miss read the documents I have.


Also good to know. I'll look into replacing them with these.


Ah, thanks. I'll wait till I see a PPC_LONG_ALIGN ;-)



Yeah, that was taken from what x86 does.


Actually, I think Ingo added this into the generic code. I'll see what's
in there now.


Ditto too ;-)


Thanks a lot for you feedback!

-- Steve

--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
[PATCH 2/2] ftrace: support for PowerPC, Steven Rostedt, (Wed May 14, 11:49 pm)
Re: [PATCH 2/2] ftrace: support for PowerPC, Michael Ellerman, (Tue May 20, 10:04 am)
[PATCH] ftrace: powerpc clean ups, Steven Rostedt, (Thu May 22, 2:31 pm)
Re: [PATCH] ftrace: powerpc clean ups, Michael Ellerman, (Sun Jun 1, 10:15 pm)
Re: [PATCH] ftrace: powerpc clean ups, Thomas Gleixner, (Tue May 27, 11:36 am)
Re: [PATCH 2/2] ftrace: support for PowerPC, Steven Rostedt, (Tue May 20, 10:32 am)
Re: [PATCH 2/2] ftrace: support for PowerPC, Benjamin Herrenschmidt, (Tue May 20, 10:17 am)
Re: [PATCH 2/2] ftrace: support for PowerPC, Steven Rostedt, (Tue May 20, 10:51 am)
Re: [PATCH 2/2] ftrace: support for PowerPC, Ingo Molnar, (Fri May 16, 8:06 am)
Re: [PATCH 2/2] ftrace: support for PowerPC, David Miller, (Thu May 15, 1:28 am)
Re: [PATCH 2/2] ftrace: support for PowerPC, Scott Wood, (Thu May 15, 12:48 pm)
Re: [PATCH 2/2] ftrace: support for PowerPC, Steven Rostedt, (Thu May 15, 9:38 am)