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 33289C624D9 for ; Wed, 2 Sep 2026 09:55:23 +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=sZSpbO9IcTEwUC97Fm4qSyjltlS7ssuPpR01THv8ukQ=; b=fKEap6grjANnfabGQRk+w1tLXC aud3Jtfr7b5Ny9HXmtxD4aCUJA8b4qZvsnXAsym2N9DetwedWaFAWut381XMMRuWfYplTmuZ6kkDj eEItx98O4LBN9KrSfu5nqWmThyedJQNMPFshiF7OcPx/ka/BbUjWAsBWGeT1XsRmuavWA4M/bdMwV QwuntAHo14uAngw+21bXQyQ6KvT30lEj/i9F76wMWb8+r3WbfFREHQGUDzxMMO+blsxgcwwdLf6gZ AKyRnDkUec2olM5bzXegXWhHzsoic8htDeINZxTwRQgZLSIULw8J93recIfMzoEASzheKgdIEgvu/ 6BTbKkmA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1hga-0000000EHJ0-1gsQ; Wed, 02 Sep 2026 09:55:16 +0000 Received: from canpmsgout10.his.huawei.com ([113.46.200.225]) by bombadil.infradead.org with esmtps (Exim 4.99.1 #2 (Red Hat Linux)) id 1x1hgS-0000000EH7T-37RN for linux-arm-kernel@lists.infradead.org; Wed, 02 Sep 2026 09:55:11 +0000 dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=sZSpbO9IcTEwUC97Fm4qSyjltlS7ssuPpR01THv8ukQ=; b=fDoZGbnV45YDNiTR6zCUOF2t6mzSJS0uWp1qBlqF+4Soik/WqcPB32qWWOHSPtfzJgCfAHXiR gQTXDcp1mG8RS95tchNiModcsQvJqxCjPWRd9z4wnkkQNmE8Zl+qXWHWW2BgZfoAhYdmihEdGed vGZ5JBVBiYB3iDbIAW+Jcrk= Received: from mail.maildlp.com (unknown [172.19.162.92]) by canpmsgout10.his.huawei.com (SkyGuard) with ESMTPS id 4hZd9C3Fhyz1K9BV; Wed, 2 Sep 2026 17:44:15 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 9FEF640565; Wed, 2 Sep 2026 17:55:05 +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:04 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH v18 08/14] arm64: ptrace: Extract arm64_syscall_exit_to_user_mode_work() helper Date: Wed, 2 Sep 2026 17:55:31 +0800 Message-ID: <20260902095537.602517-9-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_025509_081513_F68173A0 X-CRM114-Status: GOOD ( 11.87 ) 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 Introduce a helper arm64_syscall_exit_to_user_mode_work() that encapsulates the re-reading of thread flags and the call to syscall_trace_exit(). Use it in el0_svc_common() to replace the open-coded instances, removing the duplicated flags read and making the control flow simpler. This aligns the arm64 exit path with the pattern expected by the generic entry infrastructure, which uses a similar syscall_exit_to_user_mode_work() callback. No functional changes intended; this is a preparation step for converting arm64 to the generic entry infrastructure. Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas Cc: Ada Couprie Diaz Reviewed-by: Linus Walleij Signed-off-by: Jinjie Ruan --- arch/arm64/include/asm/syscall.h | 7 +++++++ arch/arm64/kernel/syscall.c | 9 +++------ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/arch/arm64/include/asm/syscall.h b/arch/arm64/include/asm/syscall.h index 696739f5a250..3e4672ab4a4f 100644 --- a/arch/arm64/include/asm/syscall.h +++ b/arch/arm64/include/asm/syscall.h @@ -123,4 +123,11 @@ static inline int syscall_get_arch(struct task_struct *task) int arm64_syscall_trace_enter(struct pt_regs *regs, unsigned long flags); void syscall_trace_exit(struct pt_regs *regs, unsigned long flags); +static __always_inline void arm64_syscall_exit_to_user_mode_work(struct pt_regs *regs) +{ + unsigned long flags = read_thread_flags(); + + syscall_trace_exit(regs, flags); +} + #endif /* __ASM_SYSCALL_H */ diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c index e778aac6fab9..0061fc63e7ba 100644 --- a/arch/arm64/kernel/syscall.c +++ b/arch/arm64/kernel/syscall.c @@ -127,16 +127,13 @@ static void el0_svc_common(struct pt_regs *regs, int scno, int sc_nr, */ if (!has_syscall_work(flags) && !IS_ENABLED(CONFIG_DEBUG_RSEQ)) { flags = read_thread_flags(); - if (has_syscall_work(flags) || flags & _TIF_SINGLESTEP) { - flags = read_thread_flags(); - syscall_trace_exit(regs, flags); - } + if (has_syscall_work(flags) || flags & _TIF_SINGLESTEP) + arm64_syscall_exit_to_user_mode_work(regs); return; } trace_exit: - flags = read_thread_flags(); - syscall_trace_exit(regs, flags); + arm64_syscall_exit_to_user_mode_work(regs); } void do_el0_svc(struct pt_regs *regs) -- 2.34.1