Skip to contentSkip to conversation

maple_tree: exchange entry1/entry2 to make seen_entry2 do see new value

PATCH In review Wei Yang 2 participants 2 messages Apr 8, 2025

Subsystems (3)
lore
Share & tools
lore

Wei Yang

author
#0 lore raw

PATCH 1/1 maple_tree: exchange entry1/entry2 to make seen_entry2 do see new value

During run_check_rcu() and run_check_rcu_slowread(), we would write entry2/entry3 to specified range and eval_rcu_entry() would test whether these value is seen by reader.

So we have three entries in struct rcu_test_struct:

* entry1: the original value during tree initialization
* entry2/entry3: value to be written

Currently we set entry2 to the original value, this would fool eval_rcu_entry() to see entry2 even there is no writer.

Exchange entry1/entry2 to make seen_entry2 do see new value.

CC Liam R. Howlett <[email protected]>
---
 tools/testing/radix-tree/maple.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/radix-tree/maple.c +4 -4
index 1e293e4d856d..fc6578f81cb0 100644
@@ -35323,8 +35323,8 @@ static noinline void __init check_rcu_threaded(struct maple_tree *mt)
 	vals.mt = mt;
 	vals.index = 4390;
 	vals.last = 4398;
-	vals.entry1 = xa_mk_value(4390);
-	vals.entry2 = xa_mk_value(439);
+	vals.entry1 = xa_mk_value(439);
+	vals.entry2 = xa_mk_value(4390);
 	vals.entry3 = xa_mk_value(439);
 	vals.seen_entry2 = 0;
 	vals.range_start = 4316;
@@ -35360,8 +35360,8 @@ static noinline void __init check_rcu_threaded(struct maple_tree *mt)
 	vals.mt = mt;
 	vals.index = 4390;
 	vals.last = 4398;
-	vals.entry1 = xa_mk_value(4390);
-	vals.entry2 = xa_mk_value(439);
+	vals.entry1 = xa_mk_value(439);
+	vals.entry2 = xa_mk_value(4390);
 	vals.entry3 = xa_mk_value(4391);
 	vals.seen_toggle = 0;
 	vals.seen_added = 0;
Signature · 1 line
2.34.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Wei Yang

During run_check_rcu() and run_check_rcu_slowread(), we would write entry2/entry3 to specified range and eval_rcu_entry() would test whether these value is seen by reader.

So we have three entries in struct rcu_test_struct:

* entry1: the original value during tree initialization
* entry2/entry3: value to be written

Quoted 7 lines

Currently we set entry2 to the original value, this would fool eval_rcu_entry() to see entry2 even there is no writer.

Exchange entry1/entry2 to make seen_entry2 do see new value.

CC Liam R. Howlett <[email protected]>
Quoted 33 lines
---
 tools/testing/radix-tree/maple.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
tools/testing/radix-tree/maple.c +4 -4
index 1e293e4d856d..fc6578f81cb0 100644
@@ -35323,8 +35323,8 @@ static noinline void __init check_rcu_threaded(struct maple_tree *mt)
 	vals.mt = mt;
 	vals.index = 4390;
 	vals.last = 4398;
-	vals.entry1 = xa_mk_value(4390);
-	vals.entry2 = xa_mk_value(439);
+	vals.entry1 = xa_mk_value(439);
+	vals.entry2 = xa_mk_value(4390);
 	vals.entry3 = xa_mk_value(439);
 	vals.seen_entry2 = 0;
 	vals.range_start = 4316;
@@ -35360,8 +35360,8 @@ static noinline void __init check_rcu_threaded(struct maple_tree *mt)
 	vals.mt = mt;
 	vals.index = 4390;
 	vals.last = 4398;
-	vals.entry1 = xa_mk_value(4390);
-	vals.entry2 = xa_mk_value(439);
+	vals.entry1 = xa_mk_value(439);
+	vals.entry2 = xa_mk_value(4390);
 	vals.entry3 = xa_mk_value(4391);
 	vals.seen_toggle = 0;
 	vals.seen_added = 0;
Signature · 1 line
2.34.1