From: Leon Hwang <leon.hwang@linux.dev>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf@vger.kernel.org, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Eduard Zingerman <eddyz87@gmail.com>,
Kumar Kartikeya Dwivedi <memxor@gmail.com>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Jiri Olsa <jolsa@kernel.org>,
John Fastabend <john.fastabend@gmail.com>,
Quentin Monnet <qmo@kernel.org>, Shuah Khan <shuah@kernel.org>,
linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org,
kernel-patches-bot@fb.com
Subject: Re: [PATCH bpf-next v7 04/11] bpf: Introduce global percpu data
Date: Wed, 24 Jun 2026 12:11:02 +0800 [thread overview]
Message-ID: <d5262e2a-5457-4ca6-950e-33463cc9422d@linux.dev> (raw)
In-Reply-To: <CAEf4Bza8aqNsiiBHJ64+Sj-2twUFxeSuBZ89tVroig3OWC9_Ng@mail.gmail.com>
On 24/6/26 06:45, Andrii Nakryiko wrote:
> On Mon, Jun 22, 2026 at 7:37 AM Leon Hwang <leon.hwang@linux.dev> wrote:
[...]
>> +
>> +static int percpu_array_map_direct_value_meta(const struct bpf_map *map, u64 imm, u32 *off)
>> +{
>> + struct bpf_array *array = container_of(map, struct bpf_array, map);
>> + u64 base = (u64)(__force unsigned long) array->pptrs[0];
>> + u64 range = array->elem_size;
>> +
>> + if (map->max_entries != 1)
>> + return -EOPNOTSUPP;
>> + if (imm < base || imm >= base + range)
>
> nit: not sure what's the value of range local variable, single place
> where you use array->elem_size
>
Hmm, this was copied from array_map_direct_value_meta().
Will drop "range", and use "array->elem_size" here.
>> + return -ENOENT;
>> + if (!bpf_jit_supports_percpu_insn())
>> + return -EOPNOTSUPP;
>> +
>> + *off = imm - base;
>> + return 0;
>> +}
>> +
[...]
>> diff --git a/kernel/bpf/const_fold.c b/kernel/bpf/const_fold.c
>> index b2a19acadb91..5787246bef30 100644
>> --- a/kernel/bpf/const_fold.c
>> +++ b/kernel/bpf/const_fold.c
>> @@ -182,7 +182,6 @@ static void const_reg_xfer(struct bpf_verifier_env *env, struct const_arg_info *
>> u64 val = 0;
>>
>> if (!bpf_map_is_rdonly(map) || !map->ops->map_direct_value_addr ||
>> - map->map_type == BPF_MAP_TYPE_INSN_ARRAY ||
>
> can you please elaborate on why this change is needed?
>
This was suggested by Alexei in v4:
https://lore.kernel.org/bpf/CAADnVQJ0o38xXn6E5ub7kWyoZPiaevr9mwDNxv0GbxyguVTKUg@mail.gmail.com/
Thanks,
Leon
>> off < 0 || off + size > map->value_size ||
>> bpf_map_direct_read(map, off, size, &val, is_ldsx)) {
>> *dst = unknown;
>
> [...]
next prev parent reply other threads:[~2026-06-24 4:11 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-22 14:35 [PATCH bpf-next v7 00/11] bpf: Introduce global percpu data Leon Hwang
2026-06-22 14:35 ` [PATCH bpf-next v7 01/11] bpf: Drop duplicate blank lines in verifier Leon Hwang
2026-06-22 14:35 ` [PATCH bpf-next v7 02/11] bpf: Disallow interpreter fallback for user BPF_ADDR_SPACE_CAST insn Leon Hwang
2026-06-23 22:45 ` Andrii Nakryiko
2026-06-24 4:10 ` Leon Hwang
2026-06-22 14:35 ` [PATCH bpf-next v7 03/11] bpf: Disallow interpreter fallback for BPF_ADDR_PERCPU insn Leon Hwang
2026-06-22 14:35 ` [PATCH bpf-next v7 04/11] bpf: Introduce global percpu data Leon Hwang
2026-06-23 22:45 ` Andrii Nakryiko
2026-06-24 4:11 ` Leon Hwang [this message]
2026-06-22 14:35 ` [PATCH bpf-next v7 05/11] libbpf: Probe percpu data feature Leon Hwang
2026-06-23 22:45 ` Andrii Nakryiko
2026-06-24 4:11 ` Leon Hwang
2026-06-22 14:35 ` [PATCH bpf-next v7 06/11] libbpf: Add support for global percpu data Leon Hwang
2026-06-23 22:45 ` Andrii Nakryiko
2026-06-24 4:13 ` Leon Hwang
2026-06-22 14:35 ` [PATCH bpf-next v7 07/11] bpftool: Generate skeleton " Leon Hwang
2026-06-23 22:46 ` Andrii Nakryiko
2026-06-24 4:15 ` Leon Hwang
2026-06-22 14:35 ` [PATCH bpf-next v7 08/11] selftests/bpf: Add tests to verify " Leon Hwang
2026-06-22 15:24 ` bot+bpf-ci
2026-06-23 4:02 ` Leon Hwang
2026-06-22 14:35 ` [PATCH bpf-next v7 09/11] selftests/bpf: Add test to verify accessing rdonly percpu_array Leon Hwang
2026-06-23 22:46 ` Andrii Nakryiko
2026-06-24 4:16 ` Leon Hwang
2026-06-22 14:35 ` [PATCH bpf-next v7 10/11] selftests/bpf: Add tests to verify verifier log for global percpu data Leon Hwang
2026-06-22 14:35 ` [PATCH bpf-next v7 11/11] selftests/bpf: Add test to verify bpf_iter " Leon Hwang
2026-06-22 15:24 ` bot+bpf-ci
2026-06-23 4:04 ` 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=d5262e2a-5457-4ca6-950e-33463cc9422d@linux.dev \
--to=leon.hwang@linux.dev \
--cc=andrii.nakryiko@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=eddyz87@gmail.com \
--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@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox