diff mbox series

[ndctl,v2] cxl/test: use max_available_extent in cxl-destroy-region

Message ID 20240424025404.2343942-1-alison.schofield@intel.com (mailing list archive)
State Accepted
Commit 7c8c993b87ee8471b4c138de549c39d1267f0067
Delegated to: Patchwork Bot
Headers show
Series [ndctl,v2] cxl/test: use max_available_extent in cxl-destroy-region | expand

Commit Message

Alison Schofield April 24, 2024, 2:54 a.m. UTC
From: Alison Schofield <alison.schofield@intel.com>

Using .size in decoder selection can lead to a set_size failure with
these error messages:

cxl region: create_region: region8: set_size failed: Numerical result out of range

[] cxl_core:alloc_hpa:555: cxl region8: HPA allocation error (-34) for size:0x0000000020000000 in CXL Window 0 [mem 0xf010000000-0xf04fffffff flags 0x200]

Use max_available_extent for decoder selection instead.

The test overlooked the region creation failure because the not 'null'
comparison succeeds when cxl create-region command emits nothing.
Use the ! comparator when checking the create-region result.

When checking the ram_size output of cxl-list add a check for empty.

Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---

Changes in v2:
- Check ram_size json output for null or empty (Vishal)


 test/cxl-destroy-region.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)


base-commit: e0d0680bd3e554bd5f211e989480c5a13a023b2d

Comments

Ira Weiny April 25, 2024, 9:39 p.m. UTC | #1
alison.schofield@ wrote:
> From: Alison Schofield <alison.schofield@intel.com>
> 
> Using .size in decoder selection can lead to a set_size failure with
> these error messages:
> 
> cxl region: create_region: region8: set_size failed: Numerical result out of range
> 
> [] cxl_core:alloc_hpa:555: cxl region8: HPA allocation error (-34) for size:0x0000000020000000 in CXL Window 0 [mem 0xf010000000-0xf04fffffff flags 0x200]
> 
> Use max_available_extent for decoder selection instead.
> 
> The test overlooked the region creation failure because the not 'null'
> comparison succeeds when cxl create-region command emits nothing.
> Use the ! comparator when checking the create-region result.
> 
> When checking the ram_size output of cxl-list add a check for empty.
> 
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>

Reviewed-by: Ira Weiny <ira.weiny@intel.com>
diff mbox series

Patch

diff --git a/test/cxl-destroy-region.sh b/test/cxl-destroy-region.sh
index cf0a46d6ba58..3952060cf3e2 100644
--- a/test/cxl-destroy-region.sh
+++ b/test/cxl-destroy-region.sh
@@ -22,7 +22,7 @@  check_destroy_ram()
 	decoder=$2
 
 	region="$("$CXL" create-region -d "$decoder" -m "$mem" | jq -r ".region")"
-	if [ "$region" == "null" ]; then
+	if [[ ! $region ]]; then
 		err "$LINENO"
 	fi
 	"$CXL" enable-region "$region"
@@ -38,7 +38,7 @@  check_destroy_devdax()
 	decoder=$2
 
 	region="$("$CXL" create-region -d "$decoder" -m "$mem" | jq -r ".region")"
-	if [ "$region" == "null" ]; then
+	if [[ ! $region ]]; then
 		err "$LINENO"
 	fi
 	"$CXL" enable-region "$region"
@@ -55,14 +55,14 @@  check_destroy_devdax()
 readarray -t mems < <("$CXL" list -b "$CXL_TEST_BUS" -M | jq -r '.[].memdev')
 for mem in "${mems[@]}"; do
         ramsize="$("$CXL" list -m "$mem" | jq -r '.[].ram_size')"
-        if [[ $ramsize == "null" ]]; then
+        if [[ $ramsize == "null" || ! $ramsize ]]; then
                 continue
         fi
         decoder="$("$CXL" list -b "$CXL_TEST_BUS" -D -d root -m "$mem" |
                   jq -r ".[] |
                   select(.volatile_capable == true) |
                   select(.nr_targets == 1) |
-                  select(.size >= ${ramsize}) |
+                  select(.max_available_extent >= ${ramsize}) |
                   .decoder")"
         if [[ $decoder ]]; then
 		check_destroy_ram "$mem" "$decoder"