All of lore.kernel.org
 help / color / mirror / Atom feed
From: Leon Hwang <leon.hwang@linux.dev>
To: Andrii Nakryiko <andrii.nakryiko@gmail.com>
Cc: bpf@vger.kernel.org, ast@kernel.org, andrii@kernel.org,
	daniel@iogearbox.net
Subject: Re: [RFC PATCH bpf-next 3/3] selftests/bpf: Add case to test BPF_F_CPU
Date: Thu, 3 Jul 2025 01:29:26 +0800	[thread overview]
Message-ID: <23502034-2a8c-4ab0-b23d-be8878e8d04a@linux.dev> (raw)
In-Reply-To: <CAEf4BzYkqPO-cGVv7FomXZinSYNE5q78+dRoiVZAtWaJ4MNJNg@mail.gmail.com>



On 2025/7/2 04:22, Andrii Nakryiko wrote:
> On Tue, Jun 24, 2025 at 9:55 AM Leon Hwang <leon.hwang@linux.dev> wrote:
>>
>> This patch adds test coverage for the new BPF_F_CPU flag support in
>> percpu_array maps. The following APIs are exercised:
>>
>> * bpf_map_update_batch()
>> * bpf_map_lookup_batch()
>> * bpf_map_update_elem_opts()
>> * bpf_map__update_elem_opts()
>> * bpf_map_lookup_elem_opts()
>> * bpf_map__lookup_elem_opts()
>>
>> cd tools/testing/selftests/bpf/
>> ./test_progs -t percpu_alloc/cpu_flag_tests
>> 251/5   percpu_alloc/cpu_flag_tests:OK
>> 251     percpu_alloc:OK
>> Summary: 1/1 PASSED, 0 SKIPPED, 0 FAILED
>>
>> Signed-off-by: Leon Hwang <leon.hwang@linux.dev>
>> ---
>>  .../selftests/bpf/prog_tests/percpu_alloc.c   | 169 ++++++++++++++++++
>>  .../selftests/bpf/progs/percpu_array_flag.c   |  24 +++
>>  2 files changed, 193 insertions(+)
>>  create mode 100644 tools/testing/selftests/bpf/progs/percpu_array_flag.c
>>
>> diff --git a/tools/testing/selftests/bpf/prog_tests/percpu_alloc.c b/tools/testing/selftests/bpf/prog_tests/percpu_alloc.c
>> index 343da65864d6..5727f4601b49 100644
>> --- a/tools/testing/selftests/bpf/prog_tests/percpu_alloc.c
>> +++ b/tools/testing/selftests/bpf/prog_tests/percpu_alloc.c
>> @@ -3,6 +3,7 @@
>>  #include "percpu_alloc_array.skel.h"
>>  #include "percpu_alloc_cgrp_local_storage.skel.h"
>>  #include "percpu_alloc_fail.skel.h"
>> +#include "percpu_array_flag.skel.h"
>>
>>  static void test_array(void)
>>  {
>> @@ -115,6 +116,172 @@ static void test_failure(void) {
>>         RUN_TESTS(percpu_alloc_fail);
>>  }
>>
>> +static void test_cpu_flag(void)
>> +{
>> +       int map_fd, *keys = NULL, value_size, cpu, i, j, nr_cpus, err;
>> +       size_t key_sz = sizeof(int), value_sz = sizeof(u64);
>> +       struct percpu_array_flag *skel;
>> +       u64 batch = 0, *values = NULL;
>> +       const u64 value = 0xDEADC0DE;
>> +       u32 count, max_entries;
>> +       struct bpf_map *map;
>> +       DECLARE_LIBBPF_OPTS(bpf_map_lookup_elem_opts, lookup_opts,
>> +                           .flags = BPF_F_CPU,
>> +                           .cpu = 0,
>> +       );
> 
> use shorter LIBBPF_OPTS macro, please
> 

Ack.

[...]

Thanks,
Leon



      reply	other threads:[~2025-07-02 17:29 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-24 16:53 [RFC PATCH bpf-next 0/3] bpf: Introduce BPF_F_CPU flag for percpu_array map Leon Hwang
2025-06-24 16:53 ` [RFC PATCH bpf-next 1/3] " Leon Hwang
2025-07-01 20:22   ` Andrii Nakryiko
2025-07-02 17:01     ` Leon Hwang
2025-07-02 17:13       ` Andrii Nakryiko
2025-06-24 16:53 ` [RFC PATCH bpf-next 2/3] bpf, libbpf: Support BPF_F_CPU " Leon Hwang
2025-07-01 20:22   ` Andrii Nakryiko
2025-07-02 17:28     ` Leon Hwang
2025-07-02 17:30       ` Andrii Nakryiko
2025-07-02 17:32         ` Leon Hwang
2025-06-24 16:53 ` [RFC PATCH bpf-next 3/3] selftests/bpf: Add case to test BPF_F_CPU Leon Hwang
2025-07-01 20:22   ` Andrii Nakryiko
2025-07-02 17:29     ` Leon Hwang [this message]

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=23502034-2a8c-4ab0-b23d-be8878e8d04a@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 \
    /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.