From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B2747606A329 for ; Tue, 1 Dec 2026 04:24:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=Rwbw3+NH; dkim=fail reason="signature verification failed" (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=fVN2cVyw DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Unsubscribe-Post:List-Owner; bh=WllegxZ1ptHD15/EFdixDK/PXZC7n9dPSPPT6Xhdcao=; b=Rwbw3+NHwUHLHYdme3TMFFY284 flG6kXiipUlrD5lS57aCD0Ymf9j1G2Ks7/ia7MU/I4Q8m7GyVi3WpK8i9RHQDTRV8At7mgRuPsK8k mdFnVydFyMNez3DOFsyR4io6z8AdZ/E/wfCRht0CFk53StTSPohcfm/wegKHM3lCF6iDljEZazRtP cSXuGMNwq7AAStSVSfXLXJYl1z0tK9xe+mqYPVAdlw5DwulW9rvIbLw2nXnLws5RO5clpgUb7Also dCliIVJ2m916Bz48ys7ovRZE7uUF7GzjvOueIoY83/huvNqm+p+Dz6Sg6QPkPWFB39Ty5obXF0pIl GCOvedFQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYFPg-00000006XMG-2Kmb; Tue, 01 Dec 2026 04:24:20 +0000 Received: from tor.source.kernel.org ([2600:3c04:e001:324:0:1991:8:25]) by bombadil.infradead.org with esmtps (Exim 4.100.1 #2 (Red Hat Linux)) id 1xYFPT-00000006XBc-3161; Tue, 01 Dec 2026 04:24:07 +0000 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by tor.source.kernel.org (Postfix) with ESMTP id 8941F60D27; Tue, 1 Dec 2026 04:24:06 +0000 (UTC) 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-Archived-By: MIME-Version: 1.0 X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv