diff mbox series

[ndctl,2/2] test/daxctl-create.sh: use CXL DAX regions instead of efi_fake_mem

Message ID 519161e23a43e530dbcffac203ecbbb897aa5342.1724813664.git.alison.schofield@intel.com (mailing list archive)
State New
Headers show
Series Use CXL regions in daxctl-create unit test | expand

Commit Message

Alison Schofield Aug. 28, 2024, 3:14 a.m. UTC
From: Alison Schofield <alison.schofield@intel.com>

This test tries to use DAX regions created from efi_fake_mem devices.
A recent kernel change removed efi_fake_mem support causing this test
to SKIP because no DAX regions can be found.

Alas, a new source of DAX regions is available: CXL. Use that now.
Other than selecting a different region provider, the functionality
of the test remains the same.

Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
 test/daxctl-create.sh | 18 +++++++-----------
 1 file changed, 7 insertions(+), 11 deletions(-)

Comments

Dan Williams Aug. 29, 2024, 4:55 p.m. UTC | #1
alison.schofield@ wrote:
> From: Alison Schofield <alison.schofield@intel.com>
> 
> This test tries to use DAX regions created from efi_fake_mem devices.
> A recent kernel change removed efi_fake_mem support causing this test
> to SKIP because no DAX regions can be found.
> 
> Alas, a new source of DAX regions is available: CXL. Use that now.
> Other than selecting a different region provider, the functionality
> of the test remains the same.

CXL looks like a useful replacement.

> Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> ---
>  test/daxctl-create.sh | 18 +++++++-----------
>  1 file changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/test/daxctl-create.sh b/test/daxctl-create.sh
> index d968e7bedd82..1ef70f2ff186 100755
> --- a/test/daxctl-create.sh
> +++ b/test/daxctl-create.sh
> @@ -7,6 +7,9 @@ rc=77
>  
>  trap 'cleanup $LINENO' ERR
>  
> +modprobe -r cxl_test
> +modprobe cxl_test
> +
>  cleanup()
>  {
>  	printf "Error at line %d\n" "$1"
> @@ -18,18 +21,10 @@ find_testdev()
>  {
>  	local rc=77
>  
> -	# The hmem driver is needed to change the device mode, only
> -	# kernels >= v5.6 might have it available. Skip if not.
> -	if ! modinfo dax_hmem; then
> -		# check if dax_hmem is builtin
> -		if [ ! -d "/sys/module/device_hmem" ]; then
> -			printf "Unable to find hmem module\n"
> -			exit $rc
> -		fi
> -	fi
> +	# find a victim region provided by cxl_test
> +	bus="$("$CXL" list -b "$CXL_TEST_BUS" | jq -r '.[] | .bus')"
> +	region_id="$("$DAXCTL" list -R | jq -r ".[] | select(.path | contains(\"$bus\")) | .id")"

Might as well skip using cxl-list and instead use the known
platform device hosting the cxl_test CXL topology: "cxl_acpi.0"

    region_id="$("$DAXCTL" list -R | jq -r ".[] | select(.path | contains(\"cxl_acpi.0\")) | .id")"

...other than that you can add:

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Alison Schofield Aug. 29, 2024, 8:50 p.m. UTC | #2
On Thu, Aug 29, 2024 at 09:55:59AM -0700, Dan Williams wrote:
> alison.schofield@ wrote:
> > From: Alison Schofield <alison.schofield@intel.com>
> > 
> > This test tries to use DAX regions created from efi_fake_mem devices.
> > A recent kernel change removed efi_fake_mem support causing this test
> > to SKIP because no DAX regions can be found.
> > 
> > Alas, a new source of DAX regions is available: CXL. Use that now.
> > Other than selecting a different region provider, the functionality
> > of the test remains the same.
> 
> CXL looks like a useful replacement.
> 
> > Signed-off-by: Alison Schofield <alison.schofield@intel.com>
> > ---
> >  test/daxctl-create.sh | 18 +++++++-----------
> >  1 file changed, 7 insertions(+), 11 deletions(-)
> > 
> > diff --git a/test/daxctl-create.sh b/test/daxctl-create.sh
> > index d968e7bedd82..1ef70f2ff186 100755
> > --- a/test/daxctl-create.sh
> > +++ b/test/daxctl-create.sh
> > @@ -7,6 +7,9 @@ rc=77
> >  
> >  trap 'cleanup $LINENO' ERR
> >  
> > +modprobe -r cxl_test
> > +modprobe cxl_test
> > +
> >  cleanup()
> >  {
> >  	printf "Error at line %d\n" "$1"
> > @@ -18,18 +21,10 @@ find_testdev()
> >  {
> >  	local rc=77
> >  
> > -	# The hmem driver is needed to change the device mode, only
> > -	# kernels >= v5.6 might have it available. Skip if not.
> > -	if ! modinfo dax_hmem; then
> > -		# check if dax_hmem is builtin
> > -		if [ ! -d "/sys/module/device_hmem" ]; then
> > -			printf "Unable to find hmem module\n"
> > -			exit $rc
> > -		fi
> > -	fi
> > +	# find a victim region provided by cxl_test
> > +	bus="$("$CXL" list -b "$CXL_TEST_BUS" | jq -r '.[] | .bus')"
> > +	region_id="$("$DAXCTL" list -R | jq -r ".[] | select(.path | contains(\"$bus\")) | .id")"
> 
> Might as well skip using cxl-list and instead use the known
> platform device hosting the cxl_test CXL topology: "cxl_acpi.0"
> 
>     region_id="$("$DAXCTL" list -R | jq -r ".[] | select(.path | contains(\"cxl_acpi.0\")) | .id")"

Will do. Thanks for the review!

> 
> ...other than that you can add:
> 
> Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Verma, Vishal L Sept. 4, 2024, 12:34 a.m. UTC | #3
On Tue, 2024-08-27 at 20:14 -0700, alison.schofield@intel.com wrote:
> From: Alison Schofield <alison.schofield@intel.com>
> 
> This test tries to use DAX regions created from efi_fake_mem devices.
> A recent kernel change removed efi_fake_mem support causing this test
> to SKIP because no DAX regions can be found.
> 
> Alas, a new source of DAX regions is available: CXL. Use that now.
> Other than selecting a different region provider, the functionality
> of the test remains the same.
> 
> Signed-off-by: Alison Schofield <alison.schofield@intel.com>

Looks good,
Reviewed-by: Vishal Verma <vishal.l.verma@intel.com>

> ---
>  test/daxctl-create.sh | 18 +++++++-----------
>  1 file changed, 7 insertions(+), 11 deletions(-)
> 
> diff --git a/test/daxctl-create.sh b/test/daxctl-create.sh
> index d968e7bedd82..1ef70f2ff186 100755
> --- a/test/daxctl-create.sh
> +++ b/test/daxctl-create.sh
> @@ -7,6 +7,9 @@ rc=77
>  
>  trap 'cleanup $LINENO' ERR
>  
> +modprobe -r cxl_test
> +modprobe cxl_test
> +
>  cleanup()
>  {
>  	printf "Error at line %d\n" "$1"
> @@ -18,18 +21,10 @@ find_testdev()
>  {
>  	local rc=77
>  
> -	# The hmem driver is needed to change the device mode, only
> -	# kernels >= v5.6 might have it available. Skip if not.
> -	if ! modinfo dax_hmem; then
> -		# check if dax_hmem is builtin
> -		if [ ! -d "/sys/module/device_hmem" ]; then
> -			printf "Unable to find hmem module\n"
> -			exit $rc
> -		fi
> -	fi
> +	# find a victim region provided by cxl_test
> +	bus="$("$CXL" list -b "$CXL_TEST_BUS" | jq -r '.[] | .bus')"
> +	region_id="$("$DAXCTL" list -R | jq -r ".[] | select(.path |
> contains(\"$bus\")) | .id")"
>  
> -	# find a victim region provided by dax_hmem
> -	region_id="$("$DAXCTL" list -R | jq -r '.[] | select(.path |
> contains("hmem")) | .id')"
>  	if [[ ! "$region_id" ]]; then
>  		printf "Unable to find a victim region\n"
>  		exit "$rc"
> @@ -413,4 +408,5 @@ daxctl_test5
>  daxctl_test6
>  daxctl_test7
>  reset_dev
> +modprobe -r cxl_test
>  exit 0
diff mbox series

Patch

diff --git a/test/daxctl-create.sh b/test/daxctl-create.sh
index d968e7bedd82..1ef70f2ff186 100755
--- a/test/daxctl-create.sh
+++ b/test/daxctl-create.sh
@@ -7,6 +7,9 @@  rc=77
 
 trap 'cleanup $LINENO' ERR
 
+modprobe -r cxl_test
+modprobe cxl_test
+
 cleanup()
 {
 	printf "Error at line %d\n" "$1"
@@ -18,18 +21,10 @@  find_testdev()
 {
 	local rc=77
 
-	# The hmem driver is needed to change the device mode, only
-	# kernels >= v5.6 might have it available. Skip if not.
-	if ! modinfo dax_hmem; then
-		# check if dax_hmem is builtin
-		if [ ! -d "/sys/module/device_hmem" ]; then
-			printf "Unable to find hmem module\n"
-			exit $rc
-		fi
-	fi
+	# find a victim region provided by cxl_test
+	bus="$("$CXL" list -b "$CXL_TEST_BUS" | jq -r '.[] | .bus')"
+	region_id="$("$DAXCTL" list -R | jq -r ".[] | select(.path | contains(\"$bus\")) | .id")"
 
-	# find a victim region provided by dax_hmem
-	region_id="$("$DAXCTL" list -R | jq -r '.[] | select(.path | contains("hmem")) | .id')"
 	if [[ ! "$region_id" ]]; then
 		printf "Unable to find a victim region\n"
 		exit "$rc"
@@ -413,4 +408,5 @@  daxctl_test5
 daxctl_test6
 daxctl_test7
 reset_dev
+modprobe -r cxl_test
 exit 0