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=1796099029; b=g4Jlndwei5pyYy4//YU99zYhg0LKwS8gOhPsV0GDe7h/R5JFW5AS+zThroq2hsj/evb8 WgKuLYjBUkYb8e7e3R2nJHClVg+JtKwuz3/Ee1i3Se/yPW33yhUEM15+VNrj8OcIM7g1k 7Da3LyVKQrbLAwMLmgpXkoFmFmcNoL51l6PR9A/Ty31Cj+1S4194muQ1F99oIxfe22X24 xv9KID3ImWTDSouUiy/GqcUgfRJscnu11v0zNdfCSxAiyLoLweh7+7845GH7AMXwR5hR4 bXumewr/Kulxgf84mouAwvIXk/NjkHUb39x2J3JRFolAPMDv58HM6n26lOWS4vcqbLA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796099029; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=Cc9WP2M7ilCLKH5nq6B51jgpM8ZnJcFzegcnKxUJHBk=; b=5ZqnV+m98TobgtfCT5rwUSga7ikFauMa9oQksQs/spAsLSrg2E3xMWAYj4KStEyzul9i Odf08AO4IfpcX3jPRFUPbVO5YQNssFqNvZOmiLy/NkVcslCPw5vX8tsCTvUaktS02MvAk EzWJ3b99EZLWBwsxxgxsty2XJ76ET2KwhjTVUZGR8lkFYBqhDKPSMeKrYvPHVoBoP/jxX nzez3WIqwlljAB+bNP2hxAbIAldoMG5lwxtE+bLxBFgMGuEyj27wCjOH237h22M4AB/p0 iK8NJgViusoBAsFrRswJZ7Y6Ff/yGZJuqIt3KTWnL2VGWGnmwkjjACb4FbUpVDlknRg== 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=ViAcqhtH; 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 11FB9606A31A; Tue, 1 Dec 2026 04:23:48 +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=ViAcqhtH Received: by smtp.kernel.org (Postfix) with ESMTPSA id A36631F0092A; Tue, 1 Dec 2026 04:23:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796099028; bh=Cc9WP2M7ilCLKH5nq6B51jgpM8ZnJcFzegcnKxUJHBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=ViAcqhtHZOzEp3nFA0WQsr76Xba3iudIe4IjR3WaJrulZyQRut5PLE0hpCgazBGn5 KD2ApPcAY96A8fk8DDcNBONDANddSS7KM00cm5jK1F3NwwJPfbFT30fjBxINk9PK34 V9re/PWwtqWlbj9WlQjJ3gbHuSc/1P6QqWQN9W2ycS8nKUMqWRZ1KKwQ+eYfnTp7Kp qG2CbP69ixjmBBAq5a3qdFc4hbCt4WBEMZYRQN5tjoaIYaM4vwlxlisRY9NtkqJPIw ZTWJRiIzYH6hY5vLr7X0SkA+saY3DCwbr2mDlSlarc969y5F1I75GmIHpSTnob8Qdb jrjuvcjx3oGRQ== 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 05/22] bpf: Mark the bpf_mem_alloc fast path helpers notrace Date: Mon, 30 Nov 2026 20:21:44 -0800 Message-ID: <20261201042201.3199928-6-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 unit_alloc(), unit_free() and unit_free_rcu() are notrace so that BPF programs cannot attach to them and corrupt the per-CPU free lists, as the comment above unit_alloc() says. To take and release c->active and to update the free lists, they call local_inc_return() (local_add_return() on x86), local_dec(), __llist_add() and llist_add(). These are plain inline functions, as are __llist_add_batch() and llist_add_batch(), which the llist helpers call. An out-of-line copy of any of them is untraced only because inline implies notrace. Mark them notrace explicitly. No functional change. Assisted-by: Claude:claude-opus-5 Signed-off-by: Song Liu --- arch/x86/include/asm/local.h | 4 ++-- include/linux/llist.h | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/arch/x86/include/asm/local.h b/arch/x86/include/asm/local.h index 07b1d52e9ab4..e2f5710af4cb 100644 --- a/arch/x86/include/asm/local.h +++ b/arch/x86/include/asm/local.h @@ -22,7 +22,7 @@ static inline void notrace local_inc(local_t *l) : "+m" (l->a.counter)); } -static inline void local_dec(local_t *l) +static inline void notrace local_dec(local_t *l) { asm volatile(_ASM_DEC "%0" : "+m" (l->a.counter)); @@ -103,7 +103,7 @@ static inline bool local_add_negative(long i, local_t *l) * * Atomically adds @i to @l and returns @i + @l */ -static inline long local_add_return(long i, local_t *l) +static inline long notrace local_add_return(long i, local_t *l) { long __i = i; asm volatile(_ASM_XADD "%0, %1" diff --git a/include/linux/llist.h b/include/linux/llist.h index 413249764f7b..bebfaad36818 100644 --- a/include/linux/llist.h +++ b/include/linux/llist.h @@ -231,9 +231,9 @@ static inline struct llist_node *llist_next(struct llist_node *node) * * Return whether list is empty before adding. */ -static inline bool llist_add_batch(struct llist_node *new_first, - struct llist_node *new_last, - struct llist_head *head) +static inline bool notrace llist_add_batch(struct llist_node *new_first, + struct llist_node *new_last, + struct llist_head *head) { struct llist_node *first = READ_ONCE(head->first); @@ -244,9 +244,9 @@ static inline bool llist_add_batch(struct llist_node *new_first, return !first; } -static inline bool __llist_add_batch(struct llist_node *new_first, - struct llist_node *new_last, - struct llist_head *head) +static inline bool notrace __llist_add_batch(struct llist_node *new_first, + struct llist_node *new_last, + struct llist_head *head) { new_last->next = head->first; head->first = new_first; @@ -260,12 +260,12 @@ static inline bool __llist_add_batch(struct llist_node *new_first, * * Returns true if the list was empty prior to adding this entry. */ -static inline bool llist_add(struct llist_node *new, struct llist_head *head) +static inline bool notrace llist_add(struct llist_node *new, struct llist_head *head) { return llist_add_batch(new, new, head); } -static inline bool __llist_add(struct llist_node *new, struct llist_head *head) +static inline bool notrace __llist_add(struct llist_node *new, struct llist_head *head) { return __llist_add_batch(new, new, head); } -- 2.53.1-Meta