Re: [PATCH] x86: entry_32.S: change ESPFIX test to not touch PT_OLDSS(%esp)
From: Linus Torvalds
Date: Mon Mar 09 2015 - 12:45:08 EST
On Mon, Mar 9, 2015 at 9:28 AM, Denys Vlasenko <vda.linux@xxxxxxxxxxxxxx> wrote:
>
> can execute both test/branch'es out-of-order in parallel.
Assuming it predicts perfectly, yes, and the fallthrough is the default case.
Which is *probably* true her, at least often. And at least for the VM
bit. So it's likely good to have three branches. The unpredictable one
is likely the CS low bit test, which with interrupts in the idle
routine will possibly get a lot of noise from kernel returns too.
The *old* code likely predicted perfectly (because with the cmp we
would care about the LDT SS bit only if the other bits were set, which
is correct).
And remember: those zero-cost out-of-order branches turn quite
expensive if they *ever* mispredict. Even a 5% mispredict rate is
likely to mean "it's better to have a data dependency chain".
So it could easily go either way. I'm not convinced the old code is bad at all.
Linus
--
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/