mbox series

[bpf-next,0/2] Jit BPF_CALL to direct call when possible

Message ID 20220902152043.721806-1-xukuohai@huaweicloud.com (mailing list archive)
Headers show
Series Jit BPF_CALL to direct call when possible | expand

Message

Xu Kuohai Sept. 2, 2022, 3:20 p.m. UTC
Currently BPF_CALL is always jited to indirect call, but when target is
in the range of direct call, a BPF_CALL can be jited to direct call.

For example, the following BPF_CALL

    call __htab_map_lookup_elem

is always jited to an indirect call:

    mov     x10, #0xffffffffffff18f4
    movk    x10, #0x821, lsl #16
    movk    x10, #0x8000, lsl #32
    blr     x10

When the target is in the range of a direct call, it can be jited to:

    bl      0xfffffffffd33bc98

This patchset does such jit.

Xu Kuohai (2):
  bpf, arm64: Jit BPF_CALL to direct call when possible
  bpf, arm64: Eliminate false -EFBIG error in bpf trampoline

 arch/arm64/net/bpf_jit_comp.c | 136 ++++++++++++++++++++++------------
 1 file changed, 87 insertions(+), 49 deletions(-)