From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752393AbbCIQpD (ORCPT ); Mon, 9 Mar 2015 12:45:03 -0400 Received: from mail-ig0-f177.google.com ([209.85.213.177]:41315 "EHLO mail-ig0-f177.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751778AbbCIQo7 (ORCPT ); Mon, 9 Mar 2015 12:44:59 -0400 MIME-Version: 1.0 In-Reply-To: References: <1425909943-14687-1-git-send-email-dvlasenk@redhat.com> Date: Mon, 9 Mar 2015 09:44:58 -0700 X-Google-Sender-Auth: c82TfqudnLahNuOkw7YR1d634QU Message-ID: Subject: Re: [PATCH] x86: entry_32.S: change ESPFIX test to not touch PT_OLDSS(%esp) From: Linus Torvalds To: Denys Vlasenko Cc: Denys Vlasenko , Andy Lutomirski , Steven Rostedt , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , "the arch/x86 maintainers" , Linux Kernel Mailing List Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 9, 2015 at 9:28 AM, Denys Vlasenko 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