]> Gentwo Git Trees - linux/.git/commit
s390/bpf: Use direct calls and jumps where possible
authorIlya Leoshkevich <iii@linux.ibm.com>
Tue, 19 Aug 2025 10:20:38 +0000 (12:20 +0200)
committerDaniel Borkmann <daniel@iogearbox.net>
Wed, 20 Aug 2025 12:54:58 +0000 (14:54 +0200)
commitb5bbbb70e5f5e1b14b2d5e3d88b8e18cd99f986d
tree4b2adc22376addd1e921197a03bd3fc0da568421
parentbf7a6a67050f5d59a674ecc3ecd06d6b09cfec49
s390/bpf: Use direct calls and jumps where possible

After the V!=R rework (commit c98d2ecae08f ("s390/mm: Uncouple physical
vs virtual address spaces")), all kernel code and related data are
allocated within a 4G region, making it possible to use relative
addressing in BPF code more extensively.

Convert as many indirect calls and jumps to direct calls as possible,
namely:

* BPF_CALL
* __bpf_tramp_enter()
* __bpf_tramp_exit()
* __bpf_prog_enter()
* __bpf_prog_exit()
* fentry
* fmod_ret
* fexit
* BPF_TRAMP_F_CALL_ORIG without BPF_TRAMP_F_ORIG_STACK
* Trampoline returns without BPF_TRAMP_F_SKIP_FRAME and
  BPF_TRAMP_F_ORIG_STACK

The following indirect calls and jumps remain:

* Prog returns
* Trampoline returns with BPF_TRAMP_F_SKIP_FRAME or
  BPF_TRAMP_F_ORIG_STACK
* BPF_TAIL_CALL
* BPF_TRAMP_F_CALL_ORIG with BPF_TRAMP_F_ORIG_STACK

As a result, only one usage of call_r1() remains, so inline it.

Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20250819102116.252203-1-iii@linux.ibm.com
arch/s390/net/bpf_jit_comp.c