Skip to contentSkip to conversation

cxl/test: Add 3-way HB interleave testcase to cxl-xor-region.sh

PATCH In review [email protected] 2 participants 3 messages Feb 14, 2024 libnvdimm: non-volatile memory device

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 cxl/test: Add 3-way HB interleave testcase to cxl-xor-region.sh

From: Alison Schofield <[email protected]>

cxl-xor-region.sh includes test cases for 1 & 2 way host bridge interleaves. Add a new test case to exercise the modulo math function the CXL driver uses to find positions in a 3-way host bridge interleave.

Skip this test case, don't fail, if the new 3-way XOR decoder is not present in cxl/test.

Add the missing check_dmesg helper before exiting this test.

---
 test/cxl-xor-region.sh | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
test/cxl-xor-region.sh +33 -0
index 117e7a4bba61..2f3b4aa5208a 100644
@@ -86,11 +86,44 @@ setup_x4()
         memdevs="$mem0 $mem1 $mem2 $mem3"
 }
 
+setup_x3()
+{
+        # find an x3 decoder
+        decoder=$($CXL list -b cxl_test -D -d root | jq -r ".[] |
+          select(.pmem_capable == true) |
+          select(.nr_targets == 3) |
+          .decoder")
+
+	if [[ ! $decoder ]]; then
+		echo "no x3 decoder found, skipping xor-x3 test"
+		return
+	fi
+
+        # Find a memdev for each host-bridge interleave position
+        port_dev0=$($CXL list -T -d "$decoder" | jq -r ".[] |
+            .targets | .[] | select(.position == 0) | .target")
+        port_dev1=$($CXL list -T -d "$decoder" | jq -r ".[] |
+            .targets | .[] | select(.position == 1) | .target")
+        port_dev2=$($CXL list -T -d "$decoder" | jq -r ".[] |
+            .targets | .[] | select(.position == 2) | .target")
+	mem0=$($CXL list -M -p "$port_dev0" | jq -r ".[0].memdev")
+	mem1=$($CXL list -M -p "$port_dev1" | jq -r ".[0].memdev")
+	mem2=$($CXL list -M -p "$port_dev2" | jq -r ".[0].memdev")
+	memdevs="$mem0 $mem1 $mem2"
+}
+
 setup_x1
 create_and_destroy_region
 setup_x2
 create_and_destroy_region
 setup_x4
 create_and_destroy_region
+# x3 decoder may not be available in cxl/test topo yet
+setup_x3
+if [[ $decoder ]]; then
+	create_and_destroy_region
+fi
+
+check_dmesg "$LINENO"
 
 modprobe -r cxl_test
Signature · 1 line
2.37.3
maintainer
#1 lore raw
Quoted 25 lines · On Tue, 2024-02-13 at 23:14 -0800, [email protected] wrote:

From: Alison Schofield <[email protected]>

cxl-xor-region.sh includes test cases for 1 & 2 way host bridge interleaves. Add a new test case to exercise the modulo math function the CXL driver uses to find positions in a 3-way host bridge interleave.

Skip this test case, don't fail, if the new 3-way XOR decoder is not present in cxl/test.

Add the missing check_dmesg helper before exiting this test.

---
 test/cxl-xor-region.sh | 33 +++++++++++++++++++++++++++++++++

 1 file changed, 33 insertions(+)
test/cxl-xor-region.sh +0 -0
index 117e7a4bba61..2f3b4aa5208a 100644
@@ -86,11 +86,44 @@ setup_x4()

         memdevs="$mem0 $mem1 $mem2 $mem3"
 }

test/cxl-xor-region.sh setup_x4() · line 95

Quoted 7 lines
test/cxl-xor-region.sh +7 -0
+setup_x3()
+{
+        # find an x3 decoder
+        decoder=$($CXL list -b cxl_test -D -d root | jq -r ".[] |
+          select(.pmem_capable == true) |
+          select(.nr_targets == 3) |
+          .decoder")

Are these lines..

test/cxl-xor-region.sh setup_x4() · line 108

Quoted 13 lines
test/cxl-xor-region.sh +13 -0
+
+	if [[ ! $decoder ]]; then
+		echo "no x3 decoder found, skipping xor-x3 test"
+		return
+	fi
+
+        # Find a memdev for each host-bridge interleave position
+        port_dev0=$($CXL list -T -d "$decoder" | jq -r ".[] |
+            .targets | .[] | select(.position == 0) | .target")
+        port_dev1=$($CXL list -T -d "$decoder" | jq -r ".[] |
+            .targets | .[] | select(.position == 1) | .target")
+        port_dev2=$($CXL list -T -d "$decoder" | jq -r ".[] |
+            .targets | .[] | select(.position == 2) | .target")

..and these mis-indented?

Looks good otherwise.

Quoted 21 lines
test/cxl-xor-region.sh +6 -0
+	mem0=$($CXL list -M -p "$port_dev0" | jq -r ".[0].memdev")
+	mem1=$($CXL list -M -p "$port_dev1" | jq -r ".[0].memdev")
+	mem2=$($CXL list -M -p "$port_dev2" | jq -r ".[0].memdev")
+	memdevs="$mem0 $mem1 $mem2"
+}
+

 setup_x1
 create_and_destroy_region
 setup_x2
 create_and_destroy_region
 setup_x4
 create_and_destroy_region

test/cxl-xor-region.sh +7 -0
+# x3 decoder may not be available in cxl/test topo yet
+setup_x3
+if [[ $decoder ]]; then
+	create_and_destroy_region
+fi
+
+check_dmesg "$LINENO"


 modprobe -r cxl_test

author maintainer
#2 lore raw
Quoted 36 lines · Vishal Verma
Quoted 22 lines · On Tue, 2024-02-13 at 23:14 -0800, [email protected] wrote:

From: Alison Schofield <[email protected]>

cxl-xor-region.sh includes test cases for 1 & 2 way host bridge interleaves. Add a new test case to exercise the modulo math function the CXL driver uses to find positions in a 3-way host bridge interleave.

Skip this test case, don't fail, if the new 3-way XOR decoder is not present in cxl/test.

Add the missing check_dmesg helper before exiting this test.

---
 test/cxl-xor-region.sh | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
test/cxl-xor-region.sh +0 -0
index 117e7a4bba61..2f3b4aa5208a 100644

test/cxl-xor-region.sh setup_x4() · line 95

Quoted 10 lines
test/cxl-xor-region.sh +7 -0
@@ -86,11 +86,44 @@ setup_x4()
         memdevs="$mem0 $mem1 $mem2 $mem3"
 }
 
+setup_x3()
+{
+        # find an x3 decoder
+        decoder=$($CXL list -b cxl_test -D -d root | jq -r ".[] |
+          select(.pmem_capable == true) |
+          select(.nr_targets == 3) |
+          .decoder")

Are these lines..

Quoted 15 lines

test/cxl-xor-region.sh setup_x4() · line 108

Quoted 13 lines
test/cxl-xor-region.sh +13 -0
+
+     if [[ ! $decoder ]]; then
+             echo "no x3 decoder found, skipping xor-x3 test"
+             return
+     fi
+
+        # Find a memdev for each host-bridge interleave position
+        port_dev0=$($CXL list -T -d "$decoder" | jq -r ".[] |
+            .targets | .[] | select(.position == 0) | .target")
+        port_dev1=$($CXL list -T -d "$decoder" | jq -r ".[] |
+            .targets | .[] | select(.position == 1) | .target")
+        port_dev2=$($CXL list -T -d "$decoder" | jq -r ".[] |
+            .targets | .[] | select(.position == 2) | .target")

..and these mis-indented?

Thanks for calling it out. I'll tidy up white space in a new revision.

snip

Quoted 1 line