public inbox for bpf@vger.kernel.org
 help / color / mirror / Atom feed
From: Ihor Solodrai <ihor.solodrai@linux.dev>
To: Chengkaitao <pilgrimtao@gmail.com>,
	Alexei Starovoitov <alexei.starovoitov@gmail.com>,
	Emil Tsalapatis <emil@etsalapatis.com>,
	leon.hwang@linux.dev,
	Mykyta Yatsenko <mykyta.yatsenko5@gmail.com>,
	memxor@gmail.com
Cc: Martin KaFai Lau <martin.lau@linux.dev>,
	Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>, Eduard <eddyz87@gmail.com>,
	Song Liu <song@kernel.org>,
	Yonghong Song <yonghong.song@linux.dev>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	Stanislav Fomichev <sdf@fomichev.me>, Hao Luo <haoluo@google.com>,
	Jiri Olsa <jolsa@kernel.org>, Shuah Khan <shuah@kernel.org>,
	Chengkaitao <chengkaitao@kylinos.cn>,
	"open list:KERNEL SELFTEST FRAMEWORK"
	<linux-kselftest@vger.kernel.org>, bpf <bpf@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH bpf-next v9 1/9] bpf: refactor kfunc checks using table-driven approach in verifier
Date: Thu, 23 Apr 2026 16:25:50 -0700	[thread overview]
Message-ID: <a739cf27-a65a-40da-830d-edda27bfa6b7@linux.dev> (raw)
In-Reply-To: <CAAWJmAZQHmgKXgr0xN5sHWUGyu43xLyg4eG7yBrMDi7YALrKsw@mail.gmail.com>

On 4/9/26 7:53 PM, Chengkaitao wrote:
> On Wed, Apr 8, 2026 at 2:41 AM Ihor Solodrai <ihor.solodrai@linux.dev> wrote:
>>
>> On 4/4/26 3:38 AM, Chengkaitao wrote:
>>>
>>> It pushes us to untangle messy verifier safety cases and make them modular,
>>> so they can be expressed as parameters to BPF_VERIF_KFUNC_DEF
>>
>> Again, I agree with the premise that verifier safety checks could
>> become more modular where possible. But I think we should first
>> separate two questions:
>>
>> 1. What kfunc properties should be declared centrally?
>> 2. Where that declaration should live?
>>
>> While I'd like to answer (1) with "all of them", I am not convinced
>> the answer to (2) is .BTF_ids or BTF. A better C side declarative
>> representation would give us most of the benefit here without making
>> the BTF tooling more complex.
>>
>> Here is how I think we should move forward:
>>
>>   1. Your bpf_list_* work is orthogonal to BTF_ID refactoring, so it's
>>   reasonable to first focus on landing it without changes to generic
>>   kfunc handling.
> 
> There is no consensus on whether the patch below should exist at all.
> [PATCH bpf-next v9 1/9] bpf: refactor kfunc checks using table-driven ...

Hi Kaitao,

I think this refactoring patch should be dropped from the series.
For now use the established pattern with special_kfunc_list, and don't
introduce new _impl kfuncs.

> 
> Should we drop it entirely, or limit its scope to the is_bpf_* helpers
> that contain a large number of btf_id == special_kfunc_list[*]-style
> checks—for example by reverting to v8 or an earlier revision?

I don't think "reverting to v8" will work. Since you've sent v9
significant changes to the verifier.c have been landed, so you have
some rebase work to do anyways.  I suggest you minimize unnecessary
refactoring in this series, and focus on bpf_list_* api extension.

pw-bot: cr

Thanks, and apologies for slow reply.


> https://lore.kernel.org/all/20260316112843.78657-2-pilgrimtao@gmail.com/
> 
> cc: Alexei Starovoitov, Emil Tsalapatis, Leon Hwang, Mykyta Yatsenko,
>       Kumar Kartikeya Dwivedi
> 
>>   2. I plan to send patches (soon) for resolve_btfids, and then for
>>   BTF_ID macrology to eliminate the enum + array pattern. You are
>>   welcome to join the discussion and review / test the patches.
>>
>>   3. After all of the above lands, we can come back to the general
>>   BTF_ID / kfunc handling discussion. If you are interested in
>>   developing this further, I suggest to re-think the approach and come
>>   up with a "single kfunc metadata definition" that doesn't require
>>   significant changes in .BTF_ids section layout.
>>
>> A slightly off-topic comment: the usage of `_impl` pattern for kfuncs
>> should be considered deprecated. Any new kfuncs that work with
>> verifier-supplied arguments should use KF_IMPLICIT_ARGS mechanism.  So
>> the `bpf_list_add_impl` in your seires should only have one version:
>> `bpf_list_add` marked with KF_IMPLICIT_ARGS flag.
> 


  reply	other threads:[~2026-04-23 23:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-29 14:04 [PATCH bpf-next v9 0/9] bpf: Extend the bpf_list family of APIs Chengkaitao
2026-03-29 14:04 ` [PATCH bpf-next v9 1/9] bpf: refactor kfunc checks using table-driven approach in verifier Chengkaitao
2026-03-30 15:20   ` Mykyta Yatsenko
2026-03-30 17:05   ` Alexei Starovoitov
2026-04-03 17:41     ` Chengkaitao
2026-04-04  4:49       ` Ihor Solodrai
2026-04-04 10:38         ` Chengkaitao
2026-04-07 18:40           ` Ihor Solodrai
2026-04-10  2:53             ` Chengkaitao
2026-04-23 23:25               ` Ihor Solodrai [this message]
2026-03-29 14:04 ` [PATCH bpf-next v9 2/9] bpf: refactor __bpf_list_del to take list node pointer Chengkaitao
2026-03-29 14:05 ` [PATCH bpf-next v9 3/9] bpf: clear list node owner and unlink before drop Chengkaitao
2026-03-29 14:45   ` bot+bpf-ci
2026-03-29 14:05 ` [PATCH bpf-next v9 4/9] bpf: Introduce the bpf_list_del kfunc Chengkaitao
2026-03-29 14:05 ` [PATCH bpf-next v9 5/9] bpf: refactor __bpf_list_add to take insertion point via **prev_ptr Chengkaitao
2026-03-29 14:05 ` [PATCH bpf-next v9 6/9] bpf: Add bpf_list_add_impl to insert node after a given list node Chengkaitao
2026-03-29 14:05 ` [PATCH bpf-next v9 7/9] bpf: allow bpf_list_front/back result as the prev argument of bpf_list_add_impl Chengkaitao
2026-03-29 14:05 ` [PATCH bpf-next v9 8/9] bpf: add bpf_list_is_first/last/empty kfuncs Chengkaitao
2026-03-29 14:05 ` [PATCH bpf-next v9 9/9] selftests/bpf: Add test cases for bpf_list_del/add/is_first/is_last/empty Chengkaitao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a739cf27-a65a-40da-830d-edda27bfa6b7@linux.dev \
    --to=ihor.solodrai@linux.dev \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=chengkaitao@kylinos.cn \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=emil@etsalapatis.com \
    --cc=haoluo@google.com \
    --cc=john.fastabend@gmail.com \
    --cc=jolsa@kernel.org \
    --cc=kpsingh@kernel.org \
    --cc=leon.hwang@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=martin.lau@linux.dev \
    --cc=memxor@gmail.com \
    --cc=mykyta.yatsenko5@gmail.com \
    --cc=pilgrimtao@gmail.com \
    --cc=sdf@fomichev.me \
    --cc=shuah@kernel.org \
    --cc=song@kernel.org \
    --cc=yonghong.song@linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox