Re: [PATCH] perf/x86/intel: Mark expected switch fall-throughs

From: Peter Zijlstra
Date: Fri Jun 28 2019 - 09:31:29 EST


On Thu, Jun 27, 2019 at 09:12:50AM +0200, Peter Zijlstra wrote:

> Josh came up with the following:
>
> + /* If the jump target is close, do a 2-byte nop: */
> + ".skip -(%l[l_yes] - 1b <= 126), 0x66\n"
> + ".skip -(%l[l_yes] - 1b <= 126), 0x90\n"
> + /* Otherwise do a 5-byte nop: */
> + ".skip -(%l[l_yes] - 1b > 126), 0x0f\n"
> + ".skip -(%l[l_yes] - 1b > 126), 0x1f\n"
> + ".skip -(%l[l_yes] - 1b > 126), 0x44\n"
> + ".skip -(%l[l_yes] - 1b > 126), 0x00\n"
> + ".skip -(%l[l_yes] - 1b > 126), 0x00\n"
>
> Which is a wonderfully gruesome hack :-) So I'll be playing with that
> for a bit.

For those with interest; full patches at:

https://lkml.kernel.org/r/20190628102113.360432762@xxxxxxxxxxxxx