linux/drivers/cxl/core
Dan Williams f17b558d66 cxl/pmem: Refactor nvdimm device registration, delete the workqueue
The three objects 'struct cxl_nvdimm_bridge', 'struct cxl_nvdimm', and
'struct cxl_pmem_region' manage CXL persistent memory resources. The
bridge represents base platform resources, the nvdimm represents one or
more endpoints, and the region is a collection of nvdimms that
contribute to an assembled address range.

Their relationship is such that a region is torn down if any component
endpoints are removed. All regions and endpoints are torn down if the
foundational bridge device goes down.

A workqueue was deployed to manage these interdependencies, but it is
difficult to reason about, and fragile. A recent attempt to take the CXL
root device lock in the cxl_mem driver was reported by lockdep as
colliding with the flush_work() in the cxl_pmem flows.

Instead of the workqueue, arrange for all pmem/nvdimm devices to be torn
down immediately and hierarchically. A similar change is made to both
the 'cxl_nvdimm' and 'cxl_pmem_region' objects. For bisect-ability both
changes are made in the same patch which unfortunately makes the patch
bigger than desired.

Arrange for cxl_memdev and cxl_region to register a cxl_nvdimm and
cxl_pmem_region as a devres release action of the bridge device.
Additionally, include a devres release action of the cxl_memdev or
cxl_region device that triggers the bridge's release action if an endpoint
exits before the bridge. I.e. this allows either unplugging the bridge,
or unplugging and endpoint to result in the same cleanup actions.

To keep the patch smaller the cleanup of the now defunct workqueue
infrastructure is saved for a follow-on patch.

Tested-by: Robert Richter <rrichter@amd.com>
Link: https://lore.kernel.org/r/166993041773.1882361.16444301376147207609.stgit@dwillia2-xfh.jf.intel.com
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2022-12-02 23:07:22 -08:00
..
core.h cxl/region: Introduce cxl_pmem_region objects 2022-07-26 12:23:01 -07:00
hdm.c cxl/hdm: Fix skip allocations vs multiple pmem allocations 2022-08-05 16:11:38 -07:00
Makefile cxl/region: Add region creation support 2022-07-21 17:19:25 -07:00
mbox.c cxl/mbox: Add a check on input payload size 2022-10-20 16:28:53 -07:00
memdev.c cxl/mem: Convert partition-info to resources 2022-07-09 19:43:30 -07:00
pci.c cxl: Unify debug messages when calling devm_cxl_add_dport() 2022-11-14 10:37:08 -08:00
pmem.c cxl/pmem: Refactor nvdimm device registration, delete the workqueue 2022-12-02 23:07:22 -08:00
port.c cxl: Unify debug messages when calling devm_cxl_add_dport() 2022-11-14 10:37:08 -08:00
region.c cxl/pmem: Refactor nvdimm device registration, delete the workqueue 2022-12-02 23:07:22 -08:00
regs.c cxl/core: Check physical address before mapping it in devm_cxl_iomap_block() 2022-11-14 10:37:08 -08:00
suspend.c PM: CXL: Disable suspend 2022-04-22 16:09:42 -07:00