Re: [PATCH] x86: entry_32.S: change ESPFIX test to not touch PT_OLDSS(%esp)

From: Denys Vlasenko
Date: Mon Mar 09 2015 - 12:28:54 EST


On Mon, Mar 9, 2015 at 5:08 PM, Linus Torvalds
<torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Mon, Mar 9, 2015 at 7:05 AM, Denys Vlasenko <dvlasenk@xxxxxxxxxx> wrote:
>> New:
>> 1e6: 0f ba 64 24 38 11 btl $0x11,0x38(%esp)
>
> btl? Really?
>
> Why isn't that just
>
> testb $2,0x3a(%esp)
>
> which is both smaller and quite a bit faster on older machines.

Ok. (I thought people won't be happy about this.)

> Or just at least *partially* do what we used to do, and make it all be
>
> movb PT_EFLAGS+2(%esp),%al
> andb $2,%al
> orb PT_CS(%esp),%al
> testb $3,%al
> je restore_nocheck

These insns must run serially. 4 cycles.

test
branch
test
branch

can execute both test/branch'es out-of-order in parallel.
2 cycles.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/