public inbox for linux-cxl@vger.kernel.org
 help / color / mirror / Atom feed
* [ndctl PATCH] test/cxl-topology.sh: verify dax device creation for auto region
@ 2026-03-23 22:01 Alison Schofield
  2026-03-23 22:25 ` Dave Jiang
  0 siblings, 1 reply; 3+ messages in thread
From: Alison Schofield @ 2026-03-23 22:01 UTC (permalink / raw)
  To: nvdimm, linux-cxl; +Cc: Alison Schofield

The auto-discovered CXL region should create a dax device with
matching size and resource mapping. A recent regression in the
no-soft-reserved case broke this behavior without test coverage.

Expand the existing auto-region check to validate the dax device.

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

diff --git a/test/cxl-topology.sh b/test/cxl-topology.sh
index d9475b1bae9c..170c9caf840b 100644
--- a/test/cxl-topology.sh
+++ b/test/cxl-topology.sh
@@ -22,12 +22,24 @@ rc=1
 # paired update must be made to this test.
 
 # validate the autodiscovered region
-region=$("$CXL" list -R | jq -r ".[] | .region")
-if [[ ! $region ]]; then
-	echo "failed to find autodiscovered region"
-	err "$LINENO"
-fi
+region_json=$("$CXL" list -R -u)
+[ -n "$region_json" ] || err "$LINENO"
+region=$(jq -r '.region // empty' <<<"$region_json")
+region_size=$(jq -r '.size // empty' <<<"$region_json")
+region_resource=$(jq -r '.resource // empty' <<<"$region_json")
+[ -n "$region" ] || err "$LINENO"
+[ -n "$region_size" ] || err "$LINENO"
+[ -n "$region_resource" ] || err "$LINENO"
 
+# validate the dax device created for the autodiscovered region
+dax_json=$("$DAXCTL" list -r "$region" -DMu)
+[ -n "$dax_json" ] || err "$LINENO"
+dax_dev=$(jq -r '.chardev // empty' <<<"$dax_json")
+dax_size=$(jq -r '.size // empty' <<<"$dax_json")
+dax_start=$(jq -r '.mappings[0].start // empty' <<<"$dax_json")
+[ -n "$dax_dev" ] || err "$LINENO"
+[ "$dax_size" = "$region_size" ] || err "$LINENO"
+[ "$dax_start" = "$region_resource" ] || err "$LINENO"
 
 # collect cxl_test root device id
 json=$($CXL list -b cxl_test)

base-commit: 99da468880dba2ec61ba2d9fdf8d48fc3bae085e
-- 
2.37.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [ndctl PATCH] test/cxl-topology.sh: verify dax device creation for auto region
  2026-03-23 22:01 [ndctl PATCH] test/cxl-topology.sh: verify dax device creation for auto region Alison Schofield
@ 2026-03-23 22:25 ` Dave Jiang
  2026-04-01 19:29   ` Alison Schofield
  0 siblings, 1 reply; 3+ messages in thread
From: Dave Jiang @ 2026-03-23 22:25 UTC (permalink / raw)
  To: Alison Schofield, nvdimm, linux-cxl



On 3/23/26 3:01 PM, Alison Schofield wrote:
> The auto-discovered CXL region should create a dax device with
> matching size and resource mapping. A recent regression in the
> no-soft-reserved case broke this behavior without test coverage.
> 
> Expand the existing auto-region check to validate the dax device.
> 
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>

I'm terrible with Bash and jq. AFAICT LGTM.

Reviewed-by: Dave Jiang <dave.jiang@intel.com>

 
> ---
>  test/cxl-topology.sh | 22 +++++++++++++++++-----
>  1 file changed, 17 insertions(+), 5 deletions(-)
> 
> diff --git a/test/cxl-topology.sh b/test/cxl-topology.sh
> index d9475b1bae9c..170c9caf840b 100644
> --- a/test/cxl-topology.sh
> +++ b/test/cxl-topology.sh
> @@ -22,12 +22,24 @@ rc=1
>  # paired update must be made to this test.
>  
>  # validate the autodiscovered region
> -region=$("$CXL" list -R | jq -r ".[] | .region")
> -if [[ ! $region ]]; then
> -	echo "failed to find autodiscovered region"
> -	err "$LINENO"
> -fi
> +region_json=$("$CXL" list -R -u)
> +[ -n "$region_json" ] || err "$LINENO"
> +region=$(jq -r '.region // empty' <<<"$region_json")
> +region_size=$(jq -r '.size // empty' <<<"$region_json")
> +region_resource=$(jq -r '.resource // empty' <<<"$region_json")
> +[ -n "$region" ] || err "$LINENO"
> +[ -n "$region_size" ] || err "$LINENO"
> +[ -n "$region_resource" ] || err "$LINENO"
>  
> +# validate the dax device created for the autodiscovered region
> +dax_json=$("$DAXCTL" list -r "$region" -DMu)
> +[ -n "$dax_json" ] || err "$LINENO"
> +dax_dev=$(jq -r '.chardev // empty' <<<"$dax_json")
> +dax_size=$(jq -r '.size // empty' <<<"$dax_json")
> +dax_start=$(jq -r '.mappings[0].start // empty' <<<"$dax_json")
> +[ -n "$dax_dev" ] || err "$LINENO"
> +[ "$dax_size" = "$region_size" ] || err "$LINENO"
> +[ "$dax_start" = "$region_resource" ] || err "$LINENO"
>  
>  # collect cxl_test root device id
>  json=$($CXL list -b cxl_test)
> 
> base-commit: 99da468880dba2ec61ba2d9fdf8d48fc3bae085e


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [ndctl PATCH] test/cxl-topology.sh: verify dax device creation for auto region
  2026-03-23 22:25 ` Dave Jiang
@ 2026-04-01 19:29   ` Alison Schofield
  0 siblings, 0 replies; 3+ messages in thread
From: Alison Schofield @ 2026-04-01 19:29 UTC (permalink / raw)
  To: Dave Jiang; +Cc: nvdimm, linux-cxl

On Mon, Mar 23, 2026 at 03:25:48PM -0700, Dave Jiang wrote:
> 
> 
> On 3/23/26 3:01 PM, Alison Schofield wrote:
> > The auto-discovered CXL region should create a dax device with
> > matching size and resource mapping. A recent regression in the
> > no-soft-reserved case broke this behavior without test coverage.
> > 
> > Expand the existing auto-region check to validate the dax device.
> > 
> > Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> 
> I'm terrible with Bash and jq. AFAICT LGTM.
> 
> Reviewed-by: Dave Jiang <dave.jiang@intel.com>

Thanks! Applied to pending:
https://github.com/pmem/ndctl/commit/38068a574696


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-01 19:29 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-23 22:01 [ndctl PATCH] test/cxl-topology.sh: verify dax device creation for auto region Alison Schofield
2026-03-23 22:25 ` Dave Jiang
2026-04-01 19:29   ` Alison Schofield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox