Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964958AbbD0SMK (ORCPT ); Mon, 27 Apr 2015 14:12:10 -0400 Received: from mail-ig0-f171.google.com ([209.85.213.171]:38704 "EHLO mail-ig0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964851AbbD0SMG (ORCPT ); Mon, 27 Apr 2015 14:12:06 -0400 MIME-Version: 1.0 In-Reply-To: <553E5FD8.2070709@redhat.com> References: <5d120f358612d73fc909f5bfa47e7bd082db0af0.1429841474.git.luto@kernel.org> <20150425211206.GE32099@pd.tnic> <20150427085305.GB6774@pd.tnic> <20150427113506.GG6774@pd.tnic> <553E5FD8.2070709@redhat.com> Date: Mon, 27 Apr 2015 11:12:05 -0700 X-Google-Sender-Auth: kCa1jQVYpLVk9NN2pAdI1ZOayno Message-ID: Subject: Re: [PATCH] x86_64, asm: Work around AMD SYSRET SS descriptor attribute issue From: Linus Torvalds To: Denys Vlasenko Cc: Borislav Petkov , Andy Lutomirski , Andy Lutomirski , X86 ML , "H. Peter Anvin" , Denys Vlasenko , Brian Gerst , Ingo Molnar , Steven Rostedt , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , 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 Content-Length: 1171 Lines: 27 On Mon, Apr 27, 2015 at 9:12 AM, Denys Vlasenko wrote: > > It is smaller, but not by much. It is two instructions smaller. Ehh. That's _half_. And on a decoding side, it's the difference between 6 bytes that decode cleanly and can be decoded in parallel with other things (assuming the 6-byte nop), and 13 bytes that will need at least 2 nops (unless you want to do lots of prefixes, which is slow on some cores), _and_ which is likely big enough that you will basically not be decoding anythign else that cycle. So on the whole, your "smaller, but not by much" is all relative. It's a relatively big difference. So if one or two cycles in this code doesn't matter, then why are we adding alternate instructions just to avoid a few ALU instructions and a conditional branch that predicts perfectly? And if it does matter, then the 6-byte option looks clearly better.. Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/