From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f52.google.com (mail-qv1-f52.google.com [209.85.219.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DB5933ECBC2 for ; Thu, 19 Mar 2026 16:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.219.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773937147; cv=none; b=msR467uKH0hcHqXbImCn4T5KLtkviqOe53ZxFoDSCzQlGhlZ8HZTC4mOfbPhTgxXrlEVGxSp2vPAU/+sGjFquBJr21VLLaF1fmL0E/Ek1yJHjDsMYbkD4Gz4qMPGTEfLR4H0CA5tl8RbPG0AcBtRc8z4CrPLV+MLQSzPQUPwuvI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1773937147; c=relaxed/simple; bh=9IupZK1aSPF3j6Is7WHGatau6bo9ijtXvxM6V0JcIOk=; h=Mime-Version:Content-Type:Date:Message-Id:Cc:Subject:From:To: References:In-Reply-To; b=DwvS8HJlsLI1c0DcdObZmcrzrEW0iva+RxbFlEntOfi99LuXqnTN6LpSPxJ1A7W9h438t2aFxy+HGjseev8YCgLGLTICOVRzNauNZRpkolSVvWsMTy/L/HkTyWImXbJ/lTKT2SrcSIalwlREUZrbThUGcsGYwDQIYmINvYN459I= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=etsalapatis.com; spf=pass smtp.mailfrom=etsalapatis.com; dkim=pass (2048-bit key) header.d=etsalapatis-com.20230601.gappssmtp.com header.i=@etsalapatis-com.20230601.gappssmtp.com header.b=bR/3FVE3; arc=none smtp.client-ip=209.85.219.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=etsalapatis.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=etsalapatis.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=etsalapatis-com.20230601.gappssmtp.com header.i=@etsalapatis-com.20230601.gappssmtp.com header.b="bR/3FVE3" Received: by mail-qv1-f52.google.com with SMTP id 6a1803df08f44-89c6f61020cso16432606d6.0 for ; Thu, 19 Mar 2026 09:19:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=etsalapatis-com.20230601.gappssmtp.com; s=20230601; t=1773937140; x=1774541940; darn=vger.kernel.org; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=rXVPxAJl22yrm0f6eePf2hpwyjNEEoD/G0yxYr/XfRU=; b=bR/3FVE3hvjM1meBd6Ue3Tq6n4VepIh9HyrYYEB1GRCWtrF3SNC/f6ZrTNbBug5shz dddLhvnxRS59scTFQ2lrA+9/ENBLik35rsHZYpcQRwIunNtjwBddLCAy7G2JXgzl3jII gAE8exQPec1Vryidqww/JWvwmeUH10Jcjx43g7rdXAeZlz3hFuGYmG52XRL3PWU1oUcW N2GhmCY28miORq0Fj2sxoR0WqieibfgjVi/2yqBqDNGtNLOSy+HMRMAAW48iSZY3s0cZ LpOpV8X/4QKZLAEYBRxMv5epTLf7CX8MF7C8fPDoepn8vKALGZIwlKeUiuQVXQSlSpM2 KEQw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1773937140; x=1774541940; h=in-reply-to:references:to:from:subject:cc:message-id:date :content-transfer-encoding:mime-version:x-gm-gg:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=rXVPxAJl22yrm0f6eePf2hpwyjNEEoD/G0yxYr/XfRU=; b=KKYJn+RhEbg4q/gr+jekN5n6XZxL8FOcLE1MLSyDlocMzAjCtaOSQWCAvA3rPtHQQK SDdI1tIWZMaguCGEfkkCt2AGZ4Xrkjs9T2lrYRyEgM37sDoXhTbMlcnhbmN0fO0/etZe 3KOAFMKe24iurmIq6ETChyXFuDkVHnQxyykeTA/UJF3Pgy+/8xSwBTWLwHjSDdAuBdcb N20HwBiPdTuafiUDxlZUbXHVGhZuby6jI8ksHikhtHh2UDyAopib4qZKkT1HMBm/6NDq k/A6vEZQy8Wbdhu0ofFQTeM9z0mm8poIlUe9XhQNXzKJ/vZ0j/AhKKBLk671a6qTn8ax QnXw== X-Forwarded-Encrypted: i=1; AJvYcCX/RBle0a7MlNINSzWNEhuXqlX5IbDxHurjBs5Sm1jtoJ39pZ0+dbxhRNn1R4qCjfvAZqXKcmrmGcOyGQg=@vger.kernel.org X-Gm-Message-State: AOJu0Ywe1uHc/vLiS2ammMDWQAhhl5yiOU5ErEBVjllo+CZaxs/9joVb AmvWFk0a+cbY51nKvyS9+ihIXnmqOAYacDWGWBggEqhH9GeB0XP8OwL7QQS5jdBMDlE= X-Gm-Gg: ATEYQzwlgsWMnNuvSP9IBolLiQmist+tB1E6+proaq5Ssprp+M6rIMb5+qBlYdC7jNi BIBBuuzTGwUIw4UG3/3OLXUdjvPjRG4MP+t590+2WZuOHSHgxbcy2bAV9ubkj1/9g7PQDJA3OcZ D66VfTsi7EVDixw+HtxLXnj7cAie6dE1MCJF3IbGpnMuZkWZ2GjWq2lFmhYczKlM6YeYcl2xGjM laprPEmwUb/COxrKSTqmMbCr+f8K+Hlqt46fmBDDLpUYlLx65tHy3b4US+WCqmJiLhpcnsctNMw 3neTPtQubu1ZiSUyrSYhEE4Irlb1niaAVoWSlSdNvAcOJKJVpPI0uf/8VRfrrou2lM2YK7f22t9 xgCZ5dCpIBGlsKoRzDNzKWfywYPMU52BCH71m5pyGgU3q3eDfoo1l9PJ2b0RhNk1gFqCt+8+3UY geOnpsSBlqFybG9P3DUueAoeoFJ7+wmq/yZw== X-Received: by 2002:a05:6214:5a08:b0:894:5d38:2e38 with SMTP id 6a1803df08f44-89c7744cebfmr62010866d6.18.1773937140278; Thu, 19 Mar 2026 09:19:00 -0700 (PDT) Received: from localhost ([140.174.219.137]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-89c6b9ce2f2sm56059786d6.32.2026.03.19.09.18.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 19 Mar 2026 09:18:59 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Thu, 19 Mar 2026 12:18:58 -0400 Message-Id: Cc: , Subject: Re: [PATCH bpf-next v8 0/8] bpf: Extend the bpf_list family of APIs From: "Emil Tsalapatis" To: "Chengkaitao" , , , , , , , , , , , , , , , X-Mailer: aerc 0.20.1 References: <20260316112843.78657-1-pilgrimtao@gmail.com> In-Reply-To: <20260316112843.78657-1-pilgrimtao@gmail.com> On Mon Mar 16, 2026 at 7:28 AM EDT, Chengkaitao wrote: > From: Kaitao Cheng > > In BPF, a list can only be used to implement a stack structure. > Due to an incomplete API set, only FIFO or LIFO operations are > supported. The patches enhance the BPF list API, making it more > list-like. > > Five new kfuncs have been added: > bpf_list_del: remove a node from the list > bpf_list_add_impl: insert a node after a given list node > bpf_list_is_first: check if a node is the first in the list > bpf_list_is_last: check if a node is the last in the list > bpf_list_empty: check if the list is empty > > refactor kfunc checks to table-driven approach, and add test cases for > the aforementioned kfuncs. > By the way,=20 https://sashiko.dev/#/message/20260316112843.78657-1-pilgrimtao%40gmail.com has some additional feedback apart from those of the list bot. > Changes in v8: > - Use [patch v7 5/5] as the start of the patch series > - Introduce double pointer prev_ptr in __bpf_list_del > - Extract refactored __bpf_list_del/add into separate patches > - Allow bpf_list_front/back result as the prev argument of bpf_list_add > - Split test cases > > Changes in v7: > - Replace bpf_list_node_is_edge with bpf_list_is_first/is_last > - Reimplement __bpf_list_del and __bpf_list_add > - Simplify test cases > > Changes in v6: > - Merge [patch v5 (2,4,6)/6] into [patch v6 4/5] > - If list_head was 0-initialized, init it > - refactor kfunc checks to table-driven approach > > Changes in v5: > - Fix bpf_obj leak on bpf_list_add_impl error > > Changes in v4: > - [patch v3 1/6] Revert to version v1 > - Change the parameters of bpf_list_add_impl to (head, new, prev, ...) > > Changes in v3: > - Add a new lock_rec member to struct bpf_reference_state for lock > holding detection. > - Add test cases to verify that the verifier correctly restricts calls > to bpf_list_del when the spin_lock is not held. > > Changes in v2: > - Remove the head parameter from bpf_list_del > - Add bpf_list_add/is_first/is_last/empty to API and test cases > > Link to v7: > https://lore.kernel.org/all/20260308134614.29711-1-pilgrimtao@gmail.com/ > > Link to v6: > https://lore.kernel.org/all/20260304143459.78059-1-pilgrimtao@gmail.com/ > > Link to v5: > https://lore.kernel.org/all/20260304031606.43884-1-pilgrimtao@gmail.com/ > > Link to v4: > https://lore.kernel.org/all/20260303135219.33726-1-pilgrimtao@gmail.com/ > > Link to v3: > https://lore.kernel.org/all/20260302124028.82420-1-pilgrimtao@gmail.com/ > > Link to v2: > https://lore.kernel.org/all/20260225092651.94689-1-pilgrimtao@gmail.com/ > > Link to v1: > https://lore.kernel.org/all/20260209025250.55750-1-pilgrimtao@gmail.com/ > > Kaitao Cheng (8): > bpf: refactor kfunc checks using table-driven approach in verifier > bpf: refactor __bpf_list_del to take list node pointer > bpf: Introduce the bpf_list_del kfunc. > bpf: refactor __bpf_list_add to take insertion point via **prev_ptr > bpf: Add bpf_list_add_impl to insert node after a given list node > bpf: allow bpf_list_front/back result as the prev argument of > bpf_list_add_impl > bpf: add bpf_list_is_first/last/empty kfuncs > selftests/bpf: Add test cases for > bpf_list_del/add/is_first/is_last/empty > > kernel/bpf/helpers.c | 121 +++++-- > kernel/bpf/verifier.c | 116 +++++-- > .../testing/selftests/bpf/bpf_experimental.h | 16 + > .../selftests/bpf/progs/refcounted_kptr.c | 311 ++++++++++++++++++ > 4 files changed, 519 insertions(+), 45 deletions(-)