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 E2B36C624D6 for ; Wed, 2 Sep 2026 09:55:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:References:In-Reply-To:Message-ID:Date :Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=VFUiQ56PPSYmoAUultY8YLBWsGtf+JS3lLeKNy5QVgQ=; b=lYgQJYM9b5os7nYV9FeiChkzqa JXMcQhPNjCSvRATJD3Ediac9bL2MeRLi3ISJTaRdeI85UqktlA1ysJZUIph12BoxxUF1i4lPFnMZE o9qKH+QhasIixITdfQmJ8NGJc8MdayuEg68Z43PDzsUJoZxHuDEIOn7hNgUSDB6b4bfuXy/FbWr7P zV3i0gst5IYLQm014w5s0KUzZS5iL/ohVy+WjoFNryqqt3rmUefMOBOfIT3hxIC4lyUbN1yP9ZywP cw+rtUejcA9Hv2nvA/KL8D+hQpX0yVCawtLQdaaBVMnThhVcrSPmqh8B/OcC5huDvZ7SARXgi2XOO cWXHlZwg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1hge-0000000EHOo-2lIp; Wed, 02 Sep 2026 09:55:20 +0000 Received: from canpmsgout05.his.huawei.com ([113.46.200.220]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1hgX-0000000EHBD-0H7S for linux-arm-kernel@lists.infradead.org; Wed, 02 Sep 2026 09:55:16 +0000 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=VFUiQ56PPSYmoAUultY8YLBWsGtf+JS3lLeKNy5QVgQ=; b=WDEPn39yXQS13YE4m0aaU5DCLNIgAsKWej2Jh/qDYm32U2x5Y55Pr8y6Kj3+qt+AhopF/fSf+ svFMkDf5dwPFB7qwPWLQo/FlBdx/gFlwYCezF3MwVuHdUm1EVpkgYhae9815Ri7gxlP5LLjFA21 1siPJcBk9YLecKCYnSxtTjY= Received: from mail.maildlp.com (unknown [172.19.163.104]) by canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4hZd8n0cLnz12LG0; Wed, 2 Sep 2026 17:43:53 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 63CAE4058E; Wed, 2 Sep 2026 17:55:09 +0800 (CST) Received: from huawei.com (10.90.53.73) 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; Wed, 2 Sep 2026 17:55:08 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH v18 11/14] arm64: syscall: Simplify el0_svc_common() syscall exit path Date: Wed, 2 Sep 2026 17:55:34 +0800 Message-ID: <20260902095537.602517-12-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260902095537.602517-1-ruanjinjie@huawei.com> References: <20260902095537.602517-1-ruanjinjie@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) 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-20260902_025513_491905_BC073CB5 X-CRM114-Status: GOOD ( 12.98 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Remove the redundant nested conditional check within the system call exit path of el0_svc_common() to streamline the exit sequence. The fast-path block is guarded by `!IS_ENABLED(CONFIG_DEBUG_RSEQ)`, so CONFIG_DEBUG_RSEQ is guaranteed to be disabled and the call of rseq_syscall() is a no-op. Under this constraint, the code logic inside the block becomes completely identical to what the arm64_syscall_exit_to_user_mode_work() helper already does. Replace that nested logic with a direct invocation of the helper, eliminating redundant code. Before: | if (... && !IS_ENABLED(CONFIG_DEBUG_RSEQ)) { | flags = read_thread_flags(); | if (unlikely(flags & _TIF_SYSCALL_EXIT_WORK) || flags & _TIF_SINGLESTEP) | arm64_syscall_exit_to_user_mode_work(regs); | return; | } | trace_exit: | arm64_syscall_exit_to_user_mode_work(regs); After simplify: | if (... && !IS_ENABLED(CONFIG_DEBUG_RSEQ)) { | arm64_syscall_exit_to_user_mode_work(regs); | return; | } | trace_exit: | arm64_syscall_exit_to_user_mode_work(regs); Furthermore, Since both the conditional fast-path and the fallback slow-path now uniformly invoke arm64_syscall_exit_to_user_mode_work(), this explicit conditional branch is entirely redundant regardless of whether the evaluation is true or false. Removing it collapses the duplicated logic into a single, unconditional path. No functional changes. Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas Cc: Ada Couprie Diaz Reviewed-by: Linus Walleij Signed-off-by: Jinjie Ruan --- arch/arm64/kernel/syscall.c | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c index a8e0bf8d362e..3488afd45d20 100644 --- a/arch/arm64/kernel/syscall.c +++ b/arch/arm64/kernel/syscall.c @@ -114,19 +114,6 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, } invoke_syscall(regs, scno, sc_nr, syscall_table); - - /* - * The tracing status may have changed under our feet, so we have to - * check again. However, if we were tracing entry, then we always trace - * exit regardless, as the old entry assembly did. - */ - if (!(unlikely(flags & _TIF_SYSCALL_WORK)) && !IS_ENABLED(CONFIG_DEBUG_RSEQ)) { - flags = read_thread_flags(); - if (unlikely(flags & _TIF_SYSCALL_EXIT_WORK) || flags & _TIF_SINGLESTEP) - arm64_syscall_exit_to_user_mode_work(regs); - return; - } - trace_exit: arm64_syscall_exit_to_user_mode_work(regs); } -- 2.34.1