From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=113.46.200.220 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1794397379; b=E/VYBKU6f/B7GJ+L+EXh5iL+tPaG6No6C7dXPDfXOZgW8cy/rG7ybGWbb6Uvrw89S5r1 bQHY/i7KnkNvauofylbNfCsfVbNqUAsE+AJCT27XnzZwAhZ7NsMgSTBfURi017jeZ/ggX b8t4hg7IH6Iz/71Hw0ORE1TkTHIMWvKo7MRuVciNtaWNyTLtLUHjzxqYSIbXbmYCzeS/y 9PSYPbg9EoUj8mNEQ8ZMufyyD57lsyEmkfAEL6IQJPolzm16h4a+lAfU9bajLY4KPGBda 7AjzqyNFsLrBC/widI34ysaDAK2EFPJyhNbCYKSP4myEcPNZMs7Oc0BIUl7AkNjT8Ng== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794397379; h=DMARC-Filter:dkim-signature:Received:Received:Received:From:To:CC: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding:Content-Type:X-Originating-IP: X-ClientProxiedBy; bh=sZSpbO9IcTEwUC97Fm4qSyjltlS7ssuPpR01THv8ukQ=; b=Is2JRbs8jn7f+C/rYFFjCrmx0dp2+zRNjqtKLt+HjLBX2TF/ufvm+Cf/47SngUlKsArq LLkfIJxjYCZi/P8KavLviYBzmwcFBIHcMZfgpV+NCr8+CNn63Aaq+EZvBVyb9x6vOXvBV L/NzYbk3N5FrX+sETf86ZHvm8VcS4VLjU2MYKBJH1iG//lPqRZuPPi73e1a73DLLL4ah3 iBTBwpbOEuIYvetVsgUScNBHKmAw1BHmXmhNv9Qsa2+W6GBL1c7cq6StEl3RgNwd3ycWD oaCbbaO/Y0Yz0QwLlB0PJwmUiF7ps9lKcod9ZbxmOIpL9S8Gqec0T7Q5CrDLVBD4VDA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=fDoZGbnV; arc=none smtp.remote-ip=113.46.200.220 Received: from canpmsgout05.his.huawei.com (canpmsgout05.his.huawei.com [113.46.200.220]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF035606A88E; Wed, 11 Nov 2026 11:42:58 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CF035606A88E Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=fDoZGbnV 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.140]) by canpmsgout05.his.huawei.com (SkyGuard) with ESMTPS id 4jPhTx6Z7fz12LFg; Wed, 11 Nov 2026 19:43:01 +0800 (CST) Received: from kwepemk200008.china.huawei.com (unknown [7.202.194.74]) by mail.maildlp.com (Postfix) with ESMTPS id EFDEA202E6; Wed, 11 Nov 2026 19:42:56 +0800 (CST) Received: from huawei.com (10.90.53.73) by kwepemk200008.china.huawei.com (7.202.194.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.2562.45; Wed, 11 Nov 2026 19:42:56 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , CC: Subject: [PATCH v21 08/15] arm64: ptrace: Extract arm64_syscall_exit_to_user_mode_work() helper Date: Wed, 11 Nov 2026 19:42:18 +0800 Message-ID: <20261111114225.3977243-9-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20261111114225.3977243-1-ruanjinjie@huawei.com> References: <20261111114225.3977243-1-ruanjinjie@huawei.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: kwepems500001.china.huawei.com (7.221.188.70) To kwepemk200008.china.huawei.com (7.202.194.74) 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