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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 F3C79C43458 for ; Mon, 29 Jun 2026 13:08:00 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4gpmlc3tsdz2yfD; Mon, 29 Jun 2026 23:07:24 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=113.46.200.217 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1782738444; cv=none; b=AiocLc8ma8wlr2jMW4AteCvPt6gzuTlQcN8t3aPdbbwttb8qNgRwCAQ+9jhTDgR8nA4ZVe9pmNibTqsx4nhnH60/hWdo2gu2/gQJcVjWzxqGw+GPQvEhTpU8Kr/TsYmhzzCZk5Z8pmo0bfPpC3D9o6spduYYN90bACNdoMGbWL2iypfGjLiKT/6r/UDDm3ScvSjH5i5em0xuSnne6uhhhDw4iRwxbzF293g5Q56uO8/2pe8mgaqn4wmt5fI+MeLgcIMzWYfUs7II3HJWtvLT+kflpUZz+7QR6knSFi82g3/VGdbUP2tK+Z7upUYsbaUJuHHxOUsxSBcu3ZzEIUlyCA== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1782738444; c=relaxed/relaxed; bh=y2rxNMcGBVERUB0xF8QBo+X+2UWtMpQIiDO4vuKAX14=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DM5Y9cbxwZf0BdOM1UuvDT/1YxR9aNgNPv3r0Ty+nwGnSzngTk726eUH/ScCizoDsyfWreb/JE52TdZGEhMtfmbInXDPXKx9ia9lziVcQX9+Qjt6GYMRjdh1GgWWQZXcIM073S2uM3zxPnbVL5fGSs0MQXLTTuAchIxobXQttQUujEE6FEP+CitxL4b2yoho+8IBDLgM+A/UeNUcVDyjoz3O9UwcnHJKaNeOKHns0FV8lANxkgLl4Ke3qFMVyN/+2NbXFJtndYEA0j1suhj9I1KVmP+AfNfnGTC3n05ZrOPrfvjdAI/PUep+Tb/6hXRCT5OuYGDX4Dz7sbdG6Zr9eA== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; dkim=pass (1024-bit key; unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=uYgu3UfW; dkim-atps=neutral; spf=pass (client-ip=113.46.200.217; helo=canpmsgout02.his.huawei.com; envelope-from=ruanjinjie@huawei.com; receiver=lists.ozlabs.org) smtp.mailfrom=huawei.com Authentication-Results: lists.ozlabs.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=huawei.com header.i=@huawei.com header.a=rsa-sha256 header.s=dkim header.b=uYgu3UfW; dkim-atps=neutral Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=huawei.com (client-ip=113.46.200.217; helo=canpmsgout02.his.huawei.com; envelope-from=ruanjinjie@huawei.com; receiver=lists.ozlabs.org) Received: from canpmsgout02.his.huawei.com (canpmsgout02.his.huawei.com [113.46.200.217]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4gpmlb4N6bz2ydn for ; Mon, 29 Jun 2026 23:07:23 +1000 (AEST) dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=y2rxNMcGBVERUB0xF8QBo+X+2UWtMpQIiDO4vuKAX14=; b=uYgu3UfWdnRZOQyVdMpV/f/i7+qFPm534ba8WeKtTwDLdknxr+v38yCdBqgJDbr5T97LlAyiO 36HFiLpYTA5urvpW5Pve2SadknLYr45ROIKEL39p7hlgAfeRUbHYeYImN1vgaiI7CWGhaUZBHiK c0F9f3yI5f7bThtPms8OVmk= Received: from mail.maildlp.com (unknown [172.19.162.144]) by canpmsgout02.his.huawei.com (SkyGuard) with ESMTPS id 4gpmYP2GnQzcbN3; Mon, 29 Jun 2026 20:58:33 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id 472BC40538; Mon, 29 Jun 2026 21:07:20 +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; Mon, 29 Jun 2026 21:07:16 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v16 10/18] arm64: ptrace: Extract syscall_exit_to_user_mode_work() helper Date: Mon, 29 Jun 2026 21:06:08 +0800 Message-ID: <20260629130616.642022-11-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20260629130616.642022-1-ruanjinjie@huawei.com> References: <20260629130616.642022-1-ruanjinjie@huawei.com> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.90.53.73] X-ClientProxiedBy: kwepems500001.china.huawei.com (7.221.188.70) To dggpemf500011.china.huawei.com (7.185.36.131) In preparation for moving arm64 over to the generic entry code, extract the core syscall exit tracing logic into a new inline helper, syscall_exit_to_user_mode_work(). This new helper encapsulates the thread flags retrieval and syscall exit processing, unifying the exit invocation paths across both the fast-path bailout block and the slow-path trace_exit fallback in el0_svc_common(). This restructuring significantly streamlines the architecture for the upcoming transition to the generic entry framework. No functional changes. Cc: Mark Rutland Cc: Will Deacon Cc: Catalin Marinas Cc: Ada Couprie Diaz 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 8205af0be612..72461c22bb5e 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 syscall_trace_enter(struct pt_regs *regs, unsigned long flags); void syscall_exit_work(struct pt_regs *regs, unsigned long flags); +static __always_inline void syscall_exit_to_user_mode_work(struct pt_regs *regs) +{ + unsigned long flags = read_thread_flags(); + + syscall_exit_work(regs, flags); +} + #endif /* __ASM_SYSCALL_H */ diff --git a/arch/arm64/kernel/syscall.c b/arch/arm64/kernel/syscall.c index f6e9aa132b09..6de1fe281d61 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_exit_work(regs, flags); - } + if (has_syscall_work(flags) || flags & _TIF_SINGLESTEP) + syscall_exit_to_user_mode_work(regs); return; } trace_exit: - flags = read_thread_flags(); - syscall_exit_work(regs, flags); + syscall_exit_to_user_mode_work(regs); } void do_el0_svc(struct pt_regs *regs) -- 2.34.1