cxl: Introduce devm_cxl_probe_mem() and fix region deletion
Get series with b4
b4 am [email protected]Versions newest first
- v1 Latest5 patches 17 repliesIn review
Patches in v1 No applies recorded yet
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/5 | cxl/region: Block region delete during region creationdrivers/ drivers/ drivers/ | +13 | 2 replies | |
| 2/5 | cxl/region: Resolve region deletion racesdrivers/ drivers/ drivers/ +1 more | +44 | 2 replies | |
| 3/5 | cxl/memdev: Pin parents for entire memdev lifetimedrivers/ | +3 | 2 replies | |
| 4/5 | cxl/memdev: Introduce cxl_class_memdev_typedrivers/ drivers/ | +47 | 2 replies | |
| 5/5 | cxl/region: Introduce devm_cxl_probe_mem()drivers/ drivers/ drivers/ +3 more | +191 | 3 replies |
Reviews trailers per patch
All 5 patches have a Reviewed-by or Acked-by.
| Patch | Dave Jiang | Alejandro Lucero |
|---|---|---|
| 1/5 | R-b | R-b T-b |
| 2/5 | R-b | R-b T-b |
| 3/5 | R-b | R-b T-b |
| 4/5 | R-b | T-b |
| 5/5 | R-b | R-b T-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCH 0/5] cxl: Introduce devm_cxl_probe_mem() and fix region deletion
The devm_cxl_probe_mem() helper creates a memdev and retrieves a mapped HPA range for the device. At present the retrieved region information is expected to be established by platform firmware. A future update will auto-establish a region if one is not already present. This arranges for a simple CXL topology detach == Accelerator driver detach scheme.
Now, automatic region establishment on behalf of an accelerator driver also requires automatic region teardown. The existing scheme of triggering devm_release_action() of a cxl root device to destroy a region is racy [1]. There is no path to coordinate multiple devres actions, or conflicting devres actions, without using the devm_remove_action_nowarn() workaround.
Instead, move final region cleanup responsibility to the root decoder teardown path (devres action cxld_unregister()). Expand the root decoder @range_lock, renamed @regions_lock, to coordinate region creation, sysfs manageability, and deletion. The @regions_lock also prevents regions from disappearing mid-auto-assembly.
Changes from the initial RFC [2]:
* tested with Dave's type2 cxl_test
* fix region remove by endpoints (Dave, Alejandro)
* fix user triggered region remove (Sungwoo)
* fix lifetime of the @attach ops (Alison, sashiko)
* hide @attach details inside the CXL core
[1]: http://lore.kernel.org/[email protected]
[2]: http://lore.kernel.org/[email protected]
Dan Williams (5):
cxl/region: Block region delete during region creation cxl/region: Resolve region deletion races cxl/memdev: Pin parents for entire memdev lifetime cxl/memdev: Introduce cxl_class_memdev_type cxl/region: Introduce devm_cxl_probe_mem()
drivers/cxl/core/core.h | 2 + drivers/cxl/cxl.h | 8 +- drivers/cxl/cxlmem.h | 27 +++-- include/cxl/cxl.h | 3 + drivers/cxl/core/memdev.c | 20 +++- drivers/cxl/core/port.c | 7 +- drivers/cxl/core/region.c | 194 ++++++++++++++++++++++++++++++----- drivers/cxl/mem.c | 95 +++++++++++++---- drivers/cxl/pci.c | 2 +- tools/testing/cxl/test/mem.c | 2 +- 10 files changed, 297 insertions(+), 63 deletions(-)
base-commit: 5d6919055dec134de3c40167a490f33c74c12581
Signature · 1 line
2.53.0