Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796099097; b=LtFxRsrc4J9kJn/IkcDuNFGxSZie9dIMvwVy9ilQAyf2YvgaWXBarVPLv7iqgXg6Aifz JWEL27JsihyfVxrn8hgSk+W7kJXzEObCovyqXW5eUV7gchuQDGqYcGDgeRpN65NqY/LM4 tiaeyj93PoOu21MmgeN0I6RQtu6WcEMJbYhnE4bIyOaujq0nQGgovjuOmJtyG340JiqNz nNM6dLZO/AGjue2fbERBekRqYY1kuna/aEPgJPCvgO2/No8fYQV6231fEofQkDaS/G4bY NIgn+x0M0MZcjG6ID6J66u6FLpT1ngyKDpN9uWblNye9LyUU27ZTzuFmVcM/IotHDJg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796099097; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=02EoNYzm02/bgARBBVzIhOL2s122D3CcCKO90ckJYg4=; b=XffRIT6uwIWOfixv6GTAu72/cPvHfPWgUV09/R0Is79cIPSdYASTwmSH8UC9JSq88tEd R2o2GmtT1nUahUbjlkfPj4cp2SWHIcUTO1LGCmKSCzI+uX5rLscOsuXtFW5T5Q4QRnJxB 64w+q0CUnb+BJ/Qc91gzUPg24fLA71S/6cKC0Y8p7i2gv3/1ctStlyGYo4mupSiZScDuY vzUY/Up9KTmvMKRf2QNBGCAahH7l4sTPMRaF3Z663w8Yf7WJvSTX5/DMkmHkd62b39gjU km7XIHyqS1fbqB52tIpljceLrTsm9lrwAqI0VeB8Zwk6BpYvykYdz/r6kwYRYm4mvDg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b="FXNqXvo/"; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (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 C4BDA606A320; Tue, 1 Dec 2026 04:24:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FXNqXvo/ Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37E9C1F00927; Tue, 1 Dec 2026 04:24:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796099097; bh=02EoNYzm02/bgARBBVzIhOL2s122D3CcCKO90ckJYg4=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=FXNqXvo/sakV6sB/viRSH4HiRzimUgzet5eqUcgFPr4W1NurDzbfCsqXzsutIQTH+ cljn26KVD4RmJS5dy4klPzOGJT2Tui6ggC0NAQTRwfI35neCh2iqvdO2uOFx8o1/Wq xhEPB4TJnhaitZDcfTGF/GQ7T9K4W0t5QoWJoYMdB9sohxS20DSO153BUJ661FFqvZ 5vmXAuXwMUnraYp1jGTYjGHce7eGwG2UUcm3WQ8M6D1VxrTRKRoprQnTPkNEzvxrzY co/IhiAMQR0NwZiuRnyQ1mU4b3HkSJj65rrdCgpwQwfHu7BShoxuVlL8GvL4+k1UVr XhoqCuHVDcJCw== From: Song Liu To: linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, live-patching@vger.kernel.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, bpf@vger.kernel.org Cc: rostedt@goodmis.org, mhiramat@kernel.org, mark.rutland@arm.com, peterz@infradead.org, tglx@kernel.org, frederic@kernel.org, paulmck@kernel.org, catalin.marinas@arm.com, will@kernel.org, maddy@linux.ibm.com, mpe@ellerman.id.au, npiggin@gmail.com, chleroy@kernel.org, pjw@kernel.org, palmer@dabbelt.com, aou@eecs.berkeley.edu, alex@ghiti.fr, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, ojeda@kernel.org, kernel-team@meta.com, Song Liu Subject: [PATCH v3 09/22] arm64: Mark the preempt count helpers notrace Date: Mon, 30 Nov 2026 20:21:48 -0800 Message-ID: <20261201042201.3199928-10-song@kernel.org> X-Mailer: git-send-email 2.53.1 In-Reply-To: <20261201042201.3199928-1-song@kernel.org> References: <20261201042201.3199928-1-song@kernel.org> X-Mailing-List: bpf@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 ftrace_test_recursion_trylock() reads preempt_count() to find the current context, and preempt_disable_notrace() and preempt_enable_notrace() use __preempt_count_add(), __preempt_count_sub(), __preempt_count_dec_and_test() and should_resched(). On arm64 these are plain inline functions. If the compiler emits one of them out of line, that copy is untraced only because inline implies notrace, and tracing it would recurse before the recursion check takes effect. Mark them, and preempt_count_set(), notrace explicitly. The x86 and generic versions are __always_inline. No functional change. Assisted-by: Claude:claude-opus-5 Signed-off-by: Song Liu --- arch/arm64/include/asm/preempt.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm64/include/asm/preempt.h b/arch/arm64/include/asm/preempt.h index 75a592b7f47f..d371e09c1521 100644 --- a/arch/arm64/include/asm/preempt.h +++ b/arch/arm64/include/asm/preempt.h @@ -7,12 +7,12 @@ #define PREEMPT_NEED_RESCHED BIT(32) #define PREEMPT_ENABLED (PREEMPT_NEED_RESCHED) -static inline int preempt_count(void) +static inline int notrace preempt_count(void) { return READ_ONCE(current_thread_info()->preempt.count); } -static inline void preempt_count_set(u64 pc) +static inline void notrace preempt_count_set(u64 pc) { /* Preserve existing value of PREEMPT_NEED_RESCHED */ WRITE_ONCE(current_thread_info()->preempt.count, pc); @@ -41,14 +41,14 @@ static inline bool test_preempt_need_resched(void) return !current_thread_info()->preempt.need_resched; } -static inline void __preempt_count_add(int val) +static inline void notrace __preempt_count_add(int val) { u32 pc = READ_ONCE(current_thread_info()->preempt.count); pc += val; WRITE_ONCE(current_thread_info()->preempt.count, pc); } -static inline void __preempt_count_sub(int val) +static inline void notrace __preempt_count_sub(int val) { u32 pc = READ_ONCE(current_thread_info()->preempt.count); pc -= val; @@ -75,13 +75,13 @@ static inline int __preempt_count_sub_return(int val) return pc; } -static inline bool should_resched(int preempt_offset) +static inline bool notrace should_resched(int preempt_offset) { u64 pc = READ_ONCE(current_thread_info()->preempt_count); return unlikely(pc == preempt_offset); } -static inline bool __preempt_count_dec_and_test(void) +static inline bool notrace __preempt_count_dec_and_test(void) { /* * We must load the combined 'preempt_count' after decrementing -- 2.53.1-Meta