From: alison.schofield@intel.com
To: Vishal Verma <vishal.l.verma@intel.com>,
Dan Williams <dan.j.williams@intel.com>
Cc: Alison Schofield <alison.schofield@intel.com>,
nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org
Subject: [ndctl PATCH] cxl/test: Use interleave arithmetic to sort memdevs for a region
Date: Wed, 24 Aug 2022 16:09:58 -0700 [thread overview]
Message-ID: <20220824230958.125906-1-alison.schofield@intel.com> (raw)
From: Alison Schofield <alison.schofield@intel.com>
Test cxl-region-sysfs.sh assumes Modulo arithmetic. XOR arithmetic
is being introduced and requires a different ordering of the memdevs
in the region.
Update the test to sort the memdevs based on interleave arithmetic.
If the interleave arithmetic attribute for the root decoder is not
visible in sysfs, driver support for XOR math is not present. Default
to Modulo sorting order.
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
test/cxl-region-sysfs.sh | 44 ++++++++++++++++++++++++++++++++--------
1 file changed, 36 insertions(+), 8 deletions(-)
diff --git a/test/cxl-region-sysfs.sh b/test/cxl-region-sysfs.sh
index ae0f55653814..1af0ae7e632c 100644
--- a/test/cxl-region-sysfs.sh
+++ b/test/cxl-region-sysfs.sh
@@ -58,15 +58,43 @@ readarray -t mem_sort1 < <($CXL list -M -p $port_dev1 | jq -r ".[] | .memdev")
# TODO: add a cxl list option to list memdevs in valid region provisioning
# order, hardcode for now.
+
+# Sort based on root decoder interleave arithmetic.
+# Default to Modulo if the sysfs attribute is not emitted.
+if [ ! -e /sys/bus/cxl/devices/$decoder/interleave_arithmetic ]; then
+ ia="0"
+else
+ ia=$(cat /sys/bus/cxl/devices/$decoder/interleave_arithmetic)
+fi
+
mem_sort=()
-mem_sort[0]=${mem_sort0[0]}
-mem_sort[1]=${mem_sort1[0]}
-mem_sort[2]=${mem_sort0[2]}
-mem_sort[3]=${mem_sort1[2]}
-mem_sort[4]=${mem_sort0[1]}
-mem_sort[5]=${mem_sort1[1]}
-mem_sort[6]=${mem_sort0[3]}
-mem_sort[7]=${mem_sort1[3]}
+if [ $ia == "0" ]; then
+ # Modulo Arithmetic
+ mem_sort[0]=${mem_sort0[0]}
+ mem_sort[1]=${mem_sort1[0]}
+ mem_sort[2]=${mem_sort0[2]}
+ mem_sort[3]=${mem_sort1[2]}
+ mem_sort[4]=${mem_sort0[1]}
+ mem_sort[5]=${mem_sort1[1]}
+ mem_sort[6]=${mem_sort0[3]}
+ mem_sort[7]=${mem_sort1[3]}
+
+elif [ $ia == "1" ]; then
+ # XOR Arithmetic
+ mem_sort[0]=${mem_sort1[0]}
+ mem_sort[1]=${mem_sort0[0]}
+ mem_sort[2]=${mem_sort1[2]}
+ mem_sort[3]=${mem_sort0[2]}
+ mem_sort[4]=${mem_sort1[1]}
+ mem_sort[5]=${mem_sort0[1]}
+ mem_sort[6]=${mem_sort1[3]}
+ mem_sort[7]=${mem_sort0[3]}
+else
+ # Unknown Arithmetic
+ echo "Unknown interleave arithmetic: $ia for $decoder"
+ modprobe -r cxl-test
+ exit 1
+fi
# TODO: use this alternative memdev ordering to validate a negative test for
# specifying invalid positions of memdevs
base-commit: c9c9db39354ea0c3f737378186318e9b7908e3a7
--
2.31.1
next reply other threads:[~2022-08-24 23:10 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-08-24 23:09 alison.schofield [this message]
2022-08-24 23:28 ` [ndctl PATCH] cxl/test: Use interleave arithmetic to sort memdevs for a region Verma, Vishal L
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220824230958.125906-1-alison.schofield@intel.com \
--to=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox