From: Leon Hwang <leon.hwang@linux.dev>
To: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: bpf <bpf@vger.kernel.org>, Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
Song Liu <song@kernel.org>, Eddy Z <eddyz87@gmail.com>,
Quentin Monnet <qmo@kernel.org>, Daniel Xu <dxu@dxuuu.xyz>,
kernel-patches-bot@fb.com
Subject: Re: [PATCH bpf-next 1/4] bpf: Introduce global percpu data
Date: Mon, 10 Feb 2025 17:35:29 +0800 [thread overview]
Message-ID: <3134f8da-1d2e-4d91-aeaf-477848f70cdd@linux.dev> (raw)
In-Reply-To: <CAADnVQJu3KCOQFP6M2MSaan2jZSYrQEa=1+ZS=XfbpnV=iGmZw@mail.gmail.com>
On 8/2/25 08:23, Alexei Starovoitov wrote:
> On Mon, Jan 27, 2025 at 8:22 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) array->pptrs[0];
>> + u64 range = array->elem_size;
>> +
>> + if (map->max_entries != 1)
>> + return -EOPNOTSUPP;
>> + if (imm < base || imm >= base + range)
>> + return -ENOENT;
>> + if (!bpf_jit_supports_percpu_insn())
>> + return -EOPNOTSUPP;
>> +
>> + *off = imm - base;
>> + return 0;
>> +}
>
> Pls add a selftest for off != 0.
> I think the above should work, but this is not obvious.
>
Ack.
>>
>> +#ifdef CONFIG_SMP
>> + if (insn->code == (BPF_LD | BPF_IMM | BPF_DW) &&
>> + (insn->src_reg == BPF_PSEUDO_MAP_VALUE ||
>> + insn->src_reg == BPF_PSEUDO_MAP_IDX_VALUE)) {
>
> Is there a selftest for BPF_PSEUDO_MAP_IDX_VALUE part ?
> I couldn't find it.
Do you mean add a selftest with 'bpftool gen skeleton -L'?
Indeed, it's better to test it.
Thanks,
Leon
next prev parent reply other threads:[~2025-02-10 9:35 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-27 16:21 [PATCH bpf-next 0/4] bpf: Introduce global percpu data Leon Hwang
2025-01-27 16:21 ` [PATCH bpf-next 1/4] " Leon Hwang
2025-02-06 0:09 ` Andrii Nakryiko
2025-02-07 9:42 ` Leon Hwang
2025-02-08 0:23 ` Alexei Starovoitov
2025-02-10 9:35 ` Leon Hwang [this message]
2025-01-27 16:21 ` [PATCH bpf-next 2/4] bpf, libbpf: Support " Leon Hwang
2025-02-06 0:09 ` Andrii Nakryiko
2025-02-07 9:48 ` Leon Hwang
2025-01-27 16:21 ` [PATCH bpf-next 3/4] bpf, bpftool: Generate skeleton for " Leon Hwang
2025-02-06 0:09 ` Andrii Nakryiko
2025-02-07 9:52 ` Leon Hwang
2025-01-27 16:21 ` [PATCH bpf-next 4/4] selftests/bpf: Add a case to test " Leon Hwang
2025-02-06 0:09 ` Andrii Nakryiko
2025-02-07 10:00 ` Leon Hwang
2025-02-07 19:48 ` Andrii Nakryiko
2025-02-10 9:52 ` Leon Hwang
2025-02-11 0:15 ` Andrii Nakryiko
2025-02-12 1:50 ` Leon Hwang
-- strict thread matches above, loose matches on Subject: below --
2025-02-13 16:06 [PATCH bpf-next 0/4] bpf: Introduce " Leon Hwang
2025-02-13 16:06 ` [PATCH bpf-next 1/4] " 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=3134f8da-1d2e-4d91-aeaf-477848f70cdd@linux.dev \
--to=leon.hwang@linux.dev \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=dxu@dxuuu.xyz \
--cc=eddyz87@gmail.com \
--cc=kernel-patches-bot@fb.com \
--cc=qmo@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.