From: Leon Hwang <leon.hwang@linux.dev>
To: sashiko-reviews@lists.linux.dev
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH bpf-next v10 4/9] libbpf: Add support for global percpu data
Date: Thu, 16 Jul 2026 13:21:46 +0800 [thread overview]
Message-ID: <99de30ad-a221-42f4-b7c7-ef73f68a0116@linux.dev> (raw)
In-Reply-To: <20260715160040.A88481F000E9@smtp.kernel.org>
On 16/7/26 00:00, sashiko-bot@kernel.org wrote:
> Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
> - [Medium] BPF skeleton generation completely omits the `.percpu` map, breaking the promised ergonomic access.
> --
>
> --- Patch [4]: [PATCH bpf-next v10 4/9] libbpf: Add support for global percpu data ---
> (Note: The format of this review is altered to use a free-form summary rather than inline patch quoting due to automated recitation restrictions.)
>
> commit c26518c258a32645d11a26c0d0ce50242231d6a6
> Author: Leon Hwang <leon.hwang@linux.dev>
> libbpf: Add support for global percpu data
>
> This commit adds support for a new ".percpu" section in libbpf, enabling
> efficient handling of global percpu variables. It handles the section by
> creating a percpu_array map and populating it at load time.
>
> [Severity: Medium]
> The commit message mentions that users can read initialized percpu data
> after loading the program. Does the current implementation fully support
> BPF skeleton generation for this new section?
>
> In tools/lib/bpf/libbpf.c:map_is_mmapable(), the new code explicitly
> returns false when map->libbpf_type == LIBBPF_MAP_PERCPU.
map_is_mmapable() returns false for the internal percpu_array map to
avoid 'def->map_flags |= BPF_F_MMAPABLE'. But, it does not prevent
allocating mmaped memory for the internal percpu_array map.
In patch #6, the generated skeleton with this new section has been
tested well.
>
> Because PERCPU_ARRAY maps cannot be memory mapped, this prevents the
> skeleton generator from emitting the typed datasec pointer (such as
> skel->percpu).
>
> Additionally, does bpftool need a concurrent update to fully support this?
> Looking at get_map_ident() in tools/bpf/bpftool/gen.c, the sfxs[] array
> only contains ".data", ".rodata", ".bss", and ".kconfig".
>
> Without adding ".percpu" to the bpftool suffix list, it appears the skeleton
> generator will entirely omit the map from the generated header. If neither
> skel->percpu nor skel->maps.percpu is emitted, will users be forced to fall
> back to untyped manual lookups like bpf_object__find_map_by_name() instead
> of having the intended ergonomic skeleton access?
>
Hmm, Sashiko missed the map type check in get_map_ident() in patch #5.
Adding ".percpu" to the sfxs[] array is not robust, because
".percpu.data" could be translated to "data" identifier instead of
"percpu_data".
With the type check, ".percpu.data" will be translated to "percpu_data"
correctly.
Thanks,
Leon
next prev parent reply other threads:[~2026-07-16 5:22 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 15:32 [PATCH bpf-next v10 0/9] bpf: Introduce global percpu data Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 1/9] bpf: Drop duplicate blank lines in verifier Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 2/9] bpf: Introduce global percpu data Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 3/9] libbpf: Probe percpu data feature Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 4/9] libbpf: Add support for global percpu data Leon Hwang
2026-07-15 16:00 ` sashiko-bot
2026-07-16 5:21 ` Leon Hwang [this message]
2026-07-15 15:32 ` [PATCH bpf-next v10 5/9] bpftool: Generate skeleton " Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 6/9] selftests/bpf: Add tests to verify " Leon Hwang
2026-07-15 15:55 ` sashiko-bot
2026-07-16 5:25 ` Leon Hwang
2026-07-15 16:11 ` bot+bpf-ci
2026-07-16 5:30 ` Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 7/9] selftests/bpf: Test direct reading/writing read-only percpu_array map Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 8/9] selftests/bpf: Test verifier log for global percpu data Leon Hwang
2026-07-15 15:32 ` [PATCH bpf-next v10 9/9] selftests/bpf: Verify bpf_iter " Leon Hwang
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=99de30ad-a221-42f4-b7c7-ef73f68a0116@linux.dev \
--to=leon.hwang@linux.dev \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.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