public inbox for linux-cxl@vger.kernel.org
 help / color / mirror / Atom feed
From: Dave Jiang <dave.jiang@intel.com>
To: Alison Schofield <alison.schofield@intel.com>,
	nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org
Subject: Re: [ndctl PATCH 1/3] test/cxl-destroy-region.sh: prevent false pass when no decoder found
Date: Mon, 6 Apr 2026 10:31:03 -0700	[thread overview]
Message-ID: <d88b9334-181d-4fb6-a694-ef2618c44e1d@intel.com> (raw)
In-Reply-To: <c2eccb9b0e596820940bfc7ec839ff807f3ac613.1775265383.git.alison.schofield@intel.com>



On 4/3/26 6:34 PM, Alison Schofield wrote:
> The destroy-region test assumed a free decoder was available and
> silently skipped execution when none could be found. When cxl_test
> began creating an auto region on module load, it consumed the decoder
> resource the test relied on, leading to false passes all the time.
> This was recently noticed during review of test logs.
> 
> Clear all regions at test start to reclaim decoder resources. Fail
> the test if no usable decoder is found and select the first match when
> multiple decoders satisfy the query.
> 
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>

For the series:

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


> ---
>  test/cxl-destroy-region.sh | 37 +++++++++++++++++++++++++++++++------
>  1 file changed, 31 insertions(+), 6 deletions(-)
> 
> diff --git a/test/cxl-destroy-region.sh b/test/cxl-destroy-region.sh
> index 3952060cf3e2..f03aa67e8b0d 100644
> --- a/test/cxl-destroy-region.sh
> +++ b/test/cxl-destroy-region.sh
> @@ -16,6 +16,22 @@ modprobe -r cxl_test
>  modprobe cxl_test
>  rc=1
>  
> +assert_no_regions()
> +{
> +	regions_json="$("$CXL" list -b "$CXL_TEST_BUS" -Ri)"
> +	[[ -n "$regions_json" ]] || err "$LINENO"
> +	[[ "$(jq 'length' <<<"$regions_json")" -eq 0 ]] || err "$LINENO"
> +}
> +
> +destroy_regions()
> +{
> +	if [[ "$*" ]]; then
> +		"$CXL" destroy-region -f -b "$CXL_TEST_BUS" "$@"
> +	else
> +		"$CXL" destroy-region -f -b "$CXL_TEST_BUS" all
> +	fi
> +}
> +
>  check_destroy_ram()
>  {
>  	mem=$1
> @@ -51,8 +67,15 @@ check_destroy_devdax()
>  	"$CXL" destroy-region "$region"
>  }
>  
> +# Get clean slate, including auto region resources
> +destroy_regions
> +assert_no_regions
> +
>  # Find a memory device to create regions on to test the destroy
>  readarray -t mems < <("$CXL" list -b "$CXL_TEST_BUS" -M | jq -r '.[].memdev')
> +[[ ${#mems[@]} -eq 0 ]] && err "$LINENO"
> +
> +found=0
>  for mem in "${mems[@]}"; do
>          ramsize="$("$CXL" list -m "$mem" | jq -r '.[].ram_size')"
>          if [[ $ramsize == "null" || ! $ramsize ]]; then
> @@ -63,13 +86,15 @@ for mem in "${mems[@]}"; do
>                    select(.volatile_capable == true) |
>                    select(.nr_targets == 1) |
>                    select(.max_available_extent >= ${ramsize}) |
> -                  .decoder")"
> -        if [[ $decoder ]]; then
> -		check_destroy_ram "$mem" "$decoder"
> -		check_destroy_devdax "$mem" "$decoder"
> -                break
> -        fi
> +                  .decoder" | head -n1)"
> +	[[ -z $decoder || $decoder == "null" ]] && continue
> +
> +	check_destroy_ram "$mem" "$decoder"
> +	check_destroy_devdax "$mem" "$decoder"
> +	found=1
> +	break
>  done
> +[[ $found -eq 1 ]] || err "$LINENO"
>  
>  check_dmesg "$LINENO"
>  


  parent reply	other threads:[~2026-04-06 17:33 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-04  1:34 [ndctl PATCH 1/3] test/cxl-destroy-region.sh: prevent false pass when no decoder found Alison Schofield
2026-04-04  1:34 ` [ndctl PATCH 2/3] cxl/region: prevent partial teardown on out-of-order destroy-region Alison Schofield
2026-04-04  1:34 ` [ndctl PATCH 3/3] test/cxl-destroy-region.sh: test out-of-order destroy-region handling Alison Schofield
2026-04-06 17:31 ` Dave Jiang [this message]
2026-04-14  3:12   ` [ndctl PATCH 1/3] test/cxl-destroy-region.sh: prevent false pass when no decoder found 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=d88b9334-181d-4fb6-a694-ef2618c44e1d@intel.com \
    --to=dave.jiang@intel.com \
    --cc=alison.schofield@intel.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