Linux CXL
 help / color / mirror / Atom feed
From: Alison Schofield <alison.schofield@intel.com>
To: nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org
Cc: Alison Schofield <alison.schofield@intel.com>,
	Richard Cheng <icheng@nvidia.com>
Subject: [ndctl PATCH] test/cxl-poison.sh: test scanning past fully mapped partitions
Date: Tue, 30 Jun 2026 21:42:02 -0700	[thread overview]
Message-ID: <20260701044205.1589967-1-alison.schofield@intel.com> (raw)

Listing poison by memdev scans the unmapped tail of every partition.
When an earlier partition is fully mapped, its tail is zero length, but
the scan must continue to later partitions. A regression caused the
scan to stop at the first fully-mapped partition, leaving later
partitions unscanned.

Backstop that behavior with a test case that fully maps a memdev's RAM
partition so its unmapped tail is zero length, then injects poison into
the unmapped PMEM partition that follows. The PMEM poison is only
reported if the scan continues past the fully-mapped RAM partition.

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

diff --git a/test/cxl-poison.sh b/test/cxl-poison.sh
index 49aa1b68c5c1..a03e08084eb4 100644
--- a/test/cxl-poison.sh
+++ b/test/cxl-poison.sh
@@ -219,6 +219,45 @@ test_poison_by_region_offset_negative()
 	clear_poison "$region" "$large_offset" true
 }
 
+# Backstop a driver fix where a fully mapped partition prematurely
+# terminated the unmapped poison scan.
+test_poison_unmapped_later_partition()
+{
+	local decoder ram_size pmem_dpa
+
+	check_min_kver "7.3" || return 0
+
+	# Free the auto region to use the ram capacity
+	$CXL destroy-region -f -b "$CXL_TEST_BUS" all
+
+	find_memdev
+
+	# Fully map the ram partition so it has a zero-length unmapped tail
+	decoder=$($CXL list -b "$CXL_TEST_BUS" -D -d root -m "$memdev" |
+		  jq -r ".[] |
+		  select(.volatile_capable == true) |
+		  select(.nr_targets == 1) |
+		  .decoder")
+	[[ -n "$decoder" && "$decoder" != "null" ]] ||
+		do_skip "no x1 volatile decoder found"
+
+	ram_size=$($CXL list -m "$memdev" | jq -r ".[0].ram_size")
+	[[ -n "$ram_size" && "$ram_size" != "null" ]] || err "$LINENO"
+
+	region=$($CXL create-region -t ram -d "$decoder" -m "$memdev" \
+		 -s "$ram_size" | jq -r ".region")
+	[[ -n "$region" && "$region" != "null" ]] || err "$LINENO"
+
+	# Poison the unmapped pmem tail
+	pmem_dpa=$ram_size
+	inject_poison "$memdev" "$pmem_dpa"
+	validate_poison_found "-m $memdev" 1
+	clear_poison "$memdev" "$pmem_dpa"
+	validate_poison_found "-m $memdev" 0
+
+	$CXL destroy-region -f -b "$CXL_TEST_BUS" "$region"
+}
+
 is_unaligned() {
 	local region=$1
 	local hbiw=$2
@@ -332,6 +371,7 @@ run_poison_test()
 		do_skip "test cases requires inject by region kernel support"
 	test_poison_by_region_offset
 	test_poison_by_region_offset_negative
+	test_poison_unmapped_later_partition
 }
 
 modprobe -r cxl_test

base-commit: 15e932c4e1318a9608ad9b799ad83a32a8b5970d
-- 
2.37.3


                 reply	other threads:[~2026-07-01  4:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20260701044205.1589967-1-alison.schofield@intel.com \
    --to=alison.schofield@intel.com \
    --cc=icheng@nvidia.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    /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