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.
What? > 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(). This does not make sense. The whole point of having devm_cxl_add_nvdimm() before devm_cxl_add_endpoint() is so that the typical region discovery path can consider pre-existing decoder settings *or* nvdimm labels in its assembly decisions. I would be surprised if this passes existing region assembly and ordering tests. This reads like "do not understand current ordering, change it for thin reasons".

