Re: RFC: How to handle function tracing, frame pointers and-mfentry?

From: Sam Ravnborg
Date: Fri Apr 27 2012 - 16:27:02 EST


On Fri, Apr 27, 2012 at 02:46:39PM -0400, Steven Rostedt wrote:
> I have code that implements -mfentry for the function tracer.
>
> For those that are unfamiliar with this, it was introduced into gcc in
> 4.6.0 for x86 only. Used with the -pg option, it replaces mcount with
> fentry, and is placed at the first instruction of a function (instead of
> after the frame has been built, as mcount does).
>
> So what's my problem? With -mfentry, function tracer does not depend on
> frame pointers. As frame pointers may add overhead, some distros
> (Debian) has disabled frame pointers from their kernels and with that,
> has also disabled function tracing.
>
> Currently, function tracing selects CONFIG_FRAME_POINTER for various
> archs (including x86), as the kernel will not compile without it, if
> function tracing is enabled. But if -mfentry is available with the
> compiler, it does not have this dependency. The kernel will compile fine
> with -pg -mfentry and without frame pointers.
>
> My question is, how do I remove the dependency in kconfig based on the
> compiler?

Allow the user to select one of:
1) function tracer
2) frame pointer
3) none of the above

This should be trivial to do in Kconfig language.

If "function tracer" is selected then use -mfentry if supported,
with a fallback to frame pointers.

This looks simple IMO and should be easy to implement too.

Sam
--
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/