From: Eduard Zingerman <eddyz87@gmail.com>
To: Yafang Shao <laoar.shao@gmail.com>,
Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
John Fastabend <john.fastabend@gmail.com>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <martin.lau@linux.dev>,
Song Liu <song@kernel.org>,
Yonghong Song <yonghong.song@linux.dev>,
KP Singh <kpsingh@kernel.org>,
Stanislav Fomichev <sdf@google.com>, Hao Luo <haoluo@google.com>,
Jiri Olsa <jolsa@kernel.org>, bpf <bpf@vger.kernel.org>
Subject: Re: [PATCH bpf-next 2/2] selftests/bpf: Add selftest for bits iter
Date: Fri, 23 Feb 2024 13:52:56 +0200 [thread overview]
Message-ID: <26ceafc98a4408884e707314d3eb9cbf8c0b6d58.camel@gmail.com> (raw)
In-Reply-To: <CALOAHbCSXrX-igGH0TJTWcKSGg7u6KOfGQrqpwymxf4y1+f2kQ@mail.gmail.com>
On Fri, 2024-02-23 at 10:29 +0800, Yafang Shao wrote:
[...]
> > The patch 1 looks good, but this test fails on s390.
> >
> > read_percpu_data:FAIL:nr_cpus unexpected nr_cpus: actual 0 != expected 2
> > verify_iter_success:FAIL:read_percpu_data unexpected error: -1 (errno 95)
> >
> > Please see CI.
> >
> > So either add it to DENYLIST.s390x in the same commit or make it work.
> >
> > pw-bot: cr
>
> The reason for the failure on s390x architecture is currently unclear.
> One plausible explanation is that total_nr_cpus remains 0 when
> executing the following code:
>
> bpf_for_each(bits, cpu, p->cpus_ptr, total_nr_cpus)
>
> This is despite setting total_nr_cpus to the value obtained from
> libbpf_num_possible_cpus():
>
> skel->bss->total_nr_cpus = libbpf_num_possible_cpus();
>
> A potential workaround could involve using a hardcoded number of CPUs,
> such as 8192, instead of relying on total_nr_cpus. This approach might
> mitigate the issue temporarily.
I'm sorry, but is it really necessary to deal with total number of
CPUs in a test for bit iterator?
Tbh, cpumask_iter / verify_iter_success seem to be over-complicated.
Would it be possible to reuse test_loader.c's RUN_TESTS for this feature?
It supports __retval(...) annotation, so it should be possible to:
- create a map (even a constant map) with some known data;
- peek a BPF program type that supports BPF_PROG_TEST_RUN syscall command;
- organize test BPF programs so that they create bit iterators for
this test data and return some expected quantities (e.g. a sum),
verified by __retval.
This should limit the amount of code on prog_tests/*.c side
to the bare minimum.
next prev parent reply other threads:[~2024-02-23 11:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-18 11:48 [PATCH bpf-next 0/2] bpf: Add a generic bits iterator Yafang Shao
2024-02-18 11:48 ` [PATCH bpf-next 1/2] bpf: Add " Yafang Shao
2024-02-26 23:21 ` John Fastabend
2024-02-27 0:20 ` Alexei Starovoitov
2024-02-27 0:34 ` John Fastabend
2024-02-18 11:48 ` [PATCH bpf-next 2/2] selftests/bpf: Add selftest for bits iter Yafang Shao
2024-02-22 17:36 ` Alexei Starovoitov
2024-02-23 2:29 ` Yafang Shao
2024-02-23 11:52 ` Eduard Zingerman [this message]
2024-02-25 2:29 ` Yafang Shao
2024-02-25 19:38 ` kernel test robot
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=26ceafc98a4408884e707314d3eb9cbf8c0b6d58.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=alexei.starovoitov@gmail.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=haoluo@google.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=kpsingh@kernel.org \
--cc=laoar.shao@gmail.com \
--cc=martin.lau@linux.dev \
--cc=sdf@google.com \
--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;
as well as URLs for NNTP newsgroup(s).