BPF List
 help / color / mirror / Atom feed
From: Fuyu Zhao <zhaofuyu@vivo.com>
To: bot+bpf-ci@kernel.org, bpf@vger.kernel.org
Cc: eddyz87@gmail.com, andrii.nakryiko@gmail.com,
	alan.maguire@oracle.com, ast@kernel.org, andrii@kernel.org,
	daniel@iogearbox.net, martin.lau@kernel.org,
	yonghong.song@linux.dev, mason@kernel.org,
	ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v6 1/2] libbpf: support selective kernel module BTF loading via bpf_object_open_opts
Date: Tue, 1 Sep 2026 11:55:12 +0800	[thread overview]
Message-ID: <93a27872-13fc-4032-9a2d-895a03455025@vivo.com> (raw)
In-Reply-To: <0d8168d43d5376a1f7cd9cff27658ce299e03993b3c5181883e647ccdc7b506b@mail.kernel.org>



On 8/31/2026 10:46 PM, bot+bpf-ci@kernel.org wrote:
>> diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
>> index b965ad5715403..1cabf7e465546 100644
>> --- a/tools/lib/bpf/libbpf.h
>> +++ b/tools/lib/bpf/libbpf.h
>> @@ -224,10 +224,32 @@ struct bpf_object_open_opts {
>>  	 * point (/sys/fs/bpf), in case this default behavior is undesirable.
>>  	 */
>>  	const char *bpf_token_path;
> 
> [ ... ]
> 
>> +	/*
>> +	 * Optional list of kernel module names whose BTFs should be loaded.
>> +	 * nr_btf_module_names specifies the number of entries in
>> +	 * btf_module_names.
>> +	 *
>> +	 * With btf_module_names:
>> +	 * - when provided, only the BTFs of the specified modules are loaded;
>> +	 * - when an empty list is provided, no module BTFs are loaded;
>> +	 * - when NULL, all module BTFs are loaded as before.
>> +	 *
>> +	 * The list must contain valid, non-empty module names and must not
>> +	 * contain duplicate entries; otherwise -EINVAL is returned.
>> +	 *
>> +	 * This affects:
>> +	 * - BPF CO-RE relocations against types defined in modules;
>> +	 * - BTF-based resolution of attach targets;
>> +	 * - module-qualified tracing multi-attach targets;
>> +	 * - struct_ops kernel type resolution;
>> +	 * - extern (ksym) resolution for kernel symbols defined in modules.
>> +	 */
>> +	const char **btf_module_names;
>> +	size_t nr_btf_module_names;
>                       ^^
> This isn't a bug, but would btf_module_cnt (or just cnt-style naming) fit
> better here? The other opts structs in libbpf.h pair their arrays with a
> cnt field: bpf_kprobe_multi_opts uses cnt, bpf_uprobe_multi_opts uses
> cnt, and bpf_tracing_multi_opts uses cnt. This looks like the only nr_*
> field in the public header, and the field name becomes part of the stable
> public API once it ships.
> 

I agree that a cnt-style name is more consistent here. I won't use
`btf_module_cnt`, though, as it could be confused with
`obj->btf_module_cnt`. I'll use `btf_module_names_cnt` instead to keep
the distinction clear.

>>
>>  	size_t :0;
>>  };
>> -#define bpf_object_open_opts__last_field bpf_token_path
>> +#define bpf_object_open_opts__last_field nr_btf_module_names
> 
> 
> ---
> AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
> See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
> 
> CI run summary: https://github.com/kernel-patches/bpf/actions/runs/33399468751


  reply	other threads:[~2026-09-01  3:55 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-31 13:38 [PATCH bpf-next v6 0/2] libbpf: Improve BPF load performance by selectively loading module BTFs Fuyu Zhao
2026-08-31 13:38 ` [PATCH bpf-next v6 1/2] libbpf: support selective kernel module BTF loading via bpf_object_open_opts Fuyu Zhao
2026-08-31 14:46   ` bot+bpf-ci
2026-09-01  3:55     ` Fuyu Zhao [this message]
2026-08-31 14:46   ` Alan Maguire
2026-09-01  3:15     ` Fuyu Zhao
2026-09-01  7:33       ` Alan Maguire
2026-09-03  0:12   ` Andrii Nakryiko
2026-09-03 12:52     ` Fuyu Zhao
2026-08-31 13:38 ` [PATCH bpf-next v6 2/2] selftests/bpf: add tests for selective module BTF loading Fuyu Zhao
2026-08-31 14:46   ` bot+bpf-ci
2026-09-01  3:56     ` Fuyu Zhao
2026-09-03  0:12   ` Andrii Nakryiko
2026-09-03 12:52     ` Fuyu Zhao

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=93a27872-13fc-4032-9a2d-895a03455025@vivo.com \
    --to=zhaofuyu@vivo.com \
    --cc=alan.maguire@oracle.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bot+bpf-ci@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=eddyz87@gmail.com \
    --cc=ihor.solodrai@linux.dev \
    --cc=martin.lau@kernel.org \
    --cc=mason@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