Skip to contentSkip to conversation

cxl/acpi: fix CXL_ACPI=y + CXL_PMEM=m link failure

PATCH In review Gregory Price 5 participants 8 messages Mar 2 – Mar 7 CXL

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cxl/acpi: fix CXL_ACPI=y + CXL_PMEM=m link failure

Commit e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko") moved devm_cxl_add_nvdimm_bridge() from cxl_core into cxl_pmem, creating a symbol dependency from cxl_acpi to cxl_pmem.

When CXL_ACPI=y and CXL_PMEM=m, the built-in cxl_acpi attempts to link against a non-built-in cxl_pmem, which the linker cannot resolve.

CXL_PMEM depends on LIBNVDIMM, so LIBNVDIMM=m constrains CXL_PMEM to at most =m.

Change IS_ENABLED() to IS_REACHABLE(), which returns false when a built-in caller references a modular target, preventing the link error.

The result is if the pmem/nvdimm symbols are not reachable at build time, then at runtime it will always return -ENODEV.

Fixes e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")
---
 drivers/cxl/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/acpi.c +1 -1
index 127537628817..7065413eda9f 100644
@@ -952,7 +952,7 @@ static int cxl_acpi_probe(struct platform_device *pdev)
 	if (rc < 0)
 		return rc;
 
-	if (IS_ENABLED(CONFIG_CXL_PMEM))
+	if (IS_REACHABLE(CONFIG_CXL_PMEM))
 		rc = device_for_each_child(&root_port->dev, root_port,
 					   add_root_nvdimm_bridge);
 	if (rc < 0)
Signature · 1 line
2.53.0
Reviewed-by Tested-by on v1 1/1
#1 lore raw

Hi Gregory,

Quoted 10 lines · Gregory Price

Commit e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko") moved devm_cxl_add_nvdimm_bridge() from cxl_core into cxl_pmem, creating a symbol dependency from cxl_acpi to cxl_pmem.

When CXL_ACPI=y and CXL_PMEM=m, the built-in cxl_acpi attempts to link against a non-built-in cxl_pmem, which the linker cannot resolve.

CXL_PMEM depends on LIBNVDIMM, so LIBNVDIMM=m constrains CXL_PMEM to at most =m.

Quoted 8 lines

Change IS_ENABLED() to IS_REACHABLE(), which returns false when a built-in caller references a modular target, preventing the link error.

The result is if the pmem/nvdimm symbols are not reachable at build time, then at runtime it will always return -ENODEV.

Fixes e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")

We have run into the same issue as we have CXL_PMEM=m and CXL_ACPI=y, and this fix looks good to me.

also, gave this patch a go with our config:

Thanks,
Harshit

Quoted 17 lines
---
  drivers/cxl/acpi.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/acpi.c +1 -1
index 127537628817..7065413eda9f 100644
@@ -952,7 +952,7 @@ static int cxl_acpi_probe(struct platform_device *pdev)
  	if (rc < 0)
  		return rc;
 
-	if (IS_ENABLED(CONFIG_CXL_PMEM))
+	if (IS_REACHABLE(CONFIG_CXL_PMEM))
  		rc = device_for_each_child(&root_port->dev, root_port,
  					   add_root_nvdimm_bridge);
  	if (rc < 0)
#2 lore raw
In reply to Gregory Price
Quoted 10 lines · On Mon, 2 Mar 2026 15:04:29 -0500 Gregory Price <[email protected]> wrote:

Commit e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko") moved devm_cxl_add_nvdimm_bridge() from cxl_core into cxl_pmem, creating a symbol dependency from cxl_acpi to cxl_pmem.

When CXL_ACPI=y and CXL_PMEM=m, the built-in cxl_acpi attempts to link against a non-built-in cxl_pmem, which the linker cannot resolve.

CXL_PMEM depends on LIBNVDIMM, so LIBNVDIMM=m constrains CXL_PMEM to at most =m.

Quoted 8 lines

Change IS_ENABLED() to IS_REACHABLE(), which returns false when a built-in caller references a modular target, preventing the link error.

The result is if the pmem/nvdimm symbols are not reachable at build time, then at runtime it will always return -ENODEV.

Fixes e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")

What's the impact of this build combination wrt to whether the result is
actually useful? Is there any point in building CXL_PMEM as a module
without this call being made? I can't remember and normally don't care much about PMEM :)

Quoted 17 lines
---
 drivers/cxl/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/acpi.c +1 -1
index 127537628817..7065413eda9f 100644
@@ -952,7 +952,7 @@ static int cxl_acpi_probe(struct platform_device *pdev)
 	if (rc < 0)
 		return rc;
 
-	if (IS_ENABLED(CONFIG_CXL_PMEM))
+	if (IS_REACHABLE(CONFIG_CXL_PMEM))
 		rc = device_for_each_child(&root_port->dev, root_port,
 					   add_root_nvdimm_bridge);
 	if (rc < 0)
