* [PATCH bpf-next] selftests/bpf: rbtree: Fix incorrect global variable usage
@ 2025-06-05 8:45 Rong Tao
2025-06-05 21:00 ` patchwork-bot+netdevbpf
0 siblings, 1 reply; 2+ messages in thread
From: Rong Tao @ 2025-06-05 8:45 UTC (permalink / raw)
To: rongtao, rtoax, Alexei Starovoitov, Daniel Borkmann,
Andrii Nakryiko, Martin KaFai Lau, Eduard Zingerman, Song Liu,
Yonghong Song, John Fastabend, KP Singh, Stanislav Fomichev,
Hao Luo, Jiri Olsa, Mykola Lysenko, Shuah Khan,
open list:BPF [GENERAL] (Safe Dynamic Programs and Tools),
open list:KERNEL SELFTEST FRAMEWORK, open list
From: Rong Tao <rongtao@cestc.cn>
Within __add_three() function, should use function parameters instead of
global variables. So that the variables groot_nested.inner.root and
groot_nested.inner.glock in rbtree_add_nodes_nested() are tested
correctly.
Signed-off-by: Rong Tao <rongtao@cestc.cn>
---
tools/testing/selftests/bpf/progs/rbtree.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/testing/selftests/bpf/progs/rbtree.c b/tools/testing/selftests/bpf/progs/rbtree.c
index a3620c15c136..49fe93d7e059 100644
--- a/tools/testing/selftests/bpf/progs/rbtree.c
+++ b/tools/testing/selftests/bpf/progs/rbtree.c
@@ -61,19 +61,19 @@ static long __add_three(struct bpf_rb_root *root, struct bpf_spin_lock *lock)
}
m->key = 1;
- bpf_spin_lock(&glock);
- bpf_rbtree_add(&groot, &n->node, less);
- bpf_rbtree_add(&groot, &m->node, less);
- bpf_spin_unlock(&glock);
+ bpf_spin_lock(lock);
+ bpf_rbtree_add(root, &n->node, less);
+ bpf_rbtree_add(root, &m->node, less);
+ bpf_spin_unlock(lock);
n = bpf_obj_new(typeof(*n));
if (!n)
return 3;
n->key = 3;
- bpf_spin_lock(&glock);
- bpf_rbtree_add(&groot, &n->node, less);
- bpf_spin_unlock(&glock);
+ bpf_spin_lock(lock);
+ bpf_rbtree_add(root, &n->node, less);
+ bpf_spin_unlock(lock);
return 0;
}
--
2.49.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH bpf-next] selftests/bpf: rbtree: Fix incorrect global variable usage
2025-06-05 8:45 [PATCH bpf-next] selftests/bpf: rbtree: Fix incorrect global variable usage Rong Tao
@ 2025-06-05 21:00 ` patchwork-bot+netdevbpf
0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-06-05 21:00 UTC (permalink / raw)
To: Rong Tao
Cc: rongtao, ast, daniel, andrii, martin.lau, eddyz87, song,
yonghong.song, john.fastabend, kpsingh, sdf, haoluo, jolsa,
mykolal, shuah, bpf, linux-kselftest, linux-kernel
Hello:
This patch was applied to bpf/bpf-next.git (master)
by Alexei Starovoitov <ast@kernel.org>:
On Thu, 5 Jun 2025 16:45:14 +0800 you wrote:
> From: Rong Tao <rongtao@cestc.cn>
>
> Within __add_three() function, should use function parameters instead of
> global variables. So that the variables groot_nested.inner.root and
> groot_nested.inner.glock in rbtree_add_nodes_nested() are tested
> correctly.
>
> [...]
Here is the summary with links:
- [bpf-next] selftests/bpf: rbtree: Fix incorrect global variable usage
https://git.kernel.org/bpf/bpf-next/c/64a064ce33b1
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] 2+ messages in thread
end of thread, other threads:[~2025-06-05 21:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-05 8:45 [PATCH bpf-next] selftests/bpf: rbtree: Fix incorrect global variable usage Rong Tao
2025-06-05 21:00 ` patchwork-bot+netdevbpf
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).