cxl_test: Limit location for fake CFMWS to mappable range
PATCH 1/1 cxl_test: Limit location for fake CFMWS to mappable range
Some architectures (e.g. arm64) only support memory hotplug operations on a restricted set of physical addresses. This applies even when we are faking some CXL fixed memory windows for the purposes of cxl_test. That range can be queried with mhp_get_pluggable_range(true). Use the minimum of that the top of that range and iomem_resource.end to establish the 64GiB region used by cxl_test.
From thread #2 which was related to the issue in #1.
---
I haven't given this a fixes tag because it never worked on arm64. So it isn't a regression fix, and I'm not sure we want to back port this which a fixes tag might well trigger. If people want one shout and I'll try and figure out what is appropriate.
--- tools/testing/cxl/test/cxl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
tools/testing/cxl/test/cxl.c +6 -1
@@ -2,6 +2,7 @@// Copyright(c) 2021 Intel Corporation. All rights reserved. #include <linux/platform_device.h> +#include <linux/memory_hotplug.h> #include <linux/genalloc.h> #include <linux/module.h> #include <linux/mutex.h>
@@ -1328,6 +1329,7 @@ static int cxl_mem_init(void)static __init int cxl_test_init (void ) {int rc, i; +struct range mappable;cxl_acpi_test ();cxl_core_test ();
@@ -1342,8 +1344,11 @@ static __init int cxl_test_init(void) rc = -ENOMEM ; goto err_gen_pool_create; } + mappable =mhp_get_pluggable_range (true); - rc =gen_pool_add (cxl_mock_pool, iomem_resource.end +1 -SZ_64G , + rc =gen_pool_add (cxl_mock_pool, +min (iomem_resource.end +1 -SZ_64G , + mappable.end +1 -SZ_64G ),SZ_64G ,NUMA_NO_NODE );if (rc) goto err_gen_pool_add;
Signature · 1 line
2.43.0
Alison Schofield
maintainerQuoted 47 lines · Jonathan Cameron
Some architectures (e.g. arm64) only support memory hotplug operations on a restricted set of physical addresses. This applies even when we are faking some CXL fixed memory windows for the purposes of
cxl_test. That range can be queried withmhp_get_pluggable_range(true). Use the minimum of that the top of that range and iomem_resource.end to establish the 64GiB region used bycxl_test.From thread #2 which was related to the issue in #1.
Reported-by Itaru Kitayama <[email protected]>Closes https://github.com/pmem/ndctl/issues/278 #1Reviewed-by Dan Williams <[email protected]>Tested-by Itaru Kitayama <[email protected] <mailto:[email protected]>Tested-by Marc Herbert <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>---
I haven't given this a fixes tag because it never worked on arm64. So it isn't a regression fix, and I'm not sure we want to back port this which a fixes tag might well trigger. If people want one shout and I'll try and figure out what is appropriate.--- tools/testing/cxl/test/cxl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)tools/testing/cxl/test/cxl.c +2
-0@@ -2,6 +2,7 @@// Copyright(c) 2021 Intel Corporation. All rights reserved. #include <linux/platform_device.h> +#include <linux/memory_hotplug.h> #include <linux/genalloc.h> #include <linux/module.h> #include <linux/mutex.h> @@ -1328,6 +1329,7 @@ static int cxl_mem_init(void)static __init int cxl_test_init (void ) {int rc, i; +struct range mappable;cxl_acpi_test ();cxl_core_test ();
tools/testing/cxl/test/cxl.c static __init int cxl_test_init(void) · line 1347
Quoted 4 lines
tools/testing/cxl/test/cxl.c +1
-0@@ -1342,8 +1344,11 @@ static __init int cxl_test_init(void) rc = -ENOMEM ; goto err_gen_pool_create; } + mappable =mhp_get_pluggable_range (true);
mhp_get_pluaggable_range() is only defined w CONFIG_MEMORY_HOTPLUG
This to tools/testing/cxl/config_check.c works for me:
+ BUILD_BUG_ON(!IS_ENABLED(CONFIG_MEMORY_HOTPLUG));
Quoted 11 lines
tools/testing/cxl/test/cxl.c +3
-1- rc =gen_pool_add (cxl_mock_pool, iomem_resource.end +1 -SZ_64G , + rc =gen_pool_add (cxl_mock_pool, +min (iomem_resource.end +1 -SZ_64G , + mappable.end +1 -SZ_64G ),SZ_64G ,NUMA_NO_NODE );if (rc) goto err_gen_pool_add;Signature · 1 line
2.43.0
Quoted 9 lines · Jonathan Cameron
Some architectures (e.g. arm64) only support memory hotplug operations on a restricted set of physical addresses. This applies even when we are faking some CXL fixed memory windows for the purposes of
cxl_test. That range can be queried withmhp_get_pluggable_range(true). Use the minimum of that the top of that range and iomem_resource.end to establish the 64GiB region used bycxl_test.From thread #2 which was related to the issue in #1.
Quoted 7 lines
Reported-by Itaru Kitayama <[email protected]>Closes https://github.com/pmem/ndctl/issues/278 #1Reviewed-by Dan Williams <[email protected]>Tested-by Itaru Kitayama <[email protected] <mailto:[email protected]>Tested-by Marc Herbert <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>
Applied to cxl/next
Added the config check from Alison
Quoted 43 lines
---
I haven't given this a fixes tag because it never worked on arm64. So it isn't a regression fix, and I'm not sure we want to back port this which a fixes tag might well trigger. If people want one shout and I'll try and figure out what is appropriate.--- tools/testing/cxl/test/cxl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)tools/testing/cxl/test/cxl.c +6
-1@@ -2,6 +2,7 @@// Copyright(c) 2021 Intel Corporation. All rights reserved. #include <linux/platform_device.h> +#include <linux/memory_hotplug.h> #include <linux/genalloc.h> #include <linux/module.h> #include <linux/mutex.h> @@ -1328,6 +1329,7 @@ static int cxl_mem_init(void)static __init int cxl_test_init (void ) {int rc, i; +struct range mappable;cxl_acpi_test ();cxl_core_test ();@@ -1342,8 +1344,11 @@ static __init int cxl_test_init(void) rc = -ENOMEM ; goto err_gen_pool_create; } + mappable =mhp_get_pluggable_range (true); - rc =gen_pool_add (cxl_mock_pool, iomem_resource.end +1 -SZ_64G , + rc =gen_pool_add (cxl_mock_pool, +min (iomem_resource.end +1 -SZ_64G , + mappable.end +1 -SZ_64G ),SZ_64G ,NUMA_NO_NODE );if (rc) goto err_gen_pool_add;
Quoted 18 lines · On Mon, 9 Jun 2025 10:25:41 -0700 Dave Jiang <[email protected]> wrote:
Quoted 9 lines · Jonathan Cameron
Some architectures (e.g. arm64) only support memory hotplug operations on a restricted set of physical addresses. This applies even when we are faking some CXL fixed memory windows for the purposes of
cxl_test. That range can be queried withmhp_get_pluggable_range(true). Use the minimum of that the top of that range and iomem_resource.end to establish the 64GiB region used bycxl_test.From thread #2 which was related to the issue in #1.
Quoted 7 lines
Reported-by Itaru Kitayama <[email protected]>Closes https://github.com/pmem/ndctl/issues/278 #1Reviewed-by Dan Williams <[email protected]>Tested-by Itaru Kitayama <[email protected] <mailto:[email protected]>Tested-by Marc Herbert <[email protected]>Signed-off-by Jonathan Cameron <[email protected]>
Quoted 3 lines
Applied to cxl/next
Added the config check from Alison
Thanks. Was about to send v2 but this is quicker ;)
Quoted 46 lines
Quoted 44 lines
---
I haven't given this a fixes tag because it never worked on arm64. So it isn't a regression fix, and I'm not sure we want to back port this which a fixes tag might well trigger. If people want one shout and I'll try and figure out what is appropriate.--- tools/testing/cxl/test/cxl.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)tools/testing/cxl/test/cxl.c +6
-1@@ -2,6 +2,7 @@// Copyright(c) 2021 Intel Corporation. All rights reserved. #include <linux/platform_device.h> +#include <linux/memory_hotplug.h> #include <linux/genalloc.h> #include <linux/module.h> #include <linux/mutex.h> @@ -1328,6 +1329,7 @@ static int cxl_mem_init(void)static __init int cxl_test_init (void ) {int rc, i; +struct range mappable;cxl_acpi_test ();cxl_core_test ();@@ -1342,8 +1344,11 @@ static __init int cxl_test_init(void) rc = -ENOMEM ; goto err_gen_pool_create; } + mappable =mhp_get_pluggable_range (true); - rc =gen_pool_add (cxl_mock_pool, iomem_resource.end +1 -SZ_64G , + rc =gen_pool_add (cxl_mock_pool, +min (iomem_resource.end +1 -SZ_64G , + mappable.end +1 -SZ_64G ),SZ_64G ,NUMA_NO_NODE );if (rc) goto err_gen_pool_add;