bpf, arm64: Enable the inline of bpf_kptr_xchg()
authorHou Tao <houtao1@huawei.com>
Fri, 19 Jan 2024 10:25:28 +0000 (18:25 +0800)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 23 Jan 2024 23:11:23 +0000 (15:11 -0800)
ARM64 bpf jit satisfies the following two conditions:
1) support BPF_XCHG() on pointer-sized word.
2) the implementation of xchg is the same as atomic_xchg() on
   pointer-sized words. Both of these two functions use arch_xchg() to
   implement the exchange.

So enable the inline of bpf_kptr_xchg() for arm64 bpf jit.

Signed-off-by: Hou Tao <houtao1@huawei.com>
Link: https://lore.kernel.org/r/20240119102529.99581-2-houtao@huaweicloud.com
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
arch/arm64/net/bpf_jit_comp.c

index 8955da5c47cf777ed3948d21aa8eb8b04a1dff97..cfd5434de4832714fc2fa1565d6a7a927e487185 100644 (file)
@@ -2305,3 +2305,8 @@ out:
 
        return ret;
 }
+
+bool bpf_jit_supports_ptr_xchg(void)
+{
+       return true;
+}