On Mon, Mar 4, 2024 at 10:44 PM Yafang Shao <laoar.shao@xxxxxxxxx> wrote: > > Add selftests for the newly added bits iter. > - bits_iter_success > - percpu data extracted from the percpu struct should be expected > - RCU lock is not required > - It is fine without calling bpf_iter_cpumask_next() > - It can work as expected when invalid arguments are passed > > - bits_iter_failure > - bpf_iter_bits_destroy() is required after calling > bpf_iter_bits_new() > - bpf_iter_bits_destroy() can only destroy an initialized iter > - bpf_iter_bits_next() must use an initialized iter > > This test case can't work correctly on s390x for unknonw reason, thus it > is added to DENYLIST.s390x. That's an unusual way of handling "doesn't work for unknown reason" :) This might be an endianness issue I pointed out in patch #1. pw-bot: cr > > Signed-off-by: Yafang Shao <laoar.shao@xxxxxxxxx> > --- > tools/testing/selftests/bpf/DENYLIST.s390x | 3 +- > .../selftests/bpf/prog_tests/bits_iter.c | 137 ++++++++++++++++++ > .../bpf/progs/test_bits_iter_failure.c | 54 +++++++ > .../bpf/progs/test_bits_iter_success.c | 122 ++++++++++++++++ > 4 files changed, 315 insertions(+), 1 deletion(-) > create mode 100644 tools/testing/selftests/bpf/prog_tests/bits_iter.c > create mode 100644 tools/testing/selftests/bpf/progs/test_bits_iter_failure.c > create mode 100644 tools/testing/selftests/bpf/progs/test_bits_iter_success.c > > diff --git a/tools/testing/selftests/bpf/DENYLIST.s390x b/tools/testing/selftests/bpf/DENYLIST.s390x > index 1a63996c0304..0cd6d2bf1ff4 100644 > --- a/tools/testing/selftests/bpf/DENYLIST.s390x > +++ b/tools/testing/selftests/bpf/DENYLIST.s390x > @@ -1,5 +1,6 @@ > # TEMPORARY > # Alphabetical order > -exceptions # JIT does not support calling kfunc bpf_throw (exceptions) > +bits_iter # cpumask iter can't work as expected (?) > +exceptions # JIT does not support calling kfunc bpf_throw (exceptions) > get_stack_raw_tp # user_stack corrupted user stack (no backchain userspace) > stacktrace_build_id # compare_map_keys stackid_hmap vs. stackmap err -2 errno 2 (?) [...]