Re: [RFC][ PATCH -tip v2 0/7] kprobes: Kprobes jump optimization support

From: Andi Kleen
Date: Tue Jun 23 2009 - 12:35:09 EST

Masami Hiramatsu <mhiramat@xxxxxxxxxx> writes:

> Hi Andi,
> Andi Kleen wrote:
>> Masami Hiramatsu <mhiramat@xxxxxxxxxx> writes:
>>> The gcc's crossjumping unifies equivalent code by inserting indirect
>>> jumps which jump into other function body. It is hard to know to where
>>> these jumps jump, so I decided to disable it when setting
>> That sounds quite bad. Tail call optimization is an important optimization
>> that especially on kernel style code (lots of indirect pointers
>> and sometimes deep call chains) is very useful. It would be quite
>> sad if production kernels would lose that optimization.
> I think the crossjumping is not the tail call optimization,

Statement didn't make sense then. The RTL crossjump pass you're referring
AFAIK does not jump into other functions, it only optimizes jumps
inside a function (unless you're talking about inlines)

>> Also tail calls in C should always jump directly to another function,
>> so they shouldn't be particularly complex to manage.
> Tail call jumps directly into the head of another function,
> not the middle. Thus it is safe.

cross jumping does neither.

>>> I also decided not to optimize probes when it is in functions which
>>> will cause exceptions, because the exception in the kernel will jump
>>> to a fixup code and the fixup code jumps back to the middle of the
>>> same function body.
>> Note that not only exceptions do that, there are a few other cases
>> where jumps in and out of out of line sections happen. You might
>> need a more general mechanism to detect this.
> As far as I can see (under arch/x86), Almost all fixup entries are
> defined with ex_table entries, and others jump to the head of
> symbols(or functions). The jumps which jump into the middle of
> some functions are what I need to find, and, as far as I know,
> those fixup jumps are used with exception tables. Of course,
> I might miss some fixup codes, in that case, please let me know:-)

One case for example are out of line sections generated by gcc itself
with the right options.


ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at