Re: [PATCH 2/8] tracing: create automated trace defines

Steven Rostedt
2009-04-21T21:17:38Z

On Tue, 21 Apr 2009, Andi Kleen wrote:

> > It is needed for the function tracer (gcc -pg wont work without it). It is
> > the only tracer that selects it.
>
> FWIW i still have gcc patches to fix that. They were first stalled
> on copyright assignment and then on gcc's merge window being closed,
> but now with 4.5 open for game I hope to resubmit them soon
> again.
>
> With that you can use -pg without frame pointer, but you have
> to supply a special mcount function that expects the different
> stack layout.

I think it was Ingo that let out the idea, and I'm starting to like it.

Perhaps we should fork off gcc and ship Linux with its own compiler. This
way we can optimize it for the kernel and not worry about any userland
optimizations.

I would like to do something like:

if (unlikely(err)) {
__section__(".error_sect") {
/* put error code here */
}
}

And have gcc in the error section (if it is big enough perhaps) do:

jmp .L123
.L124 [...]

and in the section ".error_sect" we would have:

.L123
/* error code here */
jmp .L124

We could do the same for trace points. That is, any part of code that
really would happen once in a while (error handling for one) we can move
off to its own section and keep hot paths hot.

-- Steve