Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422781AbbENVvM (ORCPT ); Thu, 14 May 2015 17:51:12 -0400 Received: from terminus.zytor.com ([198.137.202.10]:54144 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422686AbbENVvI (ORCPT ); Thu, 14 May 2015 17:51:08 -0400 Message-ID: <555518AA.7040001@zytor.com> Date: Thu, 14 May 2015 14:50:34 -0700 From: "H. Peter Anvin" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0 MIME-Version: 1.0 To: Denys Vlasenko , Ingo Molnar CC: Linus Torvalds , Steven Rostedt , Borislav Petkov , Andy Lutomirski , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , x86@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] x86/asm/entry/64: Use shorter MOVs from segmers registers References: <1431626841-21386-1-git-send-email-dvlasenk@redhat.com> In-Reply-To: <1431626841-21386-1-git-send-email-dvlasenk@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 968 Lines: 24 On 05/14/2015 11:07 AM, Denys Vlasenko wrote: > "movw %ds,%cx" insn needs a 0x66 prefix, while "movw %ds,%ecx" does not. > The difference is that latter form (on 64-bit CPUs) overwrites > entire %ecx, not only its lower half. > > But subsequent code doesn't depend on the value of upper > half of %ecx, we can safely use the shorter insn. > > The new code is also faster than old one - now we don't depend on old value > of %ecx, but this code fragment is not performance-critical. This is still misleading. On P6 or later CPUs, not just 64 bits, this zeroes the upper half, whereas on older CPUs it is undefined. Which is still fine, but if we are going to make such a minor change we should get it correct. -hpa -- 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/