[RFCv2 PATCH bpf-next 16/18] selftests/bpf: Declarative lock definition test changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This patch contains test changes corresponding to the functional changes
in patch "bpf: Support declarative association of lock with rbtree map".
It will be squashed with other test patches, leaving in this state for
RFCv2 feedback.

Signed-off-by: Dave Marchevsky <davemarchevsky@xxxxxx>
---
 tools/testing/selftests/bpf/progs/rbtree_map.c       | 12 +++++++++---
 tools/testing/selftests/bpf/progs/rbtree_map_fail.c  |  9 ++++++++-
 .../selftests/bpf/progs/rbtree_map_load_fail.c       |  9 ++++++++-
 3 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/bpf/progs/rbtree_map.c b/tools/testing/selftests/bpf/progs/rbtree_map.c
index 0cd467838f6e..50f29b9a5b82 100644
--- a/tools/testing/selftests/bpf/progs/rbtree_map.c
+++ b/tools/testing/selftests/bpf/progs/rbtree_map.c
@@ -11,12 +11,18 @@ struct node_data {
 	__u32 two;
 };
 
+long calls;
+struct bpf_spin_lock rbtree_lock SEC(".bss.private");
+
 struct {
 	__uint(type, BPF_MAP_TYPE_RBTREE);
 	__type(value, struct node_data);
-} rbtree SEC(".maps");
-
-long calls;
+	__array(lock, struct bpf_spin_lock);
+} rbtree SEC(".maps") = {
+	.lock = {
+		[0] = &rbtree_lock,
+	},
+};
 
 static bool less(struct rb_node *a, const struct rb_node *b)
 {
diff --git a/tools/testing/selftests/bpf/progs/rbtree_map_fail.c b/tools/testing/selftests/bpf/progs/rbtree_map_fail.c
index 287c8db080d8..ab4002a8211c 100644
--- a/tools/testing/selftests/bpf/progs/rbtree_map_fail.c
+++ b/tools/testing/selftests/bpf/progs/rbtree_map_fail.c
@@ -11,10 +11,17 @@ struct node_data {
 	__u32 two;
 };
 
+struct bpf_spin_lock rbtree_lock SEC(".bss.private");
+
 struct {
 	__uint(type, BPF_MAP_TYPE_RBTREE);
 	__type(value, struct node_data);
-} rbtree SEC(".maps");
+	__array(lock, struct bpf_spin_lock);
+} rbtree SEC(".maps") = {
+	.lock = {
+		[0] = &rbtree_lock,
+	},
+};
 
 long calls;
 
diff --git a/tools/testing/selftests/bpf/progs/rbtree_map_load_fail.c b/tools/testing/selftests/bpf/progs/rbtree_map_load_fail.c
index 036558eedd66..5578769efa2f 100644
--- a/tools/testing/selftests/bpf/progs/rbtree_map_load_fail.c
+++ b/tools/testing/selftests/bpf/progs/rbtree_map_load_fail.c
@@ -14,11 +14,18 @@ struct node_data_no_rb_node {
 	__u64 seven;
 };
 
+struct bpf_spin_lock rbtree_lock SEC(".bss.private");
+
 /* Should fail because value struct has no rb_node
  */
 struct {
 	__uint(type, BPF_MAP_TYPE_RBTREE);
 	__type(value, struct node_data_no_rb_node);
-} rbtree_fail_no_rb_node SEC(".maps");
+	__array(lock, struct bpf_spin_lock);
+} rbtree_fail_no_rb_node SEC(".maps") = {
+	.lock = {
+		[0] = &rbtree_lock,
+	},
+};
 
 char _license[] SEC("license") = "GPL";
-- 
2.30.2





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux