From: Leon Hwang <leon.hwang@linux.dev>
To: bot+bpf-ci@kernel.org, bpf@vger.kernel.org
Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org,
martin.lau@linux.dev, eddyz87@gmail.com, memxor@gmail.com,
song@kernel.org, yonghong.song@linux.dev, jolsa@kernel.org,
john.fastabend@gmail.com, qmo@kernel.org, shuah@kernel.org,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
kernel-patches-bot@fb.com, martin.lau@kernel.org, clm@meta.com,
ihor.solodrai@linux.dev
Subject: Re: [PATCH bpf-next v12 06/10] bpftool: Generate skeleton for global percpu data
Date: Fri, 14 Aug 2026 14:12:38 +0800 [thread overview]
Message-ID: <e7a89c70-1f76-431e-a57e-6f6b10c3d029@linux.dev> (raw)
In-Reply-To: <5e196fcd4e2ac190d9232398274607860c07747f6d5adf39fb41db4f0a8d0167@mail.kernel.org>
On 14/8/26 00:26, bot+bpf-ci@kernel.org wrote:
>> diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
>> index a01d06d22d1a3..a50540ef6521c 100644
>> --- a/tools/bpf/bpftool/gen.c
>> +++ b/tools/bpf/bpftool/gen.c
>
> [ ... ]
>
>> @@ -254,7 +260,7 @@ static const struct btf_type *find_type_for_map(struct btf *btf, const char *map
>> return NULL;
>> }
>>
>> -static bool is_mmapable_map(const struct bpf_map *map, char *buf, size_t sz)
>> +static bool is_skel_data(const struct bpf_map *map, char *buf, size_t sz)
>> {
>> size_t tmp_sz;
>>
>> @@ -263,13 +269,24 @@ static bool is_mmapable_map(const struct bpf_map *map, char *buf, size_t sz)
>> return true;
>> }
>>
>> - if (!bpf_map__is_internal(map) || !(bpf_map__map_flags(map) & BPF_F_MMAPABLE))
>> + if (!bpf_map__is_internal(map))
>> return false;
>>
>> if (!get_map_ident(map, buf, sz))
>> return false;
>>
>> - return true;
>> + if (bpf_map__map_flags(map) & BPF_F_MMAPABLE)
>> + return true;
>> +
>> + if (bpf_map__type(map) == BPF_MAP_TYPE_PERCPU_ARRAY)
>> + return bpf_map__btf_value_type_id(map) != 0;
>> +
>> + return false;
>> +}
>> +
>> +static bool is_mmapable_map(const struct bpf_map *map, char *buf, size_t sz)
>> +{
>> + return is_skel_data(map, buf, sz) && bpf_map__type(map) != BPF_MAP_TYPE_PERCPU_ARRAY;
>> }
>>
>> static int codegen_datasecs(struct bpf_object *obj, const char *obj_name)
>> @@ -287,7 +304,7 @@ static int codegen_datasecs(struct bpf_object *obj, const char *obj_name)
>>
>> bpf_object__for_each_map(map, obj) {
>> /* only generate definitions for memory-mapped internal maps */
>> - if (!is_mmapable_map(map, map_ident, sizeof(map_ident)))
>> + if (!is_skel_data(map, map_ident, sizeof(map_ident)))
>> continue;
>
> The comment here says "only generate definitions for memory-mapped
> internal maps," but is_skel_data() now also returns true for
> BPF_MAP_TYPE_PERCPU_ARRAY maps. Those percpu maps are never
> memory-mapped: map_is_mmapable() in tools/lib/bpf/libbpf.c returns false
> for LIBBPF_MAP_PERCPU, which is why this patch had to add mprotect() for
> the init buffer rather than relying on shared mmap.
>
> When you removed the identical comment from codegen_maps_skeleton()
> (line 988), should this one have been updated to say "skeleton data maps"
> or "internal maps exposed as skeleton data" to match what is_skel_data()
> actually checks?
>
> The same wording also appears at line 534 in codegen_asserts():
Will update the comments.
>
>> bpf_object__for_each_map(map, obj) {
>> - if (!is_mmapable_map(map, map_ident, sizeof(map_ident)))
>> + if (!is_skel_data(map, map_ident, sizeof(map_ident)))
>> continue;
>
> where the comment above (line 513) says "Emit type size asserts for all
> top-level fields in memory-mapped internal maps." That comment now covers
> percpu maps too.
Will update the comment to "Emit type size asserts for all top-level
fields in skel data maps.".
Thanks,
Leon
>
next prev parent reply other threads:[~2026-08-14 6:12 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 15:23 [PATCH bpf-next v12 00/10] bpf: Introduce global percpu data Leon Hwang
2026-08-13 15:23 ` [PATCH bpf-next v12 01/10] bpf: Drop duplicate blank lines in kernel/bpf/ Leon Hwang
2026-08-13 16:26 ` bot+bpf-ci
2026-08-14 6:07 ` Leon Hwang
2026-08-13 15:23 ` [PATCH bpf-next v12 02/10] bpf: Factor out check_map_mem_read helper in verifier Leon Hwang
2026-08-13 16:26 ` bot+bpf-ci
2026-08-14 6:10 ` Leon Hwang
2026-08-13 15:23 ` [PATCH bpf-next v12 03/10] bpf: Introduce global percpu data Leon Hwang
2026-08-13 15:23 ` [PATCH bpf-next v12 04/10] libbpf: Probe percpu data feature Leon Hwang
2026-08-13 15:38 ` sashiko-bot
2026-08-14 6:11 ` Leon Hwang
2026-08-13 15:23 ` [PATCH bpf-next v12 05/10] libbpf: Add support for global percpu data Leon Hwang
2026-08-13 15:42 ` sashiko-bot
2026-08-14 6:12 ` Leon Hwang
2026-08-13 16:26 ` bot+bpf-ci
2026-08-13 17:41 ` Andrii Nakryiko
2026-08-14 6:11 ` Leon Hwang
2026-08-13 15:23 ` [PATCH bpf-next v12 06/10] bpftool: Generate skeleton " Leon Hwang
2026-08-13 16:26 ` bot+bpf-ci
2026-08-14 6:12 ` Leon Hwang [this message]
2026-08-13 17:56 ` Andrii Nakryiko
2026-08-14 2:03 ` Leon Hwang
2026-08-13 15:23 ` [PATCH bpf-next v12 07/10] selftests/bpf: Add tests to verify " Leon Hwang
2026-08-13 15:42 ` sashiko-bot
2026-08-14 6:13 ` Leon Hwang
2026-08-13 16:26 ` bot+bpf-ci
2026-08-14 6:13 ` Leon Hwang
2026-08-13 15:23 ` [PATCH bpf-next v12 08/10] selftests/bpf: Test direct reading/writing read-only percpu_array map Leon Hwang
2026-08-13 15:23 ` [PATCH bpf-next v12 09/10] selftests/bpf: Test verifier log for global percpu data Leon Hwang
2026-08-13 15:23 ` [PATCH bpf-next v12 10/10] selftests/bpf: Verify bpf_iter " Leon Hwang
2026-08-13 16:26 ` bot+bpf-ci
2026-08-14 6:13 ` 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=e7a89c70-1f76-431e-a57e-6f6b10c3d029@linux.dev \
--to=leon.hwang@linux.dev \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bot+bpf-ci@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=clm@meta.com \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--cc=ihor.solodrai@linux.dev \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kernel-patches-bot@fb.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=martin.lau@kernel.org \
--cc=martin.lau@linux.dev \
--cc=memxor@gmail.com \
--cc=qmo@kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.