From: Dave Jiang <dave.jiang@intel.com>
To: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev
Cc: dave@stgolabs.net, jonathan.cameron@huawei.com,
alison.schofield@intel.com, vishal.l.verma@intel.com,
ira.weiny@intel.com, dan.j.williams@intel.com
Subject: [NDCTL PATCH 3/5] cxl/test: Move cxl-poison.sh to use cxl_test auto region
Date: Fri, 31 Oct 2025 10:40:01 -0700 [thread overview]
Message-ID: <20251031174003.3547740-4-dave.jiang@intel.com> (raw)
In-Reply-To: <20251031174003.3547740-1-dave.jiang@intel.com>
Move cxl-poison.sh to use the cxl_test auto region instead of manually
create an additional region. This is in preparation to allow utilize
the existing poison unit tests to also test the extended linear cache
region.
The offset has been changed due to the auto region starts at 0 and pmem
region starts at 0x40000000. The original test was creating a pmem
region. It makes no difference what type of region is being used for
testing.
Signed-off-by: Dave Jiang <dave.jiang@intel.com>
---
test/cxl-poison.sh | 38 ++++++++++++--------------------------
1 file changed, 12 insertions(+), 26 deletions(-)
diff --git a/test/cxl-poison.sh b/test/cxl-poison.sh
index 8e81baceeb24..430780cf7128 100644
--- a/test/cxl-poison.sh
+++ b/test/cxl-poison.sh
@@ -35,28 +35,14 @@ find_memdev()
memdev=${capable_mems[0]}
}
-create_x2_region()
+find_auto_region()
{
- # Find an x2 decoder
- decoder="$($CXL list -b "$CXL_TEST_BUS" -D -d root | jq -r ".[] |
- select(.pmem_capable == true) |
- select(.nr_targets == 2) |
- .decoder")"
-
- # 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")"
- mem0="$($CXL list -M -p "$port_dev0" | jq -r ".[0].memdev")"
- mem1="$($CXL list -M -p "$port_dev1" | jq -r ".[0].memdev")"
-
- region="$($CXL create-region -d "$decoder" -m "$mem0" "$mem1" |
- jq -r ".region")"
- if [[ ! $region ]]; then
- echo "create-region failed for $decoder"
- err "$LINENO"
- fi
+ region="$($CXL list -b "$CXL_TEST_BUS" -R | jq -r ".[0].region")"
+ [[ -n "$region" && "$region" != "null" ]] || do_skip "no test region found"
+ mem0="$($CXL list -r "$region" --targets | jq -r ".[0].mappings[0].memdev")"
+ [[ -n "$mem0" && "$mem0" != "null" ]] || do_skip "no region target0 found"
+ mem1="$($CXL list -r "$region" --targets | jq -r ".[0].mappings[1].memdev")"
+ [[ -n "$mem1" && "$mem1" != "null" ]] || do_skip "no region target1 found"
echo "$region"
}
@@ -153,12 +139,12 @@ test_poison_by_memdev_by_dpa()
test_poison_by_region_by_dpa()
{
- inject_poison_sysfs "$mem0" "0x40000000"
- inject_poison_sysfs "$mem1" "0x40000000"
+ inject_poison_sysfs "$mem0" "0"
+ inject_poison_sysfs "$mem1" "0"
validate_poison_found "-r $region" 2
- clear_poison_sysfs "$mem0" "0x40000000"
- clear_poison_sysfs "$mem1" "0x40000000"
+ clear_poison_sysfs "$mem0" "0"
+ clear_poison_sysfs "$mem1" "0"
validate_poison_found "-r $region" 0
}
@@ -228,7 +214,7 @@ echo 1 > /sys/kernel/tracing/events/cxl/cxl_poison/enable
echo 1 > /sys/kernel/tracing/tracing_on
test_poison_by_memdev_by_dpa
-create_x2_region
+find_auto_region
test_poison_by_region_by_dpa
[ -f "/sys/kernel/debug/cxl/$region/inject_poison" ] ||
do_skip "test cases requires inject by region kernel support"
--
2.51.0
next prev parent reply other threads:[~2025-10-31 17:40 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-31 17:39 [NDCTL PATCH 0/5] cxl: Add tests for extended linear cache support Dave Jiang
2025-10-31 17:39 ` [NDCTL PATCH 1/5] cxl/test: Add test " Dave Jiang
2025-11-15 1:00 ` Alison Schofield
2025-11-15 2:54 ` Alison Schofield
2025-11-16 1:49 ` Alison Schofield
2025-10-31 17:40 ` [NDCTL PATCH 2/5] cxl/test: Fix cxl-poison.sh to detect the correct elc sysfs attrib Dave Jiang
2025-11-15 0:54 ` Alison Schofield
2025-10-31 17:40 ` Dave Jiang [this message]
2025-11-15 1:07 ` [NDCTL PATCH 3/5] cxl/test: Move cxl-poison.sh to use cxl_test auto region Alison Schofield
2025-10-31 17:40 ` [NDCTL PATCH 4/5] cxl/test: Move common part of poison unit test to common file Dave Jiang
2025-10-31 17:40 ` [NDCTL PATCH 5/5] cxl/test: Add support for poison test for ELC Dave Jiang
2025-11-15 1:20 ` [NDCTL PATCH 0/5] cxl: Add tests for extended linear cache support Alison Schofield
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=20251031174003.3547740-4-dave.jiang@intel.com \
--to=dave.jiang@intel.com \
--cc=alison.schofield@intel.com \
--cc=dan.j.williams@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.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