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 9E9BAC44502 for ; Tue, 7 Jul 2026 19:07:49 +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:MIME-Version:References:Subject:Cc:To: From:Message-ID:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: List-Owner; bh=u00mG5TFoUl9hEQHIiShTGcc8cU3/Kkwkxg60CA9S00=; b=Ohlc1s2PkN3SXj jmLTD6SBgEn6oRPrVKaUnoPzagOeg6Hv8QUnxTai1HGROpJaRQ+DQpA+m09+f+C4QD71VGOgJcQE5 r6L2o9hv1C5bbttICIQXS6InYRdU3CfeR9TvbD7DT8QSGRMOgI0/HpluoMdfV4YGfpPSxCRCnZafY 30GhPFjcNDz5yEcF60RibAr6gv2OgXyGT69n95TbQjE7IGWeLxwGFWVZNj+QSjqrpl2OTnaBhGN6c NOFqYHDii2V//Gjl0HnX7v4xf7dBdAHClVMlXmvzWDVqZfn4dmQ55k+Q1ivZHjiG4+zrmDfAgLzFl uACQ+vTMZh9fZUgbzzqA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1whB93-0000000FiYj-1DI6; Tue, 07 Jul 2026 19:07:49 +0000 Received: from tor.source.kernel.org ([172.105.4.254]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1whB8K-0000000FhfO-40fQ; Tue, 07 Jul 2026 19:07:05 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 5941660018; Tue, 7 Jul 2026 19:07:04 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 3B4431F00A3D; Tue, 7 Jul 2026 19:07:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783451224; bh=f3tTBJMZMBmlp5JnKGm6uVp1qFXO+k6bdzgk0bOTjgQ=; h=Date:From:To:Cc:Subject:References; b=ix0A1te8r5Eh2ztDr6+QRKYrDxuK9fCJBLeYnU+S/kJiG8kcMUDG0t7haY3angHi3 yEIWiFZVjLpiLcvP+/kNmvwnKBvF77QrS5+dxnyxoTIqPaFj7pKDS2a7mgV2+hH/Jl 1gMgd7gaUkRbKMGi+WBaEVcFz8RZe19KgNDBaCY/H1tfyVuoBQsH9m7Php1EFCLPPi XVOOmkLS5GR2sX5v8V1m3yamuDFh1+M1HWpsnafwUhS+dPxVAUoYC+PeeEBBvWJ4Cw UKm+OFP4sfcjyeIRlIp+xzKZPZgNtuvLsVJbilMFjNmhZkDXWLx6bncHi4nCCxb27I tSHD82yuhX1dw== Date: Tue, 07 Jul 2026 21:07:01 +0200 Message-ID: <20260707190254.493733289@kernel.org> User-Agent: quilt/0.69 From: Thomas Gleixner To: LKML Cc: Peter Zijlstra , Michael Ellerman , Shrikanth Hegde , linuxppc-dev@lists.ozlabs.org, Kees Cook , Huacai Chen , loongarch@lists.linux.dev, Paul Walmsley , Palmer Dabbelt , linux-riscv@lists.infradead.org, Sven Schnelle , linux-s390@vger.kernel.org, x86@kernel.org, Mark Rutland , Jinjie Ruan , Andy Lutomirski , Oleg Nesterov , Richard Henderson , Russell King , Catalin Marinas , Guo Ren , Geert Uytterhoeven , Thomas Bogendoerfer , Helge Deller , Yoshinori Sato , Richard Weinberger , Chris Zankel , linux-arm-kernel@lists.infradead.org, linux-alpha@vger.kernel.org, linux-csky@vger.kernel.org, linux-m68k@lists.linux-m68k.org, linux-mips@vger.kernel.org, linux-parisc@vger.kernel.org, linux-sh@vger.kernel.org, linux-um@lists.infradead.org, Arnd Bergmann , Vineet Gupta , Will Deacon , Brian Cain , Michal Simek , Dinh Nguyen , "David S. Miller" , Andreas Larsson , linux-snps-arc@lists.infradead.org, linux-hexagon@vger.kernel.org, linux-openrisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-arch@vger.kernel.org, =?UTF-8?q?Michal=20Such=C3=A1nek?= , Jonathan Corbet , linux-doc@vger.kernel.org Subject: [patch 16/18] x86/entry: Get rid of the sys_ni_syscall() indirection References: <20260707181957.433213175@kernel.org> MIME-Version: 1.0 X-BeenThere: linux-snps-arc@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux on Synopsys ARC Processors List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+linux-snps-arc=archiver.kernel.org@lists.infradead.org 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. 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-snps-arc mailing list linux-snps-arc@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-snps-arc