+13
−2
+3
−6
+59
−44
Loading
Both detach_target() and cxld_unregister() want to tear down a cxl_region when an endpoint decoder is either detached or destroyed. When a region is to be destroyed cxl_region_detach() releases cxl_region_rwsem unbinds the cxl_region driver and re-acquires the rwsem. This "reverse" locking pattern is difficult to reason about, not amenable to scope-based cleanup, and the minor differences in the calling context of detach_target() and cxld_unregister() currently results in the cxl_decoder_kill_region() wrapper. Introduce cxl_decoder_detach() to wrap a core __cxl_decoder_detach() that serves both cases. I.e. either detaching a known position in a region (interruptible), or detaching an endpoint decoder if it is found to be a member of a region (uninterruptible). Cc: Davidlohr Bueso <dave@stgolabs.net> Cc: Jonathan Cameron <jonathan.cameron@huawei.com> Cc: Dave Jiang <dave.jiang@intel.com> Cc: Alison Schofield <alison.schofield@intel.com> Cc: Vishal Verma <vishal.l.verma@intel.com> Cc: Ira Weiny <ira.weiny@intel.com> Acked-by:Peter Zijlstra (Intel) <peterz@infradead.org> Signed-off-by:
Dan Williams <dan.j.williams@intel.com> Reviewed-by:
Fabio M. De Francesco <fabio.m.de.francesco@linux.intel.com> Reviewed-by:
Dave Jiang <dave.jiang@intel.com> Reviewed-by:
Jonathan Cameron <jonathan.cameron@huawei.com> Reviewed-by:
Alison Schofield <alison.schofield@intel.com> Reviewed-by:
Davidlohr Bueso <dave@stgolabs.net> Link: https://patch.msgid.link/20250711234932.671292-8-dan.j.williams@intel.com Signed-off-by:
Dave Jiang <dave.jiang@intel.com>