lkml.org 
[lkml]   [2008]   [Oct]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC][PATCH] Make ftrace able to trace function return

* Frédéric Weisbecker <fweisbec@gmail.com> wrote:

> 2008/10/30 Ingo Molnar <mingo@elte.hu>:
> > hm, are you aware of the -finstrument-functions feature of GCC?
> >
> > that feature generates such entry points at build time:
> >
> > void __cyg_profile_func_enter (void *this_fn,
> > void *call_site);
> > void __cyg_profile_func_exit (void *this_fn,
> > void *call_site);
>
> Oh I didn't know it.
> But wouldn't it conflict with the -pg used for mcount in ftrace?

i dont think the two can be enabled at once. If then it would replace
the mcount stuff. (but the principle is very similar)

I'm wondering whether it's worth it though.

> > this might be faster/cleaner than using a trampoline approach IMO.
>
> Yes, oubviously!
>
> > OTOH, entry+exit profiling has about double the cost of just entry
> > profiling - so maybe there should be some runtime flexibility there.
> > Plus the same recordmcount trick should be used to patch up these
> > entry points to NOP by default.
>
> Yes that's right. Hm I don't know what to do since there is already
> mcount....

just dont use -pg, only use -finstrument-functions.

when i wrote my first mcount tracer many eons ago i knew about
-finstrument-functions and decided against it based on the fact that
it doubles the cost of profiling.

OTOH, dyn-ftrace changes the picture dramatically, with its NOP
insertion and opt-in tricks. Still, one more 5-byte NOP in every
function is still something not to be done lightly.

In that sense your mcount enhancement is better, as it does not
increase the default (single NOP) cost. It can also be
enabled/disabled dynamically in addition to the 'half-way profiling'
mcount solution we have today. So i like it at first sight - if it can
be made stable ;-)

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

\
 
 \ /
  Last update: 2008-10-30 19:39    [from the cache]
©2003-2011 Jasper Spaans