From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 95563C43458 for ; Thu, 9 Jul 2026 02:04:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:From:References:CC:To: Subject:MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=UvgxJYv+q32rnEUgPYXhZY2Jwz3Y86oaJXDn9agKFN8=; b=U03mxJmqpR7Lzc /P1ex/SBsxtzvtwP7em/UWgptILew2GIMQt3nmjxHkk5RmgpAM/rcr8xqZcPif0iaidfHOoA9IjUD 3NaD4vnzbgS4CHljSPBn8Cu5/tvcBBl0cPbK2l4FtWrCaMP7oTmTCb3JTFDA42KjB6rBWAYTMlPGY uzEiv6fzABFLnxDpIWcCznDgJGmcqVp0HI1W8jEVYWTJz5i1DYCGuhAB49CgWTUI6g7AjBaT8BsGz +43yBM/WkJh12O5wt+mSUNFkEQYgH+0i6c3l/vA7h5alnBtJUD6U32WrLVqGiyAqIAbeiSoIS6kqC 4hGSruhbojg0rhPIBgUg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1whe7S-00000000nG4-1Zk9; Thu, 09 Jul 2026 02:04:06 +0000 Received: from canpmsgout11.his.huawei.com ([113.46.200.226]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1whe7N-00000000nDT-3yhg; Thu, 09 Jul 2026 02:04:04 +0000 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=SbMumxZtxbvkP/ieepXLg1JhrafzB20Wq2MZPkH/Sw0=; b=AWDuAsADSwEvEL71EYfZ0NigOV6Nm/EE0o+eCaP1xQFlxhq8DY4cyFSYwdUDcA872iUYRmCcL fgkqFmw2f6REMuKThf5T1j9G/cENjZayXtYg+Tp2Kdo8RhfXnSpSgOVUD3wzxl53MN4FlPjvW4S 5jTBmgoFDxvMSl13ULhIb7E= Received: from mail.maildlp.com (unknown [172.19.163.15]) by canpmsgout11.his.huawei.com (SkyGuard) with ESMTPS id 4gwdLg6g1HzKmWh; Thu, 9 Jul 2026 09:54:35 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id D94DC40578; Thu, 9 Jul 2026 10:03:52 +0800 (CST) Received: from [10.67.109.254] (10.67.109.254) by dggpemf500011.china.huawei.com (7.185.36.131) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.11; Thu, 9 Jul 2026 10:03:50 +0800 Message-ID: Date: Thu, 9 Jul 2026 10:03:49 +0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [patch 16/18] x86/entry: Get rid of the sys_ni_syscall() indirection To: Thomas Gleixner , LKML CC: Peter Zijlstra , Michael Ellerman , Shrikanth Hegde , , Kees Cook , Huacai Chen , , Paul Walmsley , Palmer Dabbelt , , Sven Schnelle , , , Mark Rutland , Andy Lutomirski , Oleg Nesterov , Richard Henderson , Russell King , Catalin Marinas , Guo Ren , Geert Uytterhoeven , Thomas Bogendoerfer , Helge Deller , Yoshinori Sato , Richard Weinberger , Chris Zankel , , , , , , , , , Arnd Bergmann , Vineet Gupta , Will Deacon , Brian Cain , Michal Simek , Dinh Nguyen , "David S. Miller" , Andreas Larsson , , , , , , =?UTF-8?Q?Michal_Such=C3=A1nek?= , Jonathan Corbet , References: <20260707181957.433213175@kernel.org> <20260707190254.493733289@kernel.org> From: Jinjie Ruan In-Reply-To: <20260707190254.493733289@kernel.org> X-Originating-IP: [10.67.109.254] X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To dggpemf500011.china.huawei.com (7.185.36.131) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.9.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20260708_190402_622083_DB419BF9 X-CRM114-Status: GOOD ( 18.03 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org On 7/8/2026 3:07 AM, Thomas Gleixner wrote: > Invoking sys_ni_syscall() from a code path, which already knows that the > syscall number is invalid just to assign -ENOSYS to regs->ax is a pointless > exercise. It's even redundant as the low level entry code already has set > regs->ax to -ENOSYS on entry. Makes sense, the all reltaed entry has already initialized regs->ax to -ENOSYS. This makes the code very concise. LGTM Reviewed-by: Jinjie Ruan > > Remove the extra conditionals and the function calls. > > Signed-off-by: Thomas Gleixner > --- > arch/x86/entry/syscall_32.c | 2 -- > arch/x86/entry/syscall_64.c | 10 +++------- > 2 files changed, 3 insertions(+), 9 deletions(-) > > --- a/arch/x86/entry/syscall_32.c > +++ b/arch/x86/entry/syscall_32.c > @@ -81,8 +81,6 @@ static __always_inline void do_syscall_3 > if (likely(unr < IA32_NR_syscalls)) { > unr = array_index_nospec(unr, IA32_NR_syscalls); > regs->ax = ia32_sys_call(regs, unr); > - } else if (nr != -1) { > - regs->ax = __ia32_sys_ni_syscall(regs); > } > } > > --- a/arch/x86/entry/syscall_64.c > +++ b/arch/x86/entry/syscall_64.c > @@ -68,7 +68,7 @@ static __always_inline bool do_syscall_x > return false; > } > > -static __always_inline bool do_syscall_x32(struct pt_regs *regs, int nr) > +static __always_inline void do_syscall_x32(struct pt_regs *regs, int nr) > { > /* > * Adjust the starting offset of the table, and convert numbers > @@ -80,9 +80,7 @@ static __always_inline bool do_syscall_x > if (IS_ENABLED(CONFIG_X86_X32_ABI) && likely(xnr < X32_NR_syscalls)) { > xnr = array_index_nospec(xnr, X32_NR_syscalls); > regs->ax = x32_sys_call(regs, xnr); > - return true; > } > - return false; > } > > /* Returns true to return using SYSRET, or false to use IRET */ > @@ -92,10 +90,8 @@ static __always_inline bool do_syscall_x > > instrumentation_begin(); > > - if (!do_syscall_x64(regs, nr) && !do_syscall_x32(regs, nr) && nr != -1) { > - /* Invalid system call, but still a system call. */ > - regs->ax = __x64_sys_ni_syscall(regs); > - } > + if (!do_syscall_x64(regs, nr)) > + do_syscall_x32(regs, nr); > > instrumentation_end(); > syscall_exit_to_user_mode(regs); > _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv