From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from canpmsgout10.his.huawei.com (canpmsgout10.his.huawei.com [113.46.200.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EE3E842E43F for ; Wed, 2 Sep 2026 09:55:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.225 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788342914; cv=none; b=h+8XUOUlvLv+sZxsBAyo+nBXGCMuZz1CgKSGJgEPYP3mwbNkZFiDBUZR8U/xDYNmQk7423dnWMJoHqSiRYBFLu47aW2ku+sMc3n5BLAhq9+MFaABy+KLMFh/cYlW5s/k71u1VZXUmWQ8vMWtWx6CegCeqOLfmm//l5PBZSXGYG8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788342914; c=relaxed/simple; bh=QUb2+HOVn5dbuUQ14u8mXXYMz5lFEWlHfabDCQ6rwEM=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=s56hKNTMll7KoKlB94FIfFGvh6BUltiMSq6KU9eUrzR27rMgkna91MgxaSRzIPy+uA9OUmsxVYhH6EJ0xQ4oKdzEOi+onNUGUwDrZPYVne2ggNr2kVmzMaKamZSAtHildion6Rh+4w7v/nGeuOGSgxiy9yDQ3HMsdUdK8sXRjS4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; dkim=pass (1024-bit key) header.d=huawei.com header.i=@huawei.com header.b=fDoZGbnV; arc=none smtp.client-ip=113.46.200.225 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.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.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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: kwepems100002.china.huawei.com (7.221.188.206) To dggpemf500011.china.huawei.com (7.185.36.131) 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