mbox series

[bpf-next,v2,0/5] PROG_TEST_RUN support for sk_lookup programs

Message ID 20210226103103.131210-1-lmb@cloudflare.com (mailing list archive)
Headers show
Series PROG_TEST_RUN support for sk_lookup programs | expand

Message

Lorenz Bauer Feb. 26, 2021, 10:30 a.m. UTC
We don't have PROG_TEST_RUN support for sk_lookup programs at the
moment. So far this hasn't been a problem, since we can run our
tests in a separate network namespace. For benchmarking it's nice
to have PROG_TEST_RUN, so I've gone and implemented it.

Based on discussion on the v1 I've dropped support for testing multiple
programs at once.

Changes since v1:
- Add sparse annotations to the t_* functions
- Add appropriate type casts in bpf_prog_test_run_sk_lookup
- Drop running multiple programs

Lorenz Bauer (5):
  bpf: consolidate shared test timing code
  bpf: add for_each_bpf_prog helper
  bpf: add PROG_TEST_RUN support for sk_lookup programs
  selftests: bpf: convert sk_lookup ctx access tests to PROG_TEST_RUN
  selftests: bpf: check that PROG_TEST_RUN repeats as requested

 include/linux/bpf.h                           |  21 +-
 include/linux/filter.h                        |   4 +-
 include/uapi/linux/bpf.h                      |   5 +-
 net/bpf/test_run.c                            | 245 +++++++++++++-----
 net/core/filter.c                             |   1 +
 tools/include/uapi/linux/bpf.h                |   5 +-
 .../selftests/bpf/prog_tests/prog_run_xattr.c |  51 +++-
 .../selftests/bpf/prog_tests/sk_lookup.c      |  83 ++++--
 .../selftests/bpf/progs/test_sk_lookup.c      |  62 +++--
 9 files changed, 358 insertions(+), 119 deletions(-)

Comments

Alexei Starovoitov Feb. 26, 2021, 8:55 p.m. UTC | #1
On Fri, Feb 26, 2021 at 2:31 AM Lorenz Bauer <lmb@cloudflare.com> wrote:
>
> We don't have PROG_TEST_RUN support for sk_lookup programs at the
> moment. So far this hasn't been a problem, since we can run our
> tests in a separate network namespace. For benchmarking it's nice
> to have PROG_TEST_RUN, so I've gone and implemented it.
>
> Based on discussion on the v1 I've dropped support for testing multiple
> programs at once.
>
> Changes since v1:
> - Add sparse annotations to the t_* functions
> - Add appropriate type casts in bpf_prog_test_run_sk_lookup
> - Drop running multiple programs

Looks good.
I applied it, but then reverted since test_verifier needs to be adjusted:
./test_verifier 349
#349/p valid 1,2,4,8-byte reads from bpf_sk_lookup FAIL: Unexpected
bpf_prog_test_run error (Invalid argument) (run 1/1)

That's the only test that has ACCEPT for sk_lookup prog type
and the framework now is trying to run it.
Pls respin.