[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwj7N5SXSVEFEZJHJ8NbX9uwG3_uS-V+SwWz_Uw1+bZxw@mail.gmail.com>
Date: Mon, 9 Mar 2015 09:44:58 -0700
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Denys Vlasenko <vda.linux@...glemail.com>
Cc: Denys Vlasenko <dvlasenk@...hat.com>,
Andy Lutomirski <luto@...capital.net>,
Steven Rostedt <rostedt@...dmis.org>,
Ingo Molnar <mingo@...nel.org>, Borislav Petkov <bp@...en8.de>,
"H. Peter Anvin" <hpa@...or.com>, Oleg Nesterov <oleg@...hat.com>,
Frederic Weisbecker <fweisbec@...il.com>,
Alexei Starovoitov <ast@...mgrid.com>,
Will Drewry <wad@...omium.org>,
Kees Cook <keescook@...omium.org>,
"the arch/x86 maintainers" <x86@...nel.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] x86: entry_32.S: change ESPFIX test to not touch PT_OLDSS(%esp)
On Mon, Mar 9, 2015 at 9:28 AM, Denys Vlasenko <vda.linux@...glemail.com> 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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists