From: Dan Williams <dan.j.williams@intel.com>
To: Ira Weiny <ira.weiny@intel.com>,
Davidlohr Bueso <dave@stgolabs.net>,
Jonathan Cameron <jonathan.cameron@huawei.com>,
Dave Jiang <dave.jiang@intel.com>,
Alison Schofield <alison.schofield@intel.com>,
"Vishal Verma" <vishal.l.verma@intel.com>,
Dan Williams <dan.j.williams@intel.com>
Cc: <linux-cxl@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Ira Weiny <ira.weiny@intel.com>
Subject: Re: [PATCH] cxl/region: Remove lock from memory notifier callback
Date: Tue, 13 Aug 2024 13:29:19 -0700 [thread overview]
Message-ID: <66bbc21f7cfd3_216829434@dwillia2-mobl3.amr.corp.intel.com.notmuch> (raw)
In-Reply-To: <20240813-fix-notifiers-v1-1-efd23a18688d@intel.com>
Ira Weiny wrote:
> In testing Dynamic Capacity Device (DCD) support, a lockdep splat
> revealed an ABBA issue between the memory notifiers and the DCD extent
> processing code.[0] Changing the lock ordering within DCD proved
> difficult because regions must be stable while searching for the proper
> region and then the device lock must be held to properly notify the DAX
> region driver of memory changes.
>
> Dan points out in the thread that notifiers should be able to trust that
> it is safe to access static data. Region data is static once the device
> is realized and until it's destruction. Thus it is better to manage the
> notifiers within the region driver.
>
> Remove the need for a lock by ensuring the notifiers are active only
> during the region's lifetime.
>
> Link: https://lore.kernel.org/all/66b4cf539a79b_a36e829416@iweiny-mobl.notmuch/ [0]
> Cc: Huang, Ying <ying.huang@intel.com>
> Suggested-by: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> ---
> drivers/cxl/core/region.c | 31 ++++++++++++++++++++-----------
> 1 file changed, 20 insertions(+), 11 deletions(-)
>
> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> index 21ad5f242875..971a314b6b0e 100644
> --- a/drivers/cxl/core/region.c
> +++ b/drivers/cxl/core/region.c
[..]
> @@ -2396,7 +2394,6 @@ static int cxl_region_nid(struct cxl_region *cxlr)
> struct cxl_region_params *p = &cxlr->params;
> struct resource *res;
>
> - guard(rwsem_read)(&cxl_region_rwsem);
> res = p->res;
> if (!res)
> return NUMA_NO_NODE;
The cxl_region_nid() helper is now completely unnecessary because not
only is a lock not needed to read cxl_region_params, but p->res is
guaranteed to be non-NULL.
cxl_region_nid() also needs to be killed so that nothing else tries to
use it that might *need* the lock.
prev parent reply other threads:[~2024-08-13 20:29 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 18:25 Ira Weiny
2024-08-13 20:29 ` Dan Williams [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=66bbc21f7cfd3_216829434@dwillia2-mobl3.amr.corp.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=alison.schofield@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.com \
--cc=jonathan.cameron@huawei.com \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=vishal.l.verma@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®