bpf, arm64: Get rid of fpb
authorXu Kuohai <xukuohai@huawei.com>
Mon, 26 Aug 2024 07:16:23 +0000 (15:16 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Wed, 28 Aug 2024 15:41:33 +0000 (08:41 -0700)
commitbd737fcb64856d582335a7245be60fbb591c0bfd
tree7ca7182162675dddfdc24a7e8f4b8c10a0ecfb58
parentd205d4af3a5ee840edecfa5f6b389d7d03b0786d
bpf, arm64: Get rid of fpb

bpf prog accesses stack using BPF_FP as the base address and a negative
immediate number as offset. But arm64 ldr/str instructions only support
non-negative immediate number as offset. To simplify the jited result,
commit 5b3d19b9bd40 ("bpf, arm64: Adjust the offset of str/ldr(immediate)
to positive number") introduced FPB to represent the lowest stack address
that the bpf prog being jited may access, and with this address as the
baseline, it converts BPF_FP plus negative immediate offset number to FPB
plus non-negative immediate offset.

Considering that for a given bpf prog, the jited stack space is fixed
with A64_SP as the lowest address and BPF_FP as the highest address.
Thus we can get rid of FPB and converts BPF_FP plus negative immediate
offset to A64_SP plus non-negative immediate offset.

Signed-off-by: Xu Kuohai <xukuohai@huawei.com>
Link: https://lore.kernel.org/r/20240826071624.350108-2-xukuohai@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/arm64/net/bpf_jit_comp.c