[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z5usQAlFsu3qfcvd@rric.localdomain>
Date: Thu, 30 Jan 2025 17:43:44 +0100
From: Robert Richter <rrichter@....com>
To: Gregory Price <gourry@...rry.net>
Cc: Alison Schofield <alison.schofield@...el.com>,
Vishal Verma <vishal.l.verma@...el.com>,
Ira Weiny <ira.weiny@...el.com>,
Dan Williams <dan.j.williams@...el.com>,
Jonathan Cameron <jonathan.cameron@...wei.com>,
Dave Jiang <dave.jiang@...el.com>,
Davidlohr Bueso <dave@...olabs.net>, linux-cxl@...r.kernel.org,
linux-kernel@...r.kernel.org,
"Fabio M. De Francesco" <fabio.m.de.francesco@...ux.intel.com>,
Terry Bowman <terry.bowman@....com>
Subject: Re: [PATCH v1 07/29] cxl/region: Factor out code to find a root
decoder's region
On Tue, Jan 07, 2025 at 11:59:43AM -0500, Gregory Price wrote:
> On Tue, Jan 07, 2025 at 03:09:53PM +0100, Robert Richter wrote:
> > In function cxl_add_to_region() there is code to determine a root
> > decoder's region. Factor that code out. This is in preparation to
> > further rework and simplify function cxl_add_to_region().
> >
> > No functional changes.
> >
> > Signed-off-by: Robert Richter <rrichter@....com>
> > ---
> > drivers/cxl/core/region.c | 24 ++++++++++++++++--------
> > 1 file changed, 16 insertions(+), 8 deletions(-)
> >
> ... snip ...
> > * one does the construction and the others add to that.
> > */
> > mutex_lock(&cxlrd->range_lock);
>
> If the function must be called with the cxlrd range lock held, then the
> function should have a comment/contract that states this.
No, the mutex locks the check for cxlr and construct_region().
cxl_find_region_by_range() itself doesn't need a lock.
-Robert
>
> > - region_dev = device_find_child(&cxlrd->cxlsd.cxld.dev, hpa,
> > - match_region_by_range);
> > - if (!region_dev) {
> > + cxlr = cxl_find_region_by_range(cxlrd, hpa);
> > + if (!cxlr)
> > cxlr = construct_region(cxlrd, cxled);
> > - region_dev = &cxlr->dev;
> > - } else
> > - cxlr = to_cxl_region(region_dev);
> > mutex_unlock(&cxlrd->range_lock);
> >
Powered by blists - more mailing lists