[RFC] Implementing the BPF dispatcher on ARM64

Xu Kuohai xukuohai at huawei.com
Sun Mar 12 19:20:05 PDT 2023


[ cc arm list ]

On 3/10/2023 5:33 PM, Puranjay Mohan wrote:
> Hi,
> I am starting this thread to know if someone is implementing the BPF
> dispatcher for ARM64 and if not, what would be needed to make this
> happen.
> 
> The basic infra + x86 specific code was introduced in [1] by Björn Töpel.
> 
> To make BPF dispatcher work on ARM64, the
> arch_prepare_bpf_dispatcher() has to be implemented in
> arch/arm64/net/bpf_jit_comp.c.
> 
> As I am not well versed with XDP and the JIT, I have a few questions
> regarding this.
> 
> 1. What is the best way to test this? Is there a selftest that will
> fail now and will pass once the dispatcher is implemented?
> 2. As there is no CONFIG_RETPOLINE in ARM64, will the dispatcher be useful.

Hello,

I have some thoughts for bpf dispatcher in arm64.

bpf dispatcher uses static call to convert indirect call instructions to direct
call instructions, to avoid performance penalty introduced by retpoline. Since
there is no retpoline or static call in arm64, bpf dispatcher seems useless.

In addition, the range for a direct call instruction in arm64 is +-128MB, but
jited bpf image address is outside of +-128MB, so it may not be possible to call
a bpf prog with direct call instruction.

> 
> [1] https://github.com/torvalds/linux/commit/75ccbef6369e94ecac696a152a998a978d41376b
> 




More information about the linux-arm-kernel mailing list