From: "Koralahalli Channabasappa, Smita" <skoralah@amd.com>
To: Dan Williams <dan.j.williams@intel.com>,
Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>,
linux-cxl@vger.kernel.org, linux-kernel@vger.kernel.org,
nvdimm@lists.linux.dev, linux-fsdevel@vger.kernel.org,
linux-pm@vger.kernel.org
Cc: Ard Biesheuvel <ardb@kernel.org>,
Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
Ira Weiny <ira.weiny@intel.com>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Yazen Ghannam <yazen.ghannam@amd.com>,
Dave Jiang <dave.jiang@intel.com>,
Davidlohr Bueso <dave@stgolabs.net>,
Matthew Wilcox <willy@infradead.org>, Jan Kara <jack@suse.cz>,
"Rafael J . Wysocki" <rafael@kernel.org>,
Len Brown <len.brown@intel.com>, Pavel Machek <pavel@kernel.org>,
Li Ming <ming.li@zohomail.com>,
Jeff Johnson <jeff.johnson@oss.qualcomm.com>,
Ying Huang <huang.ying.caritas@gmail.com>,
Yao Xingtao <yaoxt.fnst@fujitsu.com>,
Peter Zijlstra <peterz@infradead.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Nathan Fontenot <nathan.fontenot@amd.com>,
Terry Bowman <terry.bowman@amd.com>,
Robert Richter <rrichter@amd.com>,
Benjamin Cheatham <benjamin.cheatham@amd.com>,
Zhijian Li <lizhijian@fujitsu.com>,
Borislav Petkov <bp@alien8.de>,
Tomasz Wolski <tomasz.wolski@fujitsu.com>
Subject: Re: [PATCH v8 3/9] dax/hmem: Request cxl_acpi and cxl_pci before walking Soft Reserved ranges
Date: Mon, 23 Mar 2026 22:46:27 -0700 [thread overview]
Message-ID: <2960e485-fe26-43b8-a950-9cdb5a090678@amd.com> (raw)
In-Reply-To: <69c19a8c66fd3_7ee3100e3@dwillia2-mobl4.notmuch>
Hi Dan,
On 3/23/2026 12:54 PM, Dan Williams wrote:
> Smita Koralahalli wrote:
>> From: Dan Williams <dan.j.williams@intel.com>
>>
>> Ensure cxl_acpi has published CXL Window resources before HMEM walks Soft
>> Reserved ranges.
>>
>> Replace MODULE_SOFTDEP("pre: cxl_acpi") with an explicit, synchronous
>> request_module("cxl_acpi"). MODULE_SOFTDEP() only guarantees eventual
>> loading, it does not enforce that the dependency has finished init
>> before the current module runs. This can cause HMEM to start before
>> cxl_acpi has populated the resource tree, breaking detection of overlaps
>> between Soft Reserved and CXL Windows.
>>
>> Also, request cxl_pci before HMEM walks Soft Reserved ranges. Unlike
>> cxl_acpi, cxl_pci attach is asynchronous and creates dependent devices
>> that trigger further module loads. Asynchronous probe flushing
>> (wait_for_device_probe()) is added later in the series in a deferred
>> context before HMEM makes ownership decisions for Soft Reserved ranges.
>>
>> Add an additional explicit Kconfig ordering so that CXL_ACPI and CXL_PCI
>> must be initialized before DEV_DAX_HMEM. This prevents HMEM from consuming
>> Soft Reserved ranges before CXL drivers have had a chance to claim them.
>>
>> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
>> Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
>> Reviewed-by: Dave Jiang <dave.jiang@intel.com>
>> Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
>> Reviewed-by: Alison Schofield <alison.schofield@intel.com>
>> ---
>> drivers/dax/Kconfig | 2 ++
>> drivers/dax/hmem/hmem.c | 17 ++++++++++-------
>> 2 files changed, 12 insertions(+), 7 deletions(-)
>>
>> diff --git a/drivers/dax/Kconfig b/drivers/dax/Kconfig
>> index d656e4c0eb84..3683bb3f2311 100644
>> --- a/drivers/dax/Kconfig
>> +++ b/drivers/dax/Kconfig
>> @@ -48,6 +48,8 @@ config DEV_DAX_CXL
>> tristate "CXL DAX: direct access to CXL RAM regions"
>> depends on CXL_BUS && CXL_REGION && DEV_DAX
>> default CXL_REGION && DEV_DAX
>> + depends on CXL_ACPI >= DEV_DAX_HMEM
>> + depends on CXL_PCI >= DEV_DAX_HMEM
>
> As I learned from Keith's recent CXL_PMEM dependency fix for CXL_ACPI
> [1], this wants to be:
>
> depends on DEV_DAX_HMEM || !DEV_DAX_HMEM
> depends on CXL_ACPI || !CXL_ACPI
> depends on CXL_PCI || !CXL_PCI
>
> ...to make sure that DEV_DAX_CXL can never be built-in unless all of its
> dependencies are built-in.
>
> [1]: http://lore.kernel.org/69aa341fcf526_6423c1002c@dwillia2-mobl4.notmuch
>
> At this point I am wondering if all of the feedback I have for this
> series should just be incremental fixes. I also want to have a canned
> unit test that verifies the base expectations. That can also be
> something I reply incrementally.
Two things on the Kconfig change:
When DEV_DAX_HMEM = y and CXL_ACPI = m and CXL_PCI = m
1. Regarding switching from >= to || ! pattern:
The >= pattern disabled DEV_DAX_CXL entirely when DEV_DAX_HMEM = y and
CXL_ACPI/CXL_PCI = m. So, HMEM unconditionally owned all ranges - the
CXL deferral path is never entered.
With the || ! pattern, DEV_DAX_CXL is enabled, which changes the
ownership behavior based on how the probes starts for CXL_ACPI/CXL_PCI.
On my system I see:
[ 7.379] dax_hmem_platform_probe began
[ 7.384] alloc_dev_dax_range: dax0.0
[ 28.560] cxl acpi probe started <- 21 seconds later
HMEM ends up owning in this case because CXL windows aren't published
yet when HMEM probes (built-in runs before modules load and
request_module might not work this early??), so region_intersects()
returns DISJOINT for all CXL ranges.
But it could go the other way if CXL ACPI and PCI probe starts before
the deferred work is queued in HMEM. (And I think this is the expected
path if DEV_DAX_CXL is enabled..)
But do you think it is okay as of now with resource exclusion handling??
2. Separate build issue with DEV_DAX_HMEM = y, CXL_BUS/ACPI/PCI = m and
CXL_REGION = y.
I hit this build error when I was testing the above config: (Sorry I
should have checked this config before)..
When DEV_DAX_HMEM = y and CXL core is built as a module hmem.c calls
cxl_region_contains_resource() which lives in cxl_core.ko causing an
undefined reference at link time.
This happens with both the >= and || ! Kconfig patterns.
The current #ifdef CONFIG_CXL_REGION guard evaluates to true even when
CXL_REGION is compiled into a module. Changing the guard to check
reachability of the actual module in include/cxl/cxl.h worked for me to
overcome the error:
-#ifdef CONFIG_CXL_REGION
+#if IS_REACHABLE(CONFIG_CXL_BUS) && defined(CONFIG_CXL_REGION)
bool cxl_region_contains_resource(struct resource *res);
#else
...
Not sure if CONFIG_CXL_BUS is the right check here or it should be more
specifically checking on CXL_ACPI or PCI..
Thanks
Smita
next prev parent reply other threads:[~2026-03-24 5:46 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-22 19:53 [PATCH v8 0/9] dax/hmem, cxl: Coordinate Soft Reserved handling with CXL and HMEM Smita Koralahalli
2026-03-22 19:53 ` [PATCH v8 1/9] dax/bus: Use dax_region_put() in alloc_dax_region() error path Smita Koralahalli
2026-03-23 17:11 ` Dave Jiang
2026-03-23 17:57 ` Jonathan Cameron
2026-03-23 19:37 ` Dan Williams
2026-03-22 19:53 ` [PATCH v8 2/9] dax/hmem: Factor HMEM registration into __hmem_register_device() Smita Koralahalli
2026-03-23 17:14 ` Dave Jiang
2026-03-23 17:59 ` Jonathan Cameron
2026-03-22 19:53 ` [PATCH v8 3/9] dax/hmem: Request cxl_acpi and cxl_pci before walking Soft Reserved ranges Smita Koralahalli
2026-03-23 19:54 ` Dan Williams
2026-03-24 5:46 ` Koralahalli Channabasappa, Smita [this message]
2026-03-24 16:25 ` Dan Williams
2026-03-22 19:53 ` [PATCH v8 4/9] dax/hmem: Gate Soft Reserved deferral on DEV_DAX_CXL Smita Koralahalli
2026-03-22 19:53 ` [PATCH v8 5/9] dax/cxl, hmem: Initialize hmem early and defer dax_cxl binding Smita Koralahalli
2026-03-22 19:53 ` [PATCH v8 6/9] dax: Track all dax_region allocations under a global resource tree Smita Koralahalli
2026-03-23 17:31 ` Dave Jiang
2026-03-23 20:55 ` Dan Williams
2026-03-22 19:53 ` [PATCH v8 7/9] cxl/region: Add helper to check Soft Reserved containment by CXL regions Smita Koralahalli
2026-03-22 19:53 ` [PATCH v8 8/9] dax/hmem, cxl: Defer and resolve Soft Reserved ownership Smita Koralahalli
2026-03-23 18:03 ` Jonathan Cameron
2026-03-23 18:13 ` Jonathan Cameron
2026-03-24 21:50 ` Koralahalli Channabasappa, Smita
2026-03-25 12:12 ` Jonathan Cameron
2026-03-23 18:17 ` Dave Jiang
2026-03-22 19:53 ` [PATCH v8 9/9] dax/hmem: Reintroduce Soft Reserved ranges back into the iomem tree Smita Koralahalli
2026-03-23 21:09 ` Dan Williams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2960e485-fe26-43b8-a950-9cdb5a090678@amd.com \
--to=skoralah@amd.com \
--cc=Smita.KoralahalliChannabasappa@amd.com \
--cc=alison.schofield@intel.com \
--cc=ardb@kernel.org \
--cc=benjamin.cheatham@amd.com \
--cc=bp@alien8.de \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=gregkh@linuxfoundation.org \
--cc=huang.ying.caritas@gmail.com \
--cc=ira.weiny@intel.com \
--cc=jack@suse.cz \
--cc=jeff.johnson@oss.qualcomm.com \
--cc=jonathan.cameron@huawei.com \
--cc=len.brown@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lizhijian@fujitsu.com \
--cc=ming.li@zohomail.com \
--cc=nathan.fontenot@amd.com \
--cc=nvdimm@lists.linux.dev \
--cc=pavel@kernel.org \
--cc=peterz@infradead.org \
--cc=rafael@kernel.org \
--cc=rrichter@amd.com \
--cc=terry.bowman@amd.com \
--cc=tomasz.wolski@fujitsu.com \
--cc=vishal.l.verma@intel.com \
--cc=willy@infradead.org \
--cc=yaoxt.fnst@fujitsu.com \
--cc=yazen.ghannam@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox