All of lore.kernel.org
 help / color / mirror / Atom feed
From: alison.schofield@intel.com
To: Vishal Verma <vishal.l.verma@intel.com>
Cc: Alison Schofield <alison.schofield@intel.com>,
	nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org
Subject: [ndctl PATCH v2 3/3] cxl/test: add 3-way HB interleave testcase to cxl-xor-region.sh
Date: Thu, 22 Feb 2024 17:40:05 -0800	[thread overview]
Message-ID: <256021e0e136965ebe92e3900bbe93aab014e28e.1708650921.git.alison.schofield@intel.com> (raw)
In-Reply-To: <cover.1708650921.git.alison.schofield@intel.com>

From: Alison Schofield <alison.schofield@intel.com>

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.

Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
 test/cxl-xor-region.sh | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/test/cxl-xor-region.sh b/test/cxl-xor-region.sh
index e536f0256202..b9e1d79212d3 100644
--- a/test/cxl-xor-region.sh
+++ b/test/cxl-xor-region.sh
@@ -87,11 +87,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
-- 
2.37.3


      parent reply	other threads:[~2024-02-23  1:40 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-23  1:40 [ndctl PATCH v2 0/3] Tidy-up, then expand, cxl-xor-region.sh alison.schofield
2024-02-23  1:40 ` [ndctl PATCH v2 1/3] cxl/test: replace spaces with tabs in cxl-xor-region.sh alison.schofield
2024-02-23  1:40 ` [ndctl PATCH v2 2/3] cxl/test: add double quotes " alison.schofield
2024-02-23  1:40 ` alison.schofield [this message]

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=256021e0e136965ebe92e3900bbe93aab014e28e.1708650921.git.alison.schofield@intel.com \
    --to=alison.schofield@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.