Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

dax/cxl, hmem: Initialize hmem early and defer dax_cxl binding

Move hmem/ earlier in the dax Makefile so that hmem_init() runs before
dax_cxl.

In addition, defer registration of the dax_cxl driver to a workqueue
instead of using module_cxl_driver(). This ensures that dax_hmem has
an opportunity to initialize and register its deferred callback and make
ownership decisions before dax_cxl begins probing and claiming Soft
Reserved ranges.

Mark the dax_cxl driver as PROBE_PREFER_ASYNCHRONOUS so its probe runs
out of line from other synchronous probing avoiding ordering
dependencies while coordinating ownership decisions with dax_hmem.

Signed-off-by: Smita Koralahalli <Smita.KoralahalliChannabasappa@amd.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Reviewed-by: Jonathan Cameron <jonathan.cameron@huawei.com>
Tested-by: Tomasz Wolski <tomasz.wolski@fujitsu.com>
Link: https://patch.msgid.link/20260322195343.206900-6-Smita.KoralahalliChannabasappa@amd.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: Dave Jiang <dave.jiang@intel.com>

authored by

Dan Williams and committed by
Dave Jiang
39aa1d4b edfcf1e2

+27 -3
+1 -2
drivers/dax/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0 2 + obj-y += hmem/ 2 3 obj-$(CONFIG_DAX) += dax.o 3 4 obj-$(CONFIG_DEV_DAX) += device_dax.o 4 5 obj-$(CONFIG_DEV_DAX_KMEM) += kmem.o ··· 11 10 device_dax-y := device.o 12 11 dax_pmem-y := pmem.o 13 12 dax_cxl-y := cxl.o 14 - 15 - obj-y += hmem/
+26 -1
drivers/dax/cxl.c
··· 38 38 .id = CXL_DEVICE_DAX_REGION, 39 39 .drv = { 40 40 .suppress_bind_attrs = true, 41 + .probe_type = PROBE_PREFER_ASYNCHRONOUS, 41 42 }, 42 43 }; 43 44 44 - module_cxl_driver(cxl_dax_region_driver); 45 + static void cxl_dax_region_driver_register(struct work_struct *work) 46 + { 47 + cxl_driver_register(&cxl_dax_region_driver); 48 + } 49 + 50 + static DECLARE_WORK(cxl_dax_region_driver_work, cxl_dax_region_driver_register); 51 + 52 + static int __init cxl_dax_region_init(void) 53 + { 54 + /* 55 + * Need to resolve a race with dax_hmem wanting to drive regions 56 + * instead of CXL 57 + */ 58 + queue_work(system_long_wq, &cxl_dax_region_driver_work); 59 + return 0; 60 + } 61 + module_init(cxl_dax_region_init); 62 + 63 + static void __exit cxl_dax_region_exit(void) 64 + { 65 + flush_work(&cxl_dax_region_driver_work); 66 + cxl_driver_unregister(&cxl_dax_region_driver); 67 + } 68 + module_exit(cxl_dax_region_exit); 69 + 45 70 MODULE_ALIAS_CXL(CXL_DEVICE_DAX_REGION); 46 71 MODULE_DESCRIPTION("CXL DAX: direct access to CXL regions"); 47 72 MODULE_LICENSE("GPL");