* [ndctl PATCH] cxl/test: use max_available_extent in cxl-destroy-region
@ 2024-03-27 18:46 alison.schofield
2024-04-22 17:07 ` Verma, Vishal L
0 siblings, 1 reply; 3+ messages in thread
From: alison.schofield @ 2024-03-27 18:46 UTC (permalink / raw)
To: Vishal Verma; +Cc: Alison Schofield, nvdimm, linux-cxl
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 it used a
not 'null' comparison which always succeeds. Use the ! comparator
after create-region and for the ramsize check so that the test fails
or continues as expected.
Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
test/cxl-destroy-region.sh | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/test/cxl-destroy-region.sh b/test/cxl-destroy-region.sh
index cf0a46d6ba58..167fcc4a7ff9 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 ]]; 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"
base-commit: e0d0680bd3e554bd5f211e989480c5a13a023b2d
--
2.37.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [ndctl PATCH] cxl/test: use max_available_extent in cxl-destroy-region
2024-03-27 18:46 [ndctl PATCH] cxl/test: use max_available_extent in cxl-destroy-region alison.schofield
@ 2024-04-22 17:07 ` Verma, Vishal L
2024-04-22 20:43 ` Alison Schofield
0 siblings, 1 reply; 3+ messages in thread
From: Verma, Vishal L @ 2024-04-22 17:07 UTC (permalink / raw)
To: Schofield, Alison; +Cc: linux-cxl, nvdimm
On Wed, 2024-03-27 at 11:46 -0700, alison.schofield@intel.com 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 it used a
> not 'null' comparison which always succeeds. Use the ! comparator
> after create-region and for the ramsize check so that the test fails
> or continues as expected.
>
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> ---
> test/cxl-destroy-region.sh | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/test/cxl-destroy-region.sh b/test/cxl-destroy-region.sh
> index cf0a46d6ba58..167fcc4a7ff9 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
While these ! $region changes are correct (because cxl create-region)
doesn't output any json if creation fails)..
> 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 ]]; then
.. I think this check needs to check for both empty and "null" - a
memdev that doesn't have ram_size but otherwise emits valid json will
result in "null" here. e.g.:
$ echo "" | jq -r ".region"
$ echo "{ }" | jq -r ".region"
null
So this probably wants to be:
if [[ $ramsize == "null" || ! $ram_size ]]; 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"
>
> base-commit: e0d0680bd3e554bd5f211e989480c5a13a023b2d
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [ndctl PATCH] cxl/test: use max_available_extent in cxl-destroy-region
2024-04-22 17:07 ` Verma, Vishal L
@ 2024-04-22 20:43 ` Alison Schofield
0 siblings, 0 replies; 3+ messages in thread
From: Alison Schofield @ 2024-04-22 20:43 UTC (permalink / raw)
To: Verma, Vishal L; +Cc: linux-cxl, nvdimm
On Mon, Apr 22, 2024 at 10:07:58AM -0700, Vishal Verma wrote:
> On Wed, 2024-03-27 at 11:46 -0700, alison.schofield@intel.com 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 it used a
> > not 'null' comparison which always succeeds. Use the ! comparator
> > after create-region and for the ramsize check so that the test fails
> > or continues as expected.
> >
> > Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> > ---
> > test/cxl-destroy-region.sh | 8 ++++----
> > 1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/test/cxl-destroy-region.sh b/test/cxl-destroy-region.sh
> > index cf0a46d6ba58..167fcc4a7ff9 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
>
> While these ! $region changes are correct (because cxl create-region)
> doesn't output any json if creation fails)..
>
> > 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 ]]; then
>
> .. I think this check needs to check for both empty and "null" - a
> memdev that doesn't have ram_size but otherwise emits valid json will
> result in "null" here. e.g.:
>
> $ echo "" | jq -r ".region"
>
> $ echo "{ }" | jq -r ".region"
> null
>
> So this probably wants to be:
>
> if [[ $ramsize == "null" || ! $ram_size ]]; then
> ...
>
I see now! Thanks Vishal.
-- Alison
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-04-22 20:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-27 18:46 [ndctl PATCH] cxl/test: use max_available_extent in cxl-destroy-region alison.schofield
2024-04-22 17:07 ` Verma, Vishal L
2024-04-22 20:43 ` Alison Schofield
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).