From: anisa.su887@gmail.com
To: dan.j.williams@intel.com, ira.weiny@intel.com, dave@stgolabs.net,
linux-cxl@vger.kernel.org
Cc: nifan.cxl@gmail.com, dongjoo.seo1@samsung.com,
Fan Ni <fan.ni@samsung.com>, Anisa Su <anisa.su@samsung.com>
Subject: [RFC PATCH 2/3] dax/cxl: add existing dc extents when probing dax region
Date: Wed, 3 Dec 2025 20:29:12 +0000 [thread overview]
Message-ID: <20251203203540.1091827-3-anisa.su887@gmail.com> (raw)
In-Reply-To: <20251203203540.1091827-1-anisa.su887@gmail.com>
From: Fan Ni <fan.ni@samsung.com>
Add existing dc extents on the device before probing dax region will
cause the creation of the dax device fail as resource cannot present
when driver is bound to the device as shown in really_probe().
We delay the processing of existing dc extents to cxl region driver
probe.
Question: the guard() in cxlr_notify_extent() will cause lock issue,
removed it. Not sure whether it will cause issue or not although no
issue is observed during test.
Signed-off-by: Fan Ni <nifan.cxl@gmail.com>
Tested-by: Anisa Su <anisa.su@samsung.com>
Tested-by: Dongjoo Seo <dongjoo.seo1@samsung.com>
---
drivers/cxl/core/extent.c | 2 +-
drivers/cxl/core/region.c | 8 ++------
drivers/cxl/cxl.h | 5 +++++
drivers/dax/cxl.c | 24 +++++++-----------------
4 files changed, 15 insertions(+), 24 deletions(-)
diff --git a/drivers/cxl/core/extent.c b/drivers/cxl/core/extent.c
index 3e7295d3e5e2..3b0e4d72d4ac 100644
--- a/drivers/cxl/core/extent.c
+++ b/drivers/cxl/core/extent.c
@@ -285,7 +285,7 @@ static int cxlr_notify_extent(struct cxl_region *cxlr, enum dc_event event,
dev_dbg(dev, "Trying notify: type %d HPA %pra\n", event,
®ion_extent->hpa_range);
- guard(device)(dev);
+ // guard(device)(dev);
/*
* The lack of a driver indicates a notification has failed. No user
diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
index adab1f338ee9..da3ea3cf8585 100644
--- a/drivers/cxl/core/region.c
+++ b/drivers/cxl/core/region.c
@@ -3232,7 +3232,7 @@ static int devm_cxl_add_pmem_region(struct cxl_region *cxlr)
return rc;
}
-static int cxlr_add_existing_extents(struct cxl_region *cxlr)
+int cxlr_add_existing_extents(struct cxl_region *cxlr)
{
struct cxl_region_params *p = &cxlr->params;
int i, latched_rc = 0;
@@ -3251,6 +3251,7 @@ static int cxlr_add_existing_extents(struct cxl_region *cxlr)
return latched_rc;
}
+EXPORT_SYMBOL_NS_GPL(cxlr_add_existing_extents, "CXL");
static void cxlr_dax_unregister(void *_cxlr_dax)
{
@@ -3287,11 +3288,6 @@ static int devm_cxl_add_dax_region(struct cxl_region *cxlr)
dev_dbg(&cxlr->dev, "%s: register %s\n", dev_name(dev->parent),
dev_name(dev));
- if (cxlr->mode == CXL_PARTMODE_DYNAMIC_RAM_A)
- if (cxlr_add_existing_extents(cxlr))
- dev_err(&cxlr->dev, "Existing extent processing failed %d\n",
- rc);
-
return devm_add_action_or_reset(&cxlr->dev, cxlr_dax_unregister,
cxlr_dax);
err:
diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
index d22fe5e50647..3e400dd4f08b 100644
--- a/drivers/cxl/cxl.h
+++ b/drivers/cxl/cxl.h
@@ -926,6 +926,7 @@ struct cxl_pmem_region *to_cxl_pmem_region(struct device *dev);
int cxl_add_to_region(struct cxl_endpoint_decoder *cxled);
struct cxl_dax_region *to_cxl_dax_region(struct device *dev);
u64 cxl_port_get_spa_cache_alias(struct cxl_port *endpoint, u64 spa);
+int cxlr_add_existing_extents(struct cxl_region *cxlr);
#else
static inline bool is_cxl_pmem_region(struct device *dev)
{
@@ -948,6 +949,10 @@ static inline u64 cxl_port_get_spa_cache_alias(struct cxl_port *endpoint,
{
return 0;
}
+int cxlr_add_existing_extents(struct cxl_region *cxlr)
+{
+ return 0;
+}
#endif
void cxl_endpoint_parse_cdat(struct cxl_port *port);
diff --git a/drivers/dax/cxl.c b/drivers/dax/cxl.c
index 011bd1dc7691..15fc2de63185 100644
--- a/drivers/dax/cxl.c
+++ b/drivers/dax/cxl.c
@@ -18,21 +18,6 @@ static int __cxl_dax_add_resource(struct dax_region *dax_region,
return dax_region_add_resource(dax_region, dev, start, length);
}
-static int cxl_dax_add_resource(struct device *dev, void *data)
-{
- struct dax_region *dax_region = data;
- struct region_extent *region_extent;
-
- region_extent = to_region_extent(dev);
- if (!region_extent)
- return 0;
-
- dev_dbg(dax_region->dev, "Adding resource HPA %pra\n",
- ®ion_extent->hpa_range);
-
- return __cxl_dax_add_resource(dax_region, region_extent);
-}
-
static int cxl_dax_region_notify(struct device *dev,
struct cxl_notify_data *notify_data)
{
@@ -66,6 +51,7 @@ static int cxl_dax_region_probe(struct device *dev)
struct dev_dax_data data;
resource_size_t dev_size;
unsigned long flags;
+ int rc;
if (nid == NUMA_NO_NODE)
nid = memory_add_physaddr_to_nid(cxlr_dax->hpa_range.start);
@@ -80,8 +66,12 @@ static int cxl_dax_region_probe(struct device *dev)
return -ENOMEM;
if (cxlr->mode == CXL_PARTMODE_DYNAMIC_RAM_A) {
- device_for_each_child(&cxlr_dax->dev, dax_region,
- cxl_dax_add_resource);
+ rc = cxlr_add_existing_extents(cxlr);
+ /* If adding existing extents fails, continue with only an error
+ * message ?? */
+ if (rc)
+ dev_err(&cxlr->dev, "Existing extent processing failed %d\n",
+ rc);
/* Add empty seed dax device */
dev_size = 0;
} else {
--
2.51.0
next prev parent reply other threads:[~2025-12-03 20:36 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-03 20:29 [RFC PATCH 0/3] Add Support for Multiple DC Regions anisa.su887
2025-12-03 20:29 ` [RFC PATCH 1/3] core/region: fix return logic for store_targetN anisa.su887
2025-12-04 17:04 ` Ira Weiny
2025-12-03 20:29 ` anisa.su887 [this message]
2025-12-03 21:03 ` [RFC PATCH 2/3] dax/cxl: add existing dc extents when probing dax region Anisa Su
2025-12-04 17:29 ` Ira Weiny
2025-12-03 20:29 ` [RFC PATCH 3/3] dcd: Add support for multiple DC regions anisa.su887
2025-12-04 17:44 ` Ira Weiny
2025-12-03 21:19 ` [RFC PATCH 0/3] Add Support for Multiple DC Regions Anisa Su
2025-12-04 17:28 ` Ira Weiny
2025-12-11 21:05 ` Anisa Su
2025-12-12 22:07 ` Ira Weiny
2026-01-12 22:23 ` Anisa Su
2026-01-15 10:28 ` Alireza Sanaee
2026-02-11 1:44 ` Anisa Su
2026-02-11 9:34 ` Alireza Sanaee
2025-12-13 3:36 ` dan.j.williams
2026-01-12 22:50 ` Anisa Su
2026-01-13 0:08 ` Gregory Price
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=20251203203540.1091827-3-anisa.su887@gmail.com \
--to=anisa.su887@gmail.com \
--cc=anisa.su@samsung.com \
--cc=dan.j.williams@intel.com \
--cc=dave@stgolabs.net \
--cc=dongjoo.seo1@samsung.com \
--cc=fan.ni@samsung.com \
--cc=ira.weiny@intel.com \
--cc=linux-cxl@vger.kernel.org \
--cc=nifan.cxl@gmail.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