#3 lore raw
Quoted 19 lines · Jonathan Cameron
Quoted 16 lines · On Mon, 2 Mar 2026 15:04:29 -0500 Gregory Price <[email protected]> wrote:

Commit e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko") moved devm_cxl_add_nvdimm_bridge() from cxl_core into cxl_pmem, creating a symbol dependency from cxl_acpi to cxl_pmem.

When CXL_ACPI=y and CXL_PMEM=m, the built-in cxl_acpi attempts to link against a non-built-in cxl_pmem, which the linker cannot resolve.

CXL_PMEM depends on LIBNVDIMM, so LIBNVDIMM=m constrains CXL_PMEM to at most =m.

Change IS_ENABLED() to IS_REACHABLE(), which returns false when a built-in caller references a modular target, preventing the link error.

The result is if the pmem/nvdimm symbols are not reachable at build time, then at runtime it will always return -ENODEV.

Quoted 8 lines
Quoted 2 lines
Fixes e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")

What's the impact of this build combination wrt to whether the result is
actually useful? Is there any point in building CXL_PMEM as a module
without this call being made? I can't remember and normally don't care much about PMEM :)

Basically no, it's not useful, but it's some definition of the default depending on your olddefconfig, so rather than fight with this further this basically terminates the same way DAX_CXL=m terminates.

tl;dr: You don't create the dax device / nbdimm and you're sad... but it does build!

~Gregory

#4 lore raw
In reply to Gregory Price
Quoted 27 lines · Gregory Price

Commit e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko") moved devm_cxl_add_nvdimm_bridge() from cxl_core into cxl_pmem, creating a symbol dependency from cxl_acpi to cxl_pmem.

When CXL_ACPI=y and CXL_PMEM=m, the built-in cxl_acpi attempts to link against a non-built-in cxl_pmem, which the linker cannot resolve.

CXL_PMEM depends on LIBNVDIMM, so LIBNVDIMM=m constrains CXL_PMEM to at most =m.

Change IS_ENABLED() to IS_REACHABLE(), which returns false when a built-in caller references a modular target, preventing the link error.

The result is if the pmem/nvdimm symbols are not reachable at build time, then at runtime it will always return -ENODEV.

Fixes e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")
---
 drivers/cxl/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/acpi.c +0 -0
index 127537628817..7065413eda9f 100644

drivers/cxl/acpi.c static int cxl_acpi_probe(struct platform_device *pdev) · line 957

Quoted 7 lines
drivers/cxl/acpi.c +1 -1
@@ -952,7 +952,7 @@ static int cxl_acpi_probe(struct platform_device *pdev)
 	if (rc < 0)
 		return rc;
 
-	if (IS_ENABLED(CONFIG_CXL_PMEM))
+	if (IS_REACHABLE(CONFIG_CXL_PMEM))
 		rc = device_for_each_child(&root_port->dev, root_port,
 					   add_root_nvdimm_bridge);

I think we want this conflict to be resolved at build time. The nice thing about a new CONFIG_CXL_ACPI_PMEM symbol is you can check your config to find out why your CXL PMEM is not working. Otherwise, IS_REACHABLE() hides this subtelty.

#5 lore raw
Quoted 32 lines · On Thu, Mar 5, 2026 at 5:23 PM <[email protected]> wrote:
Quoted 30 lines · Gregory Price

Commit e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko") moved devm_cxl_add_nvdimm_bridge() from cxl_core into cxl_pmem, creating a symbol dependency from cxl_acpi to cxl_pmem.

When CXL_ACPI=y and CXL_PMEM=m, the built-in cxl_acpi attempts to link against a non-built-in cxl_pmem, which the linker cannot resolve.

CXL_PMEM depends on LIBNVDIMM, so LIBNVDIMM=m constrains CXL_PMEM to at most =m.

Change IS_ENABLED() to IS_REACHABLE(), which returns false when a built-in caller references a modular target, preventing the link error.

The result is if the pmem/nvdimm symbols are not reachable at build time, then at runtime it will always return -ENODEV.

Fixes e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")
---
 drivers/cxl/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/acpi.c +0 -0
index 127537628817..7065413eda9f 100644
@@ -952,7 +952,7 @@ static int cxl_acpi_probe(struct platform_device *pdev)
      if (rc < 0)
              return rc;
 
Quoted 9 lines

drivers/cxl/acpi.c static int cxl_acpi_probe(struct platform_device *pdev) · line 957

Quoted 4 lines
drivers/cxl/acpi.c +1 -1
-     if (IS_ENABLED(CONFIG_CXL_PMEM))
+     if (IS_REACHABLE(CONFIG_CXL_PMEM))
              rc = device_for_each_child(&root_port->dev, root_port,
                                         add_root_nvdimm_bridge);

I think we want this conflict to be resolved at build time. The nice thing about a new CONFIG_CXL_ACPI_PMEM symbol is you can check your config to find out why your CXL PMEM is not working. Otherwise, IS_REACHABLE() hides this subtelty.

Can we fix this with something like the following?

Thanks,
Song

drivers/cxl/Kconfig +1 -0
index 4589bf11d3fe..0290e0f22cf8 100644
@@ -59,6 +59,7 @@ config CXL_ACPI
        tristate "CXL ACPI: Platform Support"
        depends on ACPI
        depends on ACPI_NUMA
+       depends on CXL_PMEM
        default CXL_BUS
        select ACPI_TABLE_LIB
        select ACPI_HMAT
#6 lore raw
Quoted 43 lines · Song Liu
Quoted 32 lines · On Thu, Mar 5, 2026 at 5:23 PM <[email protected]> wrote:
Quoted 30 lines · Gregory Price

Commit e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko") moved devm_cxl_add_nvdimm_bridge() from cxl_core into cxl_pmem, creating a symbol dependency from cxl_acpi to cxl_pmem.

When CXL_ACPI=y and CXL_PMEM=m, the built-in cxl_acpi attempts to link against a non-built-in cxl_pmem, which the linker cannot resolve.

CXL_PMEM depends on LIBNVDIMM, so LIBNVDIMM=m constrains CXL_PMEM to at most =m.

Change IS_ENABLED() to IS_REACHABLE(), which returns false when a built-in caller references a modular target, preventing the link error.

The result is if the pmem/nvdimm symbols are not reachable at build time, then at runtime it will always return -ENODEV.

Fixes e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")
---
 drivers/cxl/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/acpi.c +0 -0
index 127537628817..7065413eda9f 100644
@@ -952,7 +952,7 @@ static int cxl_acpi_probe(struct platform_device *pdev)
      if (rc < 0)
              return rc;
 
Quoted 9 lines

drivers/cxl/acpi.c static int cxl_acpi_probe(struct platform_device *pdev) · line 957

Quoted 4 lines
drivers/cxl/acpi.c +1 -1
-     if (IS_ENABLED(CONFIG_CXL_PMEM))
+     if (IS_REACHABLE(CONFIG_CXL_PMEM))
              rc = device_for_each_child(&root_port->dev, root_port,
                                         add_root_nvdimm_bridge);

I think we want this conflict to be resolved at build time. The nice thing about a new CONFIG_CXL_ACPI_PMEM symbol is you can check your config to find out why your CXL PMEM is not working. Otherwise, IS_REACHABLE() hides this subtelty.

Quoted 1 line

Can we fix this with something like the following?

BTW, this is queued now:

https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git/commit/?h=fixes&id=93d0fcdddc9e

#7 lore raw
Quoted 45 lines · On Fri, Mar 6, 2026 at 5:33 PM <[email protected]> wrote:
Quoted 43 lines · Song Liu
Quoted 41 lines · On Thu, Mar 5, 2026 at 5:23 PM <[email protected]> wrote:
Quoted 27 lines · Gregory Price

Commit e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko") moved devm_cxl_add_nvdimm_bridge() from cxl_core into cxl_pmem, creating a symbol dependency from cxl_acpi to cxl_pmem.

When CXL_ACPI=y and CXL_PMEM=m, the built-in cxl_acpi attempts to link against a non-built-in cxl_pmem, which the linker cannot resolve.

CXL_PMEM depends on LIBNVDIMM, so LIBNVDIMM=m constrains CXL_PMEM to at most =m.

Change IS_ENABLED() to IS_REACHABLE(), which returns false when a built-in caller references a modular target, preventing the link error.

The result is if the pmem/nvdimm symbols are not reachable at build time, then at runtime it will always return -ENODEV.

Fixes e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")
---
 drivers/cxl/acpi.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cxl/acpi.c +0 -0
index 127537628817..7065413eda9f 100644

drivers/cxl/acpi.c static int cxl_acpi_probe(struct platform_device *pdev) · line 957

Quoted 7 lines
drivers/cxl/acpi.c +1 -1
@@ -952,7 +952,7 @@ static int cxl_acpi_probe(struct platform_device *pdev)
      if (rc < 0)
              return rc;
 
-     if (IS_ENABLED(CONFIG_CXL_PMEM))
+     if (IS_REACHABLE(CONFIG_CXL_PMEM))
              rc = device_for_each_child(&root_port->dev, root_port,
                                         add_root_nvdimm_bridge);

I think we want this conflict to be resolved at build time. The nice thing about a new CONFIG_CXL_ACPI_PMEM symbol is you can check your config to find out why your CXL PMEM is not working. Otherwise, IS_REACHABLE() hides this subtelty.

Quoted 5 lines
Quoted 1 line

Can we fix this with something like the following?

BTW, this is queued now:

https://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl.git/commit/?h=fixes&id=93d0fcdddc9e

Aha, missed this one. Thanks for the information.

Song