Re: [RESEND][PATCH v3 14/17] static_call: Add static_cond_call()

From: Linus Torvalds
Date: Wed Mar 25 2020 - 16:52:23 EST


On Wed, Mar 25, 2020 at 12:35 PM <hpa@xxxxxxxxx> wrote:
>
> "movl $0,%eax" is five bytes, the same length as a call. Doesn't work for a tailcall, still, although if the sequence:
>
> jmp tailcall
> retq
>
> ... can be generated at the tailcall site then the jmp can get patched out.

No, the problem is literally that the whole approach depends on the
compiler just generating normal code for the static calls.

And the tailcall is the only interesting case. The normal call thing
can be trivially just a single instruction (a mov like you say, but
also easily just a xor padded with prefixes).

Linus