mbox series

[bpf-next,v2,0/3] A couple of small refactorings of BPF program call sites

Message ID 20220905193359.969347-1-toke@redhat.com (mailing list archive)
Headers show
Series A couple of small refactorings of BPF program call sites | expand

Message

Toke Høiland-Jørgensen Sept. 5, 2022, 7:33 p.m. UTC
Stanislav suggested[0] that these small refactorings could be split out from the
XDP queueing RFC series and merged separately. The first change is a small
repacking of struct softnet_data, the others change the BPF call sites to
support full 64-bit values as arguments to bpf_redirect_map() and as the return
value of a BPF program, relying on the fact that BPF registers are always 64-bit
wide to maintain backwards compatibility.

Please see the individual patches for details.

v2:
- Rebase on bpf-next (CI failure seems to be unrelated to this series)
- Collect Stanislav's Reviewed-by

[0] https://lore.kernel.org/r/CAKH8qBtdnku7StcQ-SamadvAF==DRuLLZO94yOR1WJ9Bg=uX1w@mail.gmail.com

Kumar Kartikeya Dwivedi (1):
  bpf: Use 64-bit return value for bpf_prog_run

Toke Høiland-Jørgensen (2):
  dev: Move received_rps counter next to RPS members in softnet data
  bpf: Expand map key argument of bpf_redirect_map to u64

 include/linux/bpf-cgroup.h | 12 +++++-----
 include/linux/bpf.h        | 16 ++++++-------
 include/linux/filter.h     | 46 +++++++++++++++++++-------------------
 include/linux/netdevice.h  |  2 +-
 include/uapi/linux/bpf.h   |  2 +-
 kernel/bpf/cgroup.c        | 12 +++++-----
 kernel/bpf/core.c          | 14 ++++++------
 kernel/bpf/cpumap.c        |  4 ++--
 kernel/bpf/devmap.c        |  4 ++--
 kernel/bpf/offload.c       |  4 ++--
 kernel/bpf/verifier.c      |  2 +-
 net/bpf/test_run.c         | 21 +++++++++--------
 net/core/filter.c          |  4 ++--
 net/packet/af_packet.c     |  7 ++++--
 net/xdp/xskmap.c           |  4 ++--
 15 files changed, 80 insertions(+), 74 deletions(-)

Comments

Daniel Borkmann Sept. 16, 2022, 8:47 p.m. UTC | #1
On 9/5/22 9:33 PM, Toke Høiland-Jørgensen wrote:
> Stanislav suggested[0] that these small refactorings could be split out from the
> XDP queueing RFC series and merged separately. The first change is a small
> repacking of struct softnet_data, the others change the BPF call sites to
> support full 64-bit values as arguments to bpf_redirect_map() and as the return
> value of a BPF program, relying on the fact that BPF registers are always 64-bit
> wide to maintain backwards compatibility.

Looks like might still be issues on s390 [0] around retval checking, e.g.:

   [...]
   #122     pe_preserve_elems:FAIL
   test_raw_tp_test_run:PASS:parse_cpu_mask_file 0 nsec
   test_raw_tp_test_run:PASS:skel_open 0 nsec
   test_raw_tp_test_run:PASS:skel_attach 0 nsec
   test_raw_tp_test_run:PASS:open /proc/self/comm 0 nsec
   test_raw_tp_test_run:PASS:task rename 0 nsec
   test_raw_tp_test_run:PASS:check_count 0 nsec
   test_raw_tp_test_run:PASS:check_on_cpu 0 nsec
   test_raw_tp_test_run:PASS:test_run should fail for too small ctx 0 nsec
   test_raw_tp_test_run:PASS:test_run 0 nsec
   test_raw_tp_test_run:FAIL:check_retval unexpected check_retval: actual 0 != expected 26796
   test_raw_tp_test_run:PASS:test_run_opts 0 nsec
   test_raw_tp_test_run:PASS:check_on_cpu 0 nsec
   test_raw_tp_test_run:FAIL:check_retval unexpected check_retval: actual 0 != expected 26796
   test_raw_tp_test_run:PASS:test_run_opts 0 nsec
   test_raw_tp_test_run:PASS:check_on_cpu 0 nsec
   test_raw_tp_test_run:FAIL:check_retval unexpected check_retval: actual 0 != expected 26796
   test_raw_tp_test_run:PASS:test_run_opts should fail with ENXIO 0 nsec
   test_raw_tp_test_run:PASS:test_run_opts_fail 0 nsec
   test_raw_tp_test_run:PASS:test_run_opts should fail with EINVAL 0 nsec
   test_raw_tp_test_run:PASS:test_run_opts_fail 0 nsec
   [...]

Thanks,
Daniel

   [0] https://github.com/kernel-patches/bpf/actions/runs/3059535631/jobs/4939404438
Kumar Kartikeya Dwivedi Sept. 16, 2022, 8:59 p.m. UTC | #2
On Fri, 16 Sept 2022 at 22:58, Daniel Borkmann <daniel@iogearbox.net> wrote:
>
> On 9/5/22 9:33 PM, Toke Høiland-Jørgensen wrote:
> > Stanislav suggested[0] that these small refactorings could be split out from the
> > XDP queueing RFC series and merged separately. The first change is a small
> > repacking of struct softnet_data, the others change the BPF call sites to
> > support full 64-bit values as arguments to bpf_redirect_map() and as the return
> > value of a BPF program, relying on the fact that BPF registers are always 64-bit
> > wide to maintain backwards compatibility.
>
> Looks like might still be issues on s390 [0] around retval checking, e.g.:
>
>    [...]
>    #122     pe_preserve_elems:FAIL
>    test_raw_tp_test_run:PASS:parse_cpu_mask_file 0 nsec
>    test_raw_tp_test_run:PASS:skel_open 0 nsec
>    test_raw_tp_test_run:PASS:skel_attach 0 nsec
>    test_raw_tp_test_run:PASS:open /proc/self/comm 0 nsec
>    test_raw_tp_test_run:PASS:task rename 0 nsec
>    test_raw_tp_test_run:PASS:check_count 0 nsec
>    test_raw_tp_test_run:PASS:check_on_cpu 0 nsec
>    test_raw_tp_test_run:PASS:test_run should fail for too small ctx 0 nsec
>    test_raw_tp_test_run:PASS:test_run 0 nsec
>    test_raw_tp_test_run:FAIL:check_retval unexpected check_retval: actual 0 != expected 26796
>    test_raw_tp_test_run:PASS:test_run_opts 0 nsec
>    test_raw_tp_test_run:PASS:check_on_cpu 0 nsec
>    test_raw_tp_test_run:FAIL:check_retval unexpected check_retval: actual 0 != expected 26796
>    test_raw_tp_test_run:PASS:test_run_opts 0 nsec
>    test_raw_tp_test_run:PASS:check_on_cpu 0 nsec
>    test_raw_tp_test_run:FAIL:check_retval unexpected check_retval: actual 0 != expected 26796
>    test_raw_tp_test_run:PASS:test_run_opts should fail with ENXIO 0 nsec
>    test_raw_tp_test_run:PASS:test_run_opts_fail 0 nsec
>    test_raw_tp_test_run:PASS:test_run_opts should fail with EINVAL 0 nsec
>    test_raw_tp_test_run:PASS:test_run_opts_fail 0 nsec
>    [...]
>

Thanks, I'll take a look.

> Thanks,
> Daniel
>
>    [0] https://github.com/kernel-patches/bpf/actions/runs/3059535631/jobs/4939404438