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=1796099046; b=Yfz9rqM3Hkd6UEHJ99QiTPDKofQvYwWERs599C0RZvjni4VAsOHWpsw4UzsyTY0HHCl4 0NFKJzdi3yKFeW5eq3l9jIVV0/PzZf9gBkDmV5/we8ESukkmTNBKlb85EUM0fsZS5szB6 5m0UIxYLJKWPwWx6yfTDV+oSyGqkv5jCpolk/w1kNl1Egprcvs1phQ/Pzcx+RTzjX/+/w 1BPFxjDPzpoPsovAK16Dl4RrVJoR0h6ynRyxG4tfcFI/ikJebIfp4wTviQd4LhRqkehjq xVL6Z6u/OwcjadYF1RVhW2PsJe9El3n9hra416TP09sIse8Lz3V9Ytc/U9JsFSErJlQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796099046; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=5T+8kRpO/uGsVfQ7SqzTlMzFoLzB89EeybcSckVqY/0=; b=ABSGvOmdN2WFjOWqkMXxi7CRewGH4oaPuXCvEMvh+fO74N/hV2GEjRk9SN8xmuXRECbG GgXSW+y0Rsd4Kh79oGiDbvpx5aEgcowYeF/QXtljLRwVs6lP5kKcjt3YN9E0UBzgM1XyT XupqNE9FvQAL5wJ2w7T5yjfYXFPxkKocUxmrEhmquoepstdqOo3XNCNRQzu2YVV2STbR4 VCaw5CE+yMs9Z4vbKRRtMpO20gE28Kp+BPqjGyuwCV4xgckfcKbv1RUULn94/hySCPRDL jwd6wPMS1AlMbsdO4hwUlHINVeI4ssnpBU2pl308DDRQjAb8QKoOxHxn32r9sfrlmnQ== 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=fVN2cVyw; 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 6266D606A32C; Tue, 1 Dec 2026 04:24:06 +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=fVN2cVyw Received: by smtp.kernel.org (Postfix) with ESMTPSA id BF3761F00924; Tue, 1 Dec 2026 04:23:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796099046; bh=5T+8kRpO/uGsVfQ7SqzTlMzFoLzB89EeybcSckVqY/0=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=fVN2cVywFLXvb+5tYzEwfKQTJa6v7uF2YJMZcEXcG0wFeNBgEvZb9fFPAmnIII/Xw i6DlwiS/6QVhKP1GGjoUxXY8j5EBnHlpW8ZG/tTXrDmw4h257/rJXt3odQCe7fQjYQ dm+dwQJ7ghJ01dogR6E+7dNUmetkS2k3XRkX8BznY4lLHVsLiMnfOY0e0AdOQY0JkM nkVT6uZJnSg+wep8JpRfj3XrtmJaenVgiQH+n6GtsqgeH2cL9HvGosEjEDmz0YEhnz sU7DeWOtbrk0Get4gF93ATlVQlmzlREaDm951QOz6FZWo3kv+UGN3jjEO3BEY1SdxC f2C3R5zGjlSRw== 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 06/22] u64_stats: Mark the update helpers used by BPF notrace Date: Mon, 30 Nov 2026 20:21:45 -0800 Message-ID: <20261201042201.3199928-7-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 bpf_prog_inc_misses_counter() is notrace because it runs when a BPF program was not run due to recursion. If it could call traced code, an fentry program attached to that code would recurse forever. It calls u64_stats_update_begin_irqsave(), u64_stats_inc() and u64_stats_update_end_irqrestore(). The BPF trampoline calls u64_stats_add() and u64_stats_inc() from __update_prog_stats() in the same way. These are plain inline helpers, so an out-of-line copy is untraced only because inline implies notrace. Mark these helpers, and the __u64_stats_*() helpers they call, notrace explicitly. No functional change. Assisted-by: Claude:claude-opus-5 Signed-off-by: Song Liu --- include/linux/u64_stats_sync.h | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/include/linux/u64_stats_sync.h b/include/linux/u64_stats_sync.h index f47cf4d78ad7..06e5bffd0287 100644 --- a/include/linux/u64_stats_sync.h +++ b/include/linux/u64_stats_sync.h @@ -92,7 +92,7 @@ static inline void u64_stats_set(u64_stats_t *p, u64 val) local64_set(&p->v, val); } -static inline void u64_stats_add(u64_stats_t *p, unsigned long val) +static inline void notrace u64_stats_add(u64_stats_t *p, unsigned long val) { local64_add(val, &p->v); } @@ -102,16 +102,16 @@ static inline void u64_stats_sub(u64_stats_t *p, s64 val) local64_sub(val, &p->v); } -static inline void u64_stats_inc(u64_stats_t *p) +static inline void notrace u64_stats_inc(u64_stats_t *p) { local64_inc(&p->v); } static inline void u64_stats_init(struct u64_stats_sync *syncp) { } -static inline void __u64_stats_update_begin(struct u64_stats_sync *syncp) { } -static inline void __u64_stats_update_end(struct u64_stats_sync *syncp) { } -static inline unsigned long __u64_stats_irqsave(void) { return 0; } -static inline void __u64_stats_irqrestore(unsigned long flags) { } +static inline void notrace __u64_stats_update_begin(struct u64_stats_sync *syncp) { } +static inline void notrace __u64_stats_update_end(struct u64_stats_sync *syncp) { } +static inline unsigned long notrace __u64_stats_irqsave(void) { return 0; } +static inline void notrace __u64_stats_irqrestore(unsigned long flags) { } static inline unsigned int __u64_stats_fetch_begin(const struct u64_stats_sync *syncp) { return 0; @@ -145,7 +145,7 @@ static inline void u64_stats_set(u64_stats_t *p, u64 val) p->v = val; } -static inline void u64_stats_add(u64_stats_t *p, unsigned long val) +static inline void notrace u64_stats_add(u64_stats_t *p, unsigned long val) { p->v += val; } @@ -155,7 +155,7 @@ static inline void u64_stats_sub(u64_stats_t *p, s64 val) p->v -= val; } -static inline void u64_stats_inc(u64_stats_t *p) +static inline void notrace u64_stats_inc(u64_stats_t *p) { p->v++; } @@ -166,19 +166,19 @@ static inline void u64_stats_inc(u64_stats_t *p) seqcount_init(&__s->seq); \ } while (0) -static inline void __u64_stats_update_begin(struct u64_stats_sync *syncp) +static inline void notrace __u64_stats_update_begin(struct u64_stats_sync *syncp) { preempt_disable_nested(); write_seqcount_begin(&syncp->seq); } -static inline void __u64_stats_update_end(struct u64_stats_sync *syncp) +static inline void notrace __u64_stats_update_end(struct u64_stats_sync *syncp) { write_seqcount_end(&syncp->seq); preempt_enable_nested(); } -static inline unsigned long __u64_stats_irqsave(void) +static inline unsigned long notrace __u64_stats_irqsave(void) { unsigned long flags; @@ -186,7 +186,7 @@ static inline unsigned long __u64_stats_irqsave(void) return flags; } -static inline void __u64_stats_irqrestore(unsigned long flags) +static inline void notrace __u64_stats_irqrestore(unsigned long flags) { local_irq_restore(flags); } @@ -213,7 +213,7 @@ static inline void u64_stats_update_end(struct u64_stats_sync *syncp) __u64_stats_update_end(syncp); } -static inline unsigned long u64_stats_update_begin_irqsave(struct u64_stats_sync *syncp) +static inline unsigned long notrace u64_stats_update_begin_irqsave(struct u64_stats_sync *syncp) { unsigned long flags = __u64_stats_irqsave(); @@ -221,8 +221,8 @@ static inline unsigned long u64_stats_update_begin_irqsave(struct u64_stats_sync return flags; } -static inline void u64_stats_update_end_irqrestore(struct u64_stats_sync *syncp, - unsigned long flags) +static inline void notrace u64_stats_update_end_irqrestore(struct u64_stats_sync *syncp, + unsigned long flags) { __u64_stats_update_end(syncp); __u64_stats_irqrestore(flags); -- 2.53.1-Meta