[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220309183323.00000048@Huawei.com>
Date: Wed, 9 Mar 2022 18:33:23 +0000
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Dan Williams <dan.j.williams@...el.com>
CC: <gregkh@...uxfoundation.org>, <rafael.j.wysocki@...el.com>,
"Alison Schofield" <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
Ben Widawsky <ben.widawsky@...el.com>,
<linux-kernel@...r.kernel.org>, <linux-cxl@...r.kernel.org>,
<nvdimm@...ts.linux.dev>
Subject: Re: [PATCH 05/11] cxl/core: Introduce cxl_set_lock_class()
On Mon, 28 Feb 2022 18:49:17 -0800
Dan Williams <dan.j.williams@...el.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.schofield@...el.com>
> Cc: Vishal Verma <vishal.l.verma@...el.com>
> Cc: Ira Weiny <ira.weiny@...el.com>
> Cc: Ben Widawsky <ben.widawsky@...el.com>
> Signed-off-by: Dan Williams <dan.j.williams@...el.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?
> rc = device_add(dev);
> if (rc)
> goto err;
> diff --git a/drivers/cxl/cxl.h b/drivers/cxl/cxl.h
> index 1357a245037d..f94eff659cce 100644
> --- a/drivers/cxl/cxl.h
> +++ b/drivers/cxl/cxl.h
> @@ -543,5 +543,14 @@ static inline int cxl_lock_class(struct device *dev)
> else
> return CXL_ANON_LOCK;
> }
> +
> +static inline void cxl_set_lock_class(struct device *dev)
> +{
> + device_set_lock_class(dev, cxl_lock_class(dev));
> +}
> +#else
> +static inline void cxl_set_lock_class(struct device *dev)
> +{
> +}
> #endif
> #endif /* __CXL_H__ */
>
Powered by blists - more mailing lists