Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752985AbbDALLe (ORCPT ); Wed, 1 Apr 2015 07:11:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:60549 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751413AbbDALLc (ORCPT ); Wed, 1 Apr 2015 07:11:32 -0400 Message-ID: <551BD241.4060207@redhat.com> Date: Wed, 01 Apr 2015 13:10:57 +0200 From: Denys Vlasenko User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.2.0 MIME-Version: 1.0 To: Brian Gerst CC: Ingo Molnar , Linus Torvalds , Steven Rostedt , Borislav Petkov , "H. Peter Anvin" , Andy Lutomirski , Oleg Nesterov , Frederic Weisbecker , Alexei Starovoitov , Will Drewry , Kees Cook , the arch/x86 maintainers , Linux Kernel Mailing List Subject: Re: [PATCH 7/9] x86/asm/entry/32: tidy up some instructions References: <1427821211-25099-1-git-send-email-dvlasenk@redhat.com> <1427821211-25099-7-git-send-email-dvlasenk@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1471 Lines: 40 On 04/01/2015 12:21 AM, Brian Gerst wrote: > On Tue, Mar 31, 2015 at 1:00 PM, Denys Vlasenko wrote: >> After TESTs, use logically correct JZ mnemonic instead of JE >> (this doesn't change code). >> >> Tidy up CMPW insns: >> >> Modern CPUs are not good with 16-bit operations. >> The instructions with 16-bit immediates are especially bad, >> on many CPUs they cause length changing prefix stall >> in the decoders, costing ~6 cycles to recover. >> >> Replace CMPWs with CMPLs. >> Of these, for form with 8-bit sign-extended immediates >> it is a win because they are smaller now >> (no 0x66 prefix anymore); >> ones with 16-bit immediates are faster. >> >> @@ -708,7 +708,7 @@ END(sysenter_badsys) >> #ifdef CONFIG_X86_ESPFIX32 >> movl %ss, %eax >> /* see if on espfix stack */ >> - cmpw $__ESPFIX_SS, %ax >> + cmpl $__ESPFIX_SS, %eax >> jne 27f >> movl $__KERNEL_DS, %eax >> movl %eax, %ds > > This is incorrect. 32-bit reads from a segment register are not > zero-extended. The upper 16 bits are implementation-defined. Most > processors will clear them but it's not guaranteed. I did not know that. I was sure they are always zero extended. -- 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/