From nobody Tue Feb 10 06:42:55 2026 Received: from canpmsgout03.his.huawei.com (canpmsgout03.his.huawei.com [113.46.200.218]) (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 CDF2031B107; Mon, 22 Dec 2025 11:48:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=113.46.200.218 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766404113; cv=none; b=iITUN70Ais2QSLBZ1NPsCJl1FWysmu0hhKL3WwkY89pqQBii65JWqW0iO2XPkY+0NbFlURvI8nZtphh28S0yLFjTs9SQci+r9Zk2CmBkNCic18o4i9Wv9cJTLojhzQfb5oG+4bsKhNhstxZFWjJTb5zsSo3g5HuTStqezH0qH+w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1766404113; c=relaxed/simple; bh=UePzw26qataYVvLMTJVkXv3NkgN0Y1bkDcjs9OZBItU=; h=From:To:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HUzILbCmK6tiEqu6+8tmxjSiMDxmlU5+BIUi1rjYydWVNxg9WWdLiLSeK5N6JxIBfBsa7RV+PXKSxyDkh8Bt13f4pipU2nwhVMFL4FYftNIH9EOhg3vOIobV9zdkGvf1O3JPo1HWCAQ/7wAXLEivWxmzUKDN4wpdOMj5DpUdb3o= 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=xPs06yj3; arc=none smtp.client-ip=113.46.200.218 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="xPs06yj3" dkim-signature: v=1; a=rsa-sha256; d=huawei.com; s=dkim; c=relaxed/relaxed; q=dns/txt; h=From; bh=sde7CMqad4MudR5Jd+IXLkECaEABP+JRMCA+DT9KOB4=; b=xPs06yj3mTcRkpRgDd4jfclYERlGEN3F/fY0JBYc3/FMKcu+f2TeRWGEqH0q0671TTazyV1r7 IPLOb/3Y84yNtv9mujOunZJlLkKoovplXrrC0iiesidcfjqpgBO0+5Savo4Ob+0118AnXeF2K3x D6ewwjWohJ/p12Kd6cx23jc= Received: from mail.maildlp.com (unknown [172.19.162.197]) by canpmsgout03.his.huawei.com (SkyGuard) with ESMTPS id 4dZbtR5M9SzpSy3; Mon, 22 Dec 2025 19:45:35 +0800 (CST) Received: from dggpemf500011.china.huawei.com (unknown [7.185.36.131]) by mail.maildlp.com (Postfix) with ESMTPS id DF0D940363; Mon, 22 Dec 2025 19:48:28 +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, 22 Dec 2025 19:48:27 +0800 From: Jinjie Ruan To: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: [PATCH v10 11/16] entry: Split syscall_exit_to_user_mode_work() for arch reuse Date: Mon, 22 Dec 2025 19:47:32 +0800 Message-ID: <20251222114737.1334364-12-ruanjinjie@huawei.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20251222114737.1334364-1-ruanjinjie@huawei.com> References: <20251222114737.1334364-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: quoted-printable X-ClientProxiedBy: kwepems100001.china.huawei.com (7.221.188.238) To dggpemf500011.china.huawei.com (7.185.36.131) Content-Type: text/plain; charset="utf-8" In the generic entry code, the beginning of syscall_exit_to_user_mode_work() can be reused on arm64 so it makes sense to split it. In preparation for moving arm64 over to the generic entry code, split out syscall_exit_to_user_mode_work_prepare() helper from syscall_exit_to_user_mode_work(). No functional changes. Reviewed-by: Kevin Brodsky Reviewed-by: Thomas Gleixner Signed-off-by: Jinjie Ruan --- include/linux/entry-common.h | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h index 87efb38b7081..0de0e60630e1 100644 --- a/include/linux/entry-common.h +++ b/include/linux/entry-common.h @@ -121,20 +121,11 @@ static __always_inline long syscall_enter_from_user_m= ode(struct pt_regs *regs, l */ void syscall_exit_work(struct pt_regs *regs, unsigned long work); =20 -/** - * syscall_exit_to_user_mode_work - Handle work before returning to user m= ode - * @regs: Pointer to currents pt_regs - * - * Same as step 1 and 2 of syscall_exit_to_user_mode() but without calling - * exit_to_user_mode() to perform the final transition to user mode. - * - * Calling convention is the same as for syscall_exit_to_user_mode() and it - * returns with all work handled and interrupts disabled. The caller must - * invoke exit_to_user_mode() before actually switching to user mode to - * make the final state transitions. Interrupts must stay disabled between - * return from this function and the invocation of exit_to_user_mode(). +/* + * Syscall specific exit to user mode preparation. Runs with interrupts + * enabled. */ -static __always_inline void syscall_exit_to_user_mode_work(struct pt_regs = *regs) +static __always_inline void syscall_exit_to_user_mode_work_prepare(struct = pt_regs *regs) { unsigned long work =3D READ_ONCE(current_thread_info()->syscall_work); unsigned long nr =3D syscall_get_nr(current, regs); @@ -155,6 +146,24 @@ static __always_inline void syscall_exit_to_user_mode_= work(struct pt_regs *regs) */ if (unlikely(work & SYSCALL_WORK_EXIT)) syscall_exit_work(regs, work); +} + +/** + * syscall_exit_to_user_mode_work - Handle work before returning to user m= ode + * @regs: Pointer to currents pt_regs + * + * Same as step 1 and 2 of syscall_exit_to_user_mode() but without calling + * exit_to_user_mode() to perform the final transition to user mode. + * + * Calling convention is the same as for syscall_exit_to_user_mode() and it + * returns with all work handled and interrupts disabled. The caller must + * invoke exit_to_user_mode() before actually switching to user mode to + * make the final state transitions. Interrupts must stay disabled between + * return from this function and the invocation of exit_to_user_mode(). + */ +static __always_inline void syscall_exit_to_user_mode_work(struct pt_regs = *regs) +{ + syscall_exit_to_user_mode_work_prepare(regs); local_irq_disable_exit_to_user(); syscall_exit_to_user_mode_prepare(regs); } --=20 2.34.1