From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 555DB393DEB for ; Tue, 7 Apr 2026 13:17:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775567851; cv=none; b=P1MZKoqshTYc4l7VRtjxJwiqhT4ofDs8UMWN7RgFDxXGtfNAQNlAozM4eafFIeXQdM07RbnO0dXgALGKf/4HuFs639VAw+Jza2D1RWoPk8iCcNNBAw2vMLBCwkAYT1Bnb8YiLL0WhzSeK+zyvHdXVpYiUMs/u4hDahJBjgEkkBw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775567851; c=relaxed/simple; bh=PnpEGCqDI+7mLHxmW6SNuY7AJrvNh7KFQZ2iYdYu5IY=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=ma+Oo8R3jN117RsW2IBudO80cFG3HcHqzRw7V6RhJrCM/5lNhhKYVywvS9HLBcgwwt4ORrRJDTql9acCzWQCqW6o/dvvEyjXDZ80FWQjT6Bk8UFQr2RdnhOF1H+tkT+Uf0nlfL0MKLc2ghzm/3AXF7LKmpsehg322wW9aH0bEBY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b=goIwi3pN; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.b="goIwi3pN" Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EB7C416F2; Tue, 7 Apr 2026 06:17:23 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id C8ACF3F7D8; Tue, 7 Apr 2026 06:17:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1775567849; bh=PnpEGCqDI+7mLHxmW6SNuY7AJrvNh7KFQZ2iYdYu5IY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=goIwi3pNbLHft1v0o6PDcVBwKRIElAkF/C2v+8yrw7o/8jllrfZHizN6sqfFhCav5 6CKmK0/PJr5biaroT/Rz1K3DdzCFJ4d7p3+6qMCpawcGZ5py0FpOJcXoBV9SGO05ls stXyhRh4t2GbbffxdusJ8XhjZLojzHgURuG2HaAk= From: Mark Rutland To: linux-arm-kernel@lists.infradead.org, Andy Lutomirski , Peter Zijlstra , Thomas Gleixner Cc: ada.coupriediaz@arm.com, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, mark.rutland@arm.com, ruanjinjie@huawei.com, vladimir.murzin@arm.com, will@kernel.org Subject: [PATCH 02/10] entry: Remove local_irq_{enable,disable}_exit_to_user() Date: Tue, 7 Apr 2026 14:16:42 +0100 Message-Id: <20260407131650.3813777-3-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20260407131650.3813777-1-mark.rutland@arm.com> References: <20260407131650.3813777-1-mark.rutland@arm.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 The local_irq_enable_exit_to_user() and local_irq_disable_exit_to_user() functions are never overridden by architecture code, and are always equivalent to local_irq_enable() and local_irq_disable(). These functions were added on the assumption that arm64 would override them to manage 'DAIF' exception masking, as described by Thomas Gleixner in these threads: https://lore.kernel.org/all/20190919150809.340471236@linutronix.de/ https://lore.kernel.org/all/alpine.DEB.2.21.1910240119090.1852@nanos.tec.linutronix.de/ In practice arm64 did not need to override either. Prior to moving to the generic irqentry code, arm64's management of DAIF was reworked in commit: 97d935faacde ("arm64: Unmask Debug + SError in do_notify_resume()") Since that commit, arm64 only masks interrupts during the 'prepare' step when returning to user mode, and masks other DAIF exceptions later. Within arm64_exit_to_user_mode(), the arm64 entry code is as follows: local_irq_disable(); exit_to_user_mode_prepare_legacy(regs); local_daif_mask(); mte_check_tfsr_exit(); exit_to_user_mode(); Remove the unnecessary local_irq_enable_exit_to_user() and local_irq_disable_exit_to_user() functions. Signed-off-by: Mark Rutland Cc: Andy Lutomirski Cc: Catalin Marinas Cc: Jinjie Ruan Cc: Peter Zijlstra Cc: Thomas Gleixner Cc: Vladimir Murzin Cc: Will Deacon --- include/linux/entry-common.h | 2 +- include/linux/irq-entry-common.h | 31 ------------------------------- kernel/entry/common.c | 4 ++-- 3 files changed, 3 insertions(+), 34 deletions(-) diff --git a/include/linux/entry-common.h b/include/linux/entry-common.h index f83ca0abf2cdb..dbaa153100f44 100644 --- a/include/linux/entry-common.h +++ b/include/linux/entry-common.h @@ -321,7 +321,7 @@ static __always_inline void syscall_exit_to_user_mode(struct pt_regs *regs) { instrumentation_begin(); syscall_exit_to_user_mode_work(regs); - local_irq_disable_exit_to_user(); + local_irq_disable(); syscall_exit_to_user_mode_prepare(regs); instrumentation_end(); exit_to_user_mode(); diff --git a/include/linux/irq-entry-common.h b/include/linux/irq-entry-common.h index 3cf4d21168ba1..93b4b551f7ae4 100644 --- a/include/linux/irq-entry-common.h +++ b/include/linux/irq-entry-common.h @@ -100,37 +100,6 @@ static __always_inline void enter_from_user_mode(struct pt_regs *regs) instrumentation_end(); } -/** - * local_irq_enable_exit_to_user - Exit to user variant of local_irq_enable() - * @ti_work: Cached TIF flags gathered with interrupts disabled - * - * Defaults to local_irq_enable(). Can be supplied by architecture specific - * code. - */ -static inline void local_irq_enable_exit_to_user(unsigned long ti_work); - -#ifndef local_irq_enable_exit_to_user -static __always_inline void local_irq_enable_exit_to_user(unsigned long ti_work) -{ - local_irq_enable(); -} -#endif - -/** - * local_irq_disable_exit_to_user - Exit to user variant of local_irq_disable() - * - * Defaults to local_irq_disable(). Can be supplied by architecture specific - * code. - */ -static inline void local_irq_disable_exit_to_user(void); - -#ifndef local_irq_disable_exit_to_user -static __always_inline void local_irq_disable_exit_to_user(void) -{ - local_irq_disable(); -} -#endif - /** * arch_exit_to_user_mode_work - Architecture specific TIF work for exit * to user mode. diff --git a/kernel/entry/common.c b/kernel/entry/common.c index 9ef63e4147913..b5e05d87ba391 100644 --- a/kernel/entry/common.c +++ b/kernel/entry/common.c @@ -47,7 +47,7 @@ static __always_inline unsigned long __exit_to_user_mode_loop(struct pt_regs *re */ while (ti_work & EXIT_TO_USER_MODE_WORK_LOOP) { - local_irq_enable_exit_to_user(ti_work); + local_irq_enable(); if (ti_work & (_TIF_NEED_RESCHED | _TIF_NEED_RESCHED_LAZY)) { if (!rseq_grant_slice_extension(ti_work & TIF_SLICE_EXT_DENY)) @@ -74,7 +74,7 @@ static __always_inline unsigned long __exit_to_user_mode_loop(struct pt_regs *re * might have changed while interrupts and preemption was * enabled above. */ - local_irq_disable_exit_to_user(); + local_irq_disable(); /* Check if any of the above work has queued a deferred wakeup */ tick_nohz_user_enter_prepare(); -- 2.30.2