On 27/01/26 04:45PM, Dave Jiang wrote: > > >On 1/26/26 3:48 PM, Dave Jiang wrote: >> >> >> On 1/23/26 4:31 AM, Neeraj Kumar wrote: >>> In 84ec985944ef3, devm_cxl_add_nvdimm() sequence was changed and called >>> before devm_cxl_add_endpoint(). It's because cxl pmem region auto-assembly >>> used to get called at last in cxl_endpoint_port_probe(), which requires >>> cxl_nvd presence. >>> >>> For cxl region persistency, region creation happens during nvdimm_probe >>> which need the completion of endpoint probe. >>> >>> In order to accommodate both cxl pmem region auto-assembly and cxl region >>> persistency, refactored following >>> >>> 1. Re-Sequence devm_cxl_add_nvdimm() after devm_cxl_add_endpoint(). This >>> will be called only after successful completion of endpoint probe. >>> >>> 2. Create cxl_region_discovery() which performs pmem region >>> auto-assembly and remove cxl pmem region auto-assembly from >>> cxl_endpoint_port_probe() >>> >>> 3. Register cxl_region_discovery() with devm_cxl_add_memdev() which gets >>> called during cxl_pci_probe() in context of cxl_mem_probe() >>> >>> 4. As cxlmd->attach->probe() calls registered cxl_region_discovery(), so >>> move devm_cxl_add_nvdimm() before cxlmd->attach->probe(). It guarantees >>> both the completion of endpoint probe and cxl_nvd presence before >>> calling cxlmd->attach->probe(). >>> >>> Reviewed-by: Jonathan Cameron >>> Reviewed-by: Dave Jiang >>> Signed-off-by: Neeraj Kumar >> >> Hi Neeraj, >> Just FYI this is the patch that breaks the auto-region assemble in cxl_test. > >So it's missing this part in cxl_test. cxl_test auto region is now showing up. But now I'm hitting some lockdep issues. > >--- >diff --git a/tools/testing/cxl/test/mem.c b/tools/testing/cxl/test/mem.c >index cb87e8c0e63c..03af15edd988 100644 >--- a/tools/testing/cxl/test/mem.c >+++ b/tools/testing/cxl/test/mem.c >@@ -1686,6 +1686,7 @@ static void cxl_mock_test_feat_init(struct cxl_mockmem_data *mdata) > > static int cxl_mock_mem_probe(struct platform_device *pdev) > { >+ struct cxl_memdev_attach memdev_attach = { 0 }; > struct device *dev = &pdev->dev; > struct cxl_memdev *cxlmd; > struct cxl_memdev_state *mds; >@@ -1767,7 +1768,8 @@ static int cxl_mock_mem_probe(struct platform_device *pdev) > > cxl_mock_add_event_logs(&mdata->mes); > >- cxlmd = devm_cxl_add_memdev(cxlds, NULL); >+ memdev_attach.probe = cxl_region_discovery; >+ cxlmd = devm_cxl_add_memdev(cxlds, &memdev_attach); > if (IS_ERR(cxlmd)) > return PTR_ERR(cxlmd); > >--- > > >> >> DJ Hi Dave, Yes using the above snippet auto region failure is getting fixed. But still with above fix cxl-topology.sh is failing. Actually we have a test case in cxl-topology.sh where we disable mem device and check its availability after enabling it. And this test case is failing in this case. I am working on multi interleave support. I will test this with next series and fix it accordingly. Regards, Neeraj