* Re: [PATCH] cxl/acpi: fix CXL_ACPI=y + CXL_PMEM=m link failure
2026-03-02 20:04 [PATCH] cxl/acpi: fix CXL_ACPI=y + CXL_PMEM=m link failure Gregory Price
@ 2026-03-03 9:06 ` Harshit Mogalapalli
2026-03-03 10:13 ` Jonathan Cameron
2026-03-06 1:23 ` dan.j.williams
2 siblings, 0 replies; 8+ messages in thread
From: Harshit Mogalapalli @ 2026-03-03 9:06 UTC (permalink / raw)
To: Gregory Price, linux-cxl
Cc: linux-kernel, kernel-team, dave, jonathan.cameron, dave.jiang,
alison.schofield, vishal.l.verma, ira.weiny, dan.j.williams
Hi Gregory,
On 03/03/26 01:34, Gregory Price 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.
>
> Fixes: e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")
> Signed-off-by: Gregory Price <gourry@gourry.net>
We have run into the same issue as we have CXL_PMEM=m and CXL_ACPI=y,
and this fix looks good to me.
Reviewed-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
also, gave this patch a go with our config:
Tested-by: Harshit Mogalapalli <harshit.m.mogalapalli@oracle.com>
Thanks,
Harshit
> ---
> drivers/cxl/acpi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> index 127537628817..7065413eda9f 100644
> --- a/drivers/cxl/acpi.c
> +++ b/drivers/cxl/acpi.c
> @@ -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)
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] cxl/acpi: fix CXL_ACPI=y + CXL_PMEM=m link failure
2026-03-02 20:04 [PATCH] cxl/acpi: fix CXL_ACPI=y + CXL_PMEM=m link failure Gregory Price
2026-03-03 9:06 ` Harshit Mogalapalli
@ 2026-03-03 10:13 ` Jonathan Cameron
2026-03-03 15:21 ` Gregory Price
2026-03-06 1:23 ` dan.j.williams
2 siblings, 1 reply; 8+ messages in thread
From: Jonathan Cameron @ 2026-03-03 10:13 UTC (permalink / raw)
To: Gregory Price
Cc: linux-cxl, linux-kernel, kernel-team, dave, dave.jiang,
alison.schofield, vishal.l.verma, ira.weiny, dan.j.williams
On Mon, 2 Mar 2026 15:04:29 -0500
Gregory Price <gourry@gourry.net> 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.
>
> Fixes: e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")
> Signed-off-by: Gregory Price <gourry@gourry.net>
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 :)
> ---
> drivers/cxl/acpi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> index 127537628817..7065413eda9f 100644
> --- a/drivers/cxl/acpi.c
> +++ b/drivers/cxl/acpi.c
> @@ -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)
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] cxl/acpi: fix CXL_ACPI=y + CXL_PMEM=m link failure
2026-03-03 10:13 ` Jonathan Cameron
@ 2026-03-03 15:21 ` Gregory Price
0 siblings, 0 replies; 8+ messages in thread
From: Gregory Price @ 2026-03-03 15:21 UTC (permalink / raw)
To: Jonathan Cameron
Cc: linux-cxl, linux-kernel, kernel-team, dave, dave.jiang,
alison.schofield, vishal.l.verma, ira.weiny, dan.j.williams
On Tue, Mar 03, 2026 at 10:13:30AM +0000, Jonathan Cameron wrote:
> On Mon, 2 Mar 2026 15:04:29 -0500
> Gregory Price <gourry@gourry.net> 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.
> >
> > Fixes: e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")
> > Signed-off-by: Gregory Price <gourry@gourry.net>
>
> 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
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] cxl/acpi: fix CXL_ACPI=y + CXL_PMEM=m link failure
2026-03-02 20:04 [PATCH] cxl/acpi: fix CXL_ACPI=y + CXL_PMEM=m link failure Gregory Price
2026-03-03 9:06 ` Harshit Mogalapalli
2026-03-03 10:13 ` Jonathan Cameron
@ 2026-03-06 1:23 ` dan.j.williams
2026-03-06 22:18 ` Song Liu
2 siblings, 1 reply; 8+ messages in thread
From: dan.j.williams @ 2026-03-06 1:23 UTC (permalink / raw)
To: Gregory Price, linux-cxl
Cc: linux-kernel, kernel-team, dave, jonathan.cameron, dave.jiang,
alison.schofield, vishal.l.verma, ira.weiny, dan.j.williams
Gregory Price 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.
>
> Fixes: e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")
> Signed-off-by: Gregory Price <gourry@gourry.net>
> ---
> drivers/cxl/acpi.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> index 127537628817..7065413eda9f 100644
> --- a/drivers/cxl/acpi.c
> +++ b/drivers/cxl/acpi.c
> @@ -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.
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] cxl/acpi: fix CXL_ACPI=y + CXL_PMEM=m link failure
2026-03-06 1:23 ` dan.j.williams
@ 2026-03-06 22:18 ` Song Liu
2026-03-07 1:33 ` dan.j.williams
0 siblings, 1 reply; 8+ messages in thread
From: Song Liu @ 2026-03-06 22:18 UTC (permalink / raw)
To: dan.j.williams
Cc: Gregory Price, linux-cxl, linux-kernel, kernel-team, dave,
jonathan.cameron, dave.jiang, alison.schofield, vishal.l.verma,
ira.weiny
On Thu, Mar 5, 2026 at 5:23 PM <dan.j.williams@intel.com> wrote:
>
> Gregory Price 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.
> >
> > Fixes: e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")
> > Signed-off-by: Gregory Price <gourry@gourry.net>
> > ---
> > drivers/cxl/acpi.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> > index 127537628817..7065413eda9f 100644
> > --- a/drivers/cxl/acpi.c
> > +++ b/drivers/cxl/acpi.c
> > @@ -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.
Can we fix this with something like the following?
Thanks,
Song
diff --git i/drivers/cxl/Kconfig w/drivers/cxl/Kconfig
index 4589bf11d3fe..0290e0f22cf8 100644
--- i/drivers/cxl/Kconfig
+++ w/drivers/cxl/Kconfig
@@ -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
^ permalink raw reply related [flat|nested] 8+ messages in thread* Re: [PATCH] cxl/acpi: fix CXL_ACPI=y + CXL_PMEM=m link failure
2026-03-06 22:18 ` Song Liu
@ 2026-03-07 1:33 ` dan.j.williams
2026-03-07 1:49 ` Song Liu
0 siblings, 1 reply; 8+ messages in thread
From: dan.j.williams @ 2026-03-07 1:33 UTC (permalink / raw)
To: Song Liu, dan.j.williams
Cc: Gregory Price, linux-cxl, linux-kernel, kernel-team, dave,
jonathan.cameron, dave.jiang, alison.schofield, vishal.l.verma,
ira.weiny
Song Liu wrote:
> On Thu, Mar 5, 2026 at 5:23 PM <dan.j.williams@intel.com> wrote:
> >
> > Gregory Price 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.
> > >
> > > Fixes: e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")
> > > Signed-off-by: Gregory Price <gourry@gourry.net>
> > > ---
> > > drivers/cxl/acpi.c | 2 +-
> > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> > > index 127537628817..7065413eda9f 100644
> > > --- a/drivers/cxl/acpi.c
> > > +++ b/drivers/cxl/acpi.c
> > > @@ -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.
>
> 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
^ permalink raw reply [flat|nested] 8+ messages in thread* Re: [PATCH] cxl/acpi: fix CXL_ACPI=y + CXL_PMEM=m link failure
2026-03-07 1:33 ` dan.j.williams
@ 2026-03-07 1:49 ` Song Liu
0 siblings, 0 replies; 8+ messages in thread
From: Song Liu @ 2026-03-07 1:49 UTC (permalink / raw)
To: dan.j.williams
Cc: Gregory Price, linux-cxl, linux-kernel, kernel-team, dave,
jonathan.cameron, dave.jiang, alison.schofield, vishal.l.verma,
ira.weiny
On Fri, Mar 6, 2026 at 5:33 PM <dan.j.williams@intel.com> wrote:
>
> Song Liu wrote:
> > On Thu, Mar 5, 2026 at 5:23 PM <dan.j.williams@intel.com> wrote:
> > >
> > > Gregory Price 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.
> > > >
> > > > Fixes: e7e222ad73d9 ("cxl: Move devm_cxl_add_nvdimm_bridge() to cxl_pmem.ko")
> > > > Signed-off-by: Gregory Price <gourry@gourry.net>
> > > > ---
> > > > drivers/cxl/acpi.c | 2 +-
> > > > 1 file changed, 1 insertion(+), 1 deletion(-)
> > > >
> > > > diff --git a/drivers/cxl/acpi.c b/drivers/cxl/acpi.c
> > > > index 127537628817..7065413eda9f 100644
> > > > --- a/drivers/cxl/acpi.c
> > > > +++ b/drivers/cxl/acpi.c
> > > > @@ -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.
> >
> > 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
^ permalink raw reply [flat|nested] 8+ messages in thread