Re: [PATCH v2 4/4] x86/static_call: Add inline static call implementation for x86-64
From: Linus Torvalds
Date: Mon Dec 10 2018 - 20:44:08 EST
On Mon, Dec 10, 2018 at 3:58 PM Pavel Machek <pavel@xxxxxx> wrote:
>
> On Thu 2018-11-29 11:11:50, Linus Torvalds wrote:
> >
> > It might be better to use an empty REX prefix on x86-64 or something like that.
>
> It might be easiest to use plain old NOP, no? :-).
No. The whole point would be that the instruction rewriting is atomic wrt fetch.
If it's a "nop" + "second instruction", and the "nop" is overwritten
by "int3", then the second instruction could still be executed after
the "int3" has been written (because the other CPU just finished the
"nop".
So an empty rex prefix is very different from a one-byte nop, exactly
because it's executed atomically with the instruction itself.
Linus