On Wed, Mar 9, 2022 at 10:33 AM Jonathan Cameron <jonathan.came...@huawei.com> wrote: > > On Mon, 28 Feb 2022 18:49:17 -0800 > Dan Williams <dan.j.willi...@intel.com> wrote: > > > Update CONFIG_PROVE_CXL_LOCKING to use the common device-core helpers > > for device_lock validation. > > > > When CONFIG_PROVE_LOCKING is enabled and device_set_lock_class() is > > passed a non-zero lock class the core acquires the 'struct device' > > @lockdep_mutex everywhere it acquires the device_lock. Where > > lockdep_mutex does not skip lockdep validation like device_lock. > > > > cxl_set_lock_class() wraps device_set_lock_class() as to not collide > > with other subsystems that may also support this lockdep validation > > scheme. See the 'choice' for the various CONFIG_PROVE_$SUBSYS_LOCKING > > options in lib/Kconfig.debug. > > > > Cc: Alison Schofield <alison.schofi...@intel.com> > > Cc: Vishal Verma <vishal.l.ve...@intel.com> > > Cc: Ira Weiny <ira.we...@intel.com> > > Cc: Ben Widawsky <ben.widaw...@intel.com> > > Signed-off-by: Dan Williams <dan.j.willi...@intel.com> > > One query inline - otherwise looks good to me. > > > --- > > > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c > > index b1a4ba622739..f0a821de94cf 100644 > > --- a/drivers/cxl/core/region.c > > +++ b/drivers/cxl/core/region.c > > @@ -476,6 +476,7 @@ int cxl_add_region(struct cxl_decoder *cxld, struct > > cxl_region *cxlr) > > if (rc) > > goto err; > > > > + cxl_set_lock_class(dev); > > I didn't see a cxl_lock_class for regions. Or is this meant to use > the ANON_LOCK?
Oh, yes, first I need to rebase this set before the region series which is going through a major revision. Second, I expect that the region lock_class may end up needing to nest inside the decoder lock class in order to facilitate decoders disconnecting themselves from regions if a memdev goes through ->remove() while an associated region is active. This series was motivated by wanting to validate the locking of the region creation sysfs-ABI versus device removal events.