* [PATCH bpf-next 1/2] bpf, arm64: Enable the inline of bpf_kptr_xchg()
2024-01-19 10:25 [PATCH bpf-next 0/2] Enable the inline of kptr_xchg for arm64 Hou Tao
@ 2024-01-19 10:25 ` Hou Tao
2024-01-19 10:25 ` [PATCH bpf-next 2/2] selftests/bpf: Enable kptr_xchg_inline test for arm64 Hou Tao
2024-01-23 23:40 ` [PATCH bpf-next 0/2] Enable the inline of kptr_xchg " patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Hou Tao @ 2024-01-19 10:25 UTC (permalink / raw)
To: bpf
Cc: Martin KaFai Lau, Alexei Starovoitov, Andrii Nakryiko, Song Liu,
Hao Luo, Yonghong Song, Daniel Borkmann, KP Singh,
Stanislav Fomichev, Jiri Olsa, John Fastabend, Zi Shen Lim,
Catalin Marinas, Will Deacon, houtao1
From: Hou Tao <houtao1@huawei.com>
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>
---
arch/arm64/net/bpf_jit_comp.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c
index 8955da5c47cf7..cfd5434de4832 100644
--- a/arch/arm64/net/bpf_jit_comp.c
+++ b/arch/arm64/net/bpf_jit_comp.c
@@ -2305,3 +2305,8 @@ int bpf_arch_text_poke(void *ip, enum bpf_text_poke_type poke_type,
return ret;
}
+
+bool bpf_jit_supports_ptr_xchg(void)
+{
+ return true;
+}
--
2.29.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH bpf-next 2/2] selftests/bpf: Enable kptr_xchg_inline test for arm64
2024-01-19 10:25 [PATCH bpf-next 0/2] Enable the inline of kptr_xchg for arm64 Hou Tao
2024-01-19 10:25 ` [PATCH bpf-next 1/2] bpf, arm64: Enable the inline of bpf_kptr_xchg() Hou Tao
@ 2024-01-19 10:25 ` Hou Tao
2024-01-23 23:40 ` [PATCH bpf-next 0/2] Enable the inline of kptr_xchg " patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: Hou Tao @ 2024-01-19 10:25 UTC (permalink / raw)
To: bpf
Cc: Martin KaFai Lau, Alexei Starovoitov, Andrii Nakryiko, Song Liu,
Hao Luo, Yonghong Song, Daniel Borkmann, KP Singh,
Stanislav Fomichev, Jiri Olsa, John Fastabend, Zi Shen Lim,
Catalin Marinas, Will Deacon, houtao1
From: Hou Tao <houtao1@huawei.com>
Now arm64 bpf jit has enable bpf_jit_supports_ptr_xchg(), so enable
the test for arm64 as well.
Signed-off-by: Hou Tao <houtao1@huawei.com>
---
tools/testing/selftests/bpf/prog_tests/kptr_xchg_inline.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/bpf/prog_tests/kptr_xchg_inline.c b/tools/testing/selftests/bpf/prog_tests/kptr_xchg_inline.c
index 5a4bee1cf9707..15144943e88b7 100644
--- a/tools/testing/selftests/bpf/prog_tests/kptr_xchg_inline.c
+++ b/tools/testing/selftests/bpf/prog_tests/kptr_xchg_inline.c
@@ -13,7 +13,7 @@ void test_kptr_xchg_inline(void)
unsigned int cnt;
int err;
-#if !defined(__x86_64__)
+#if !(defined(__x86_64__) || defined(__aarch64__))
test__skip();
return;
#endif
--
2.29.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH bpf-next 0/2] Enable the inline of kptr_xchg for arm64
2024-01-19 10:25 [PATCH bpf-next 0/2] Enable the inline of kptr_xchg for arm64 Hou Tao
2024-01-19 10:25 ` [PATCH bpf-next 1/2] bpf, arm64: Enable the inline of bpf_kptr_xchg() Hou Tao
2024-01-19 10:25 ` [PATCH bpf-next 2/2] selftests/bpf: Enable kptr_xchg_inline test for arm64 Hou Tao
@ 2024-01-23 23:40 ` patchwork-bot+netdevbpf
2 siblings, 0 replies; 4+ messages in thread
From: patchwork-bot+netdevbpf @ 2024-01-23 23:40 UTC (permalink / raw)
To: Hou Tao
Cc: bpf, martin.lau, alexei.starovoitov, andrii, song, haoluo,
yonghong.song, daniel, kpsingh, sdf, jolsa, john.fastabend,
zlim.lnx, catalin.marinas, will, houtao1
Hello:
This series was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Fri, 19 Jan 2024 18:25:27 +0800 you wrote:
> From: Hou Tao <houtao1@huawei.com>
>
> Hi,
>
> The patch set is just a follow-up for "bpf: inline bpf_kptr_xchg()". It
> enables the inline of bpf_kptr_xchg() and kptr_xchg_inline test for
> arm64.
>
> [...]
Here is the summary with links:
- [bpf-next,1/2] bpf, arm64: Enable the inline of bpf_kptr_xchg()
https://git.kernel.org/bpf/bpf-next/c/18a45f12d746
- [bpf-next,2/2] selftests/bpf: Enable kptr_xchg_inline test for arm64
https://git.kernel.org/bpf/bpf-next/c/29f868887a7d
You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
^ permalink raw reply [flat|nested] 4+ messages in thread