Smita Koralahalli wrote: > Introduce a global "DAX Regions" resource root and register each > dax_region->res under it via request_resource(). Release the resource on > dax_region teardown. > > By enforcing a single global namespace for dax_region allocations, this > ensures only one of dax_hmem or dax_cxl can successfully register a > dax_region for a given range. > > Co-developed-by: Dan Williams <[email protected]>
Did I send any code for this? If I suggested the locking below, apologies, otherwise Suggested-by is expected unless code is adopted from another patch. > Signed-off-by: Dan Williams <[email protected]> > Signed-off-by: Smita Koralahalli <[email protected]> > --- > drivers/dax/bus.c | 23 ++++++++++++++++++++--- > 1 file changed, 20 insertions(+), 3 deletions(-) > > diff --git a/drivers/dax/bus.c b/drivers/dax/bus.c > index fde29e0ad68b..5f387feb95f0 100644 > --- a/drivers/dax/bus.c > +++ b/drivers/dax/bus.c > @@ -10,6 +10,7 @@ > #include "dax-private.h" > #include "bus.h" > > +static struct resource dax_regions = DEFINE_RES_MEM_NAMED(0, -1, "DAX > Regions"); > static DEFINE_MUTEX(dax_bus_lock); > > /* > @@ -625,6 +626,8 @@ static void dax_region_unregister(void *region) > { > struct dax_region *dax_region = region; > > + scoped_guard(rwsem_write, &dax_region_rwsem) > + release_resource(&dax_region->res); I continue to dislike what scoped_guard() does to indentation. Often scoped_guard() usage can just be replaced by "helper that uses guard()" However, dax_region_rwsem protects subdivision of a dax_region, not coordination across regions. Also, release_resource() and request_resource() are already protected by the resource_lock, why is a new lock needed?

