Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2182888pxj; Thu, 20 May 2021 01:56:01 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxZyFEnT5+1Vm0jVtf2OyjHfqelHO2Sl3BC/IWmXjdZClBvAeO7LuHcdiMq86UsJFB8mnV/ X-Received: by 2002:aa7:c0d0:: with SMTP id j16mr3768311edp.324.1621500961482; Thu, 20 May 2021 01:56:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1621500961; cv=none; d=google.com; s=arc-20160816; b=cN6dnNSrv9i2L47SQn8P7FcoX1pV44LY/2uMNu+moHtI0eVlHSQXgqQkhTQ0A3qvQg 9Nw11nwedechafMa1KHpCktXWXP2YFMSHcw5qxCYtbzvOhogkzt2+LewbvhSIEsZcNgk wRTRdZL79kbQz4k1Udi+GJ43lEAuFlu7sow+bP/eLuTUVVd9XgkOOYx+Iid6nuCOb+P6 paAFZnFCzYtAJCiOH6fZe6hPADM76mRNkn4cABhJ6dEEeImij7cT1z/3amwn6aonNBZw e+Sz+8UtQUKZxU9y675M+HkDpPNyoit5KHJmp/DEe0qknFITEtK3zizaIph+UEDfhOs9 0Spw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:references :in-reply-to:subject:cc:to:dkim-signature:dkim-signature:from; bh=skGknAwoPCnWVG2vIbapxefIECkgS4asZL7CQlC2/vA=; b=iwwa6V9eRYBFDCOOYcEXiRBc2+BTmzeKS2u29wO9VRwcVTyKB4KG5mtvJUL49+qEO6 DchQvZ3bbZV7R20T4GiNoHS/Qw/S9vP9qTpj1j4IEedWU8KHimQ7BK2wZ2bNL/m7Wfav WfBwWi+gzZjP3e3ojDupsDCi5PKuwuQDAccTavLmOkt021/zhYw5kdVlWEC7/kQZgZVz YTNNX55OOJQjkXrpufMnqRPYI3vGelHSX8KRvyh2eH43RX0Ul5+gSuKld8JXQqoiALO8 IgJaQ23aYgCT94MDxR10Y1LSEfWKFXd3e7XtNXy8QUKYZhcFFQGId9ZJ0URWYjBG8DCL ODOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GOJQJWMP; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kq17si2143187ejb.24.2021.05.20.01.55.38; Thu, 20 May 2021 01:56:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=GOJQJWMP; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231193AbhETIyq (ORCPT + 99 others); Thu, 20 May 2021 04:54:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36656 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230478AbhETIyp (ORCPT ); Thu, 20 May 2021 04:54:45 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6775DC061574 for ; Thu, 20 May 2021 01:53:24 -0700 (PDT) From: Thomas Gleixner DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1621500802; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=skGknAwoPCnWVG2vIbapxefIECkgS4asZL7CQlC2/vA=; b=GOJQJWMPrPgdhhjj5r3+3aNjLrqNK1mp48wbLJNIG+sytIkPv0AzRgtQNxCnoN1awN8u38 cPiWH/ifiyt7TrXOCrkLS28SxETZsYB/mzV+T0QORXNIv3D3JAPFa1idddK0dRz3u6aE2Q dJOC8xp/2m0b72rCCVS0p1nlp2vWhtAzqqetAFZH4eNwjmthVaWGWFuKvqiIlQeDbwLiZz +qerfKMJRcoUrdxYNxsf2Vx9tjZoe/nf7+ZM5yP/ajSEA5LF/N2fKH8ULNq1kf875Camrz GOREoFrg27FVZGCdKEAlQaI349hnJE+2YDa7qoZDWMFt0WJBUNQCD/SXSFhk0Q== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1621500802; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=skGknAwoPCnWVG2vIbapxefIECkgS4asZL7CQlC2/vA=; b=sSyLi6KeW5sAPJ6RpB9HYH1YmmIqj2RmYFSInSJqJhXlNivEXpNi2Qd5ULFDPsR9NjZSRS DO+Rho+qvqq+KJCA== To: "H. Peter Anvin" , Ingo Molnar , Andy Lutomirski , Borislav Petkov , "H. Peter Anvin" Cc: Linux Kernel Mailing List Subject: Re: [PATCH v4 6/6] x86/syscall: use int everywhere for system call numbers In-Reply-To: <20210518191303.4135296-7-hpa@zytor.com> References: <20210518191303.4135296-1-hpa@zytor.com> <20210518191303.4135296-7-hpa@zytor.com> Date: Thu, 20 May 2021 10:53:21 +0200 Message-ID: <87zgwpbxby.ffs@nanos.tec.linutronix.de> MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, May 18 2021 at 12:13, H. Peter Anvin wrote: > +static __always_inline bool do_syscall_x64(struct pt_regs *regs, int nr) > +{ > + /* > + * Convert negative numbers to very high and thus out of range > + * numbers for comparisons. Use unsigned long to slightly > + * improve the array_index_nospec() generated code. How is that actually improving the generated code? unsigned long: 104: 48 81 fa bf 01 00 00 cmp $0x1bf,%rdx 10b: 48 19 c0 sbb %rax,%rax 10e: 48 21 c2 and %rax,%rdx 111: 48 89 df mov %rbx,%rdi 114: 48 8b 04 d5 00 00 00 mov 0x0(,%rdx,8),%rax 11b: 00 11c: e8 00 00 00 00 callq 121 unsigned int: f1: 48 81 fa bf 01 00 00 cmp $0x1bf,%rdx f8: 48 19 d2 sbb %rdx,%rdx fb: 21 d0 and %edx,%eax fd: 48 89 df mov %rbx,%rdi 100: 48 8b 04 c5 00 00 00 mov 0x0(,%rax,8),%rax 107: 00 108: e8 00 00 00 00 callq 10d Text size increases with that unsigned long cast. I must be missing something. Thanks, tglx