Use CXL regions in daxctl-create unit test
[email protected]
maintainercover Use CXL regions in daxctl-create unit test
From: Alison Schofield <[email protected]>
efi_fake_mem support was removed from the kernel in v6.11 making this unit test SKIP, unable to find the hmem regions that relied upon the fake devices.
Pivoting to use the already available CXL regions seems like a good fit. The setup changes but the same DAX test functionality remains unchanged.
Please take a look.
Alison Schofield (2):
test/daxctl-create.sh: use bash math syntax to find available size test/daxctl-create.sh: use CXL DAX regions instead of efi_fake_mem
test/daxctl-create.sh | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-)
Signature · 1 line
2.37.3
[email protected]
maintainerPATCH 1/2 test/daxctl-create.sh: use bash math syntax to find available size
From: Alison Schofield <[email protected]>
The check for 1GB of available space in a DAX region always returned true due to being wrapped inside a [[ ... ]] test, even when space wasn't available. That caused set size to fail.
Update to use bash arithmetic evaluation instead.
This issue likely went unnoticed because users allocated >= 1GB of efi_fake_mem. This fix is part of the transition to use CXL regions in this test as efi_fake_mem support is being removed from the kernel.
--- test/daxctl-create.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
test/daxctl-create.sh +1 -1
@@ -363,7 +363,7 @@ daxctl_test6() # Use 2M by default or 1G if supported align=2097152 - if [[ $((available >= 1073741824 )) ]]; then + if (( available >= 1073741824 )); then align=1073741824 size=$align fi
Signature · 1 line
2.37.3
Re: [ndctl PATCH 1/2] test/daxctl-create.sh: use bash math syntax to find available size
Quoted 26 lines · On Tue, 2024-08-27 at 20:14 -0700, [email protected] wrote:
From: Alison Schofield <[email protected]>
The check for 1GB of available space in a DAX region always returned true due to being wrapped inside a [[ ... ]] test, even when space wasn't available. That caused set size to fail.
Update to use bash arithmetic evaluation instead.
This issue likely went unnoticed because users allocated >= 1GB of
efi_fake_mem. This fix is part of the transition to use CXL regions in this test asefi_fake_memsupport is being removed from the kernel.Signed-off-by Alison Schofield <[email protected]>---
test/daxctl-create.sh | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)test/daxctl-create.sh +0
-0@@ -363,7 +363,7 @@ daxctl_test6()
# Use 2M by default or 1G if supported
align=2097152
test/daxctl-create.sh daxctl_test6() · line 366
Quoted 2 lines
test/daxctl-create.sh +1
-1- if [[ $((available >= 1073741824 )) ]]; then + if (( available >= 1073741824 )); then
Yikes, good find!
Quoted 3 lines
align=1073741824
size=$align
fi
[email protected]
maintainerPATCH 2/2 test/daxctl-create.sh: use CXL DAX regions instead of efi_fake_mem
In reply to [email protected]From: Alison Schofield <[email protected]>
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.
--- test/daxctl-create.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)
test/daxctl-create.sh +7 -11
@@ -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
Signature · 1 line
2.37.3
Re: [ndctl PATCH 2/2] test/daxctl-create.sh: use CXL DAX regions instead of efi_fake_mem
Quoted 9 lines · alison.schofield@ wrote:
From: Alison Schofield <[email protected]>
This test tries to use DAX regions created from
efi_fake_memdevices. A recent kernel change removedefi_fake_memsupport 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.
Quoted 25 lines
Signed-off-by Alison Schofield <[email protected]>--- test/daxctl-create.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)test/daxctl-create.sh +3
-2@@ -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.
test/daxctl-create.sh find_testdev() · line 26
Quoted 10 lines
test/daxctl-create.sh +3
-7- 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:
Alison Schofield
maintainerRe: [ndctl PATCH 2/2] test/daxctl-create.sh: use CXL DAX regions instead of efi_fake_mem
Quoted 52 lines · Dan Williams
Quoted 9 lines · alison.schofield@ wrote:
From: Alison Schofield <[email protected]>
This test tries to use DAX regions created from
efi_fake_memdevices. A recent kernel change removedefi_fake_memsupport 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.
Quoted 25 lines
Signed-off-by Alison Schofield <[email protected]>--- test/daxctl-create.sh | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-)test/daxctl-create.sh +3
-2@@ -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.test/daxctl-create.sh find_testdev() · line 26
Quoted 10 lines
test/daxctl-create.sh +3
-7- 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_testCXL topology: "cxl_acpi.0"
Quoted 1 line
region_id="$("$DAXCTL" list -R | jq -r ".[] | select(.path | contains(\"cxl_acpi.0\")) | .id")"Will do. Thanks for the review!
Quoted 4 lines
...other than that you can add:
Reviewed-by Dan Williams <[email protected]>
Re: [ndctl PATCH 2/2] test/daxctl-create.sh: use CXL DAX regions instead of efi_fake_mem
In reply to [email protected]Quoted 11 lines · On Tue, 2024-08-27 at 20:14 -0700, [email protected] wrote:
From: Alison Schofield <[email protected]>
This test tries to use DAX regions created from
efi_fake_memdevices. A recent kernel change removedefi_fake_memsupport 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 <[email protected]>
Looks good,
Quoted 48 lines
---
test/daxctl-create.sh | 18 +++++++-----------1 file changed, 7 insertions(+), 11 deletions(-)test/daxctl-create.sh +0
-0@@ -7,6 +7,9 @@ rc=77
trap 'cleanup $LINENO' ERRtest/daxctl-create.sh +3
-0+modprobe -r cxl_test +modprobe cxl_test +cleanup()
{
printf "Error at line %d\n" "$1"test/daxctl-create.sh +0
-0@@ -18,18 +21,10 @@ find_testdev() {local rc=77
test/daxctl-create.sh +3
-9- # 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")"test/daxctl-create.sh +0
-2- # 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"test/daxctl-create.sh +0
-0@@ -413,4 +408,5 @@ daxctl_test5daxctl_test6
daxctl_test7
reset_dev
+modprobe -rcxl_test
exit 0