lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z5opYLL3Em4YCyiX@rric.localdomain>
Date: Wed, 29 Jan 2025 14:13:04 +0100
From: Robert Richter <rrichter@....com>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
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>,
	Dave Jiang <dave.jiang@...el.com>,
	Davidlohr Bueso <dave@...olabs.net>, linux-cxl@...r.kernel.org,
	linux-kernel@...r.kernel.org, Gregory Price <gourry@...rry.net>,
	"Fabio M. De Francesco" <fabio.m.de.francesco@...ux.intel.com>,
	Terry Bowman <terry.bowman@....com>
Subject: Re: [PATCH v1 06/29] cxl/region: Factor out code to find the root
 decoder

On 13.01.25 16:59:35, Jonathan Cameron wrote:
> On Tue, 7 Jan 2025 15:09:52 +0100
> Robert Richter <rrichter@....com> wrote:
> 
> > In function cxl_add_to_region() there is code to determine the root
> > decoder associated to an endpoint decoder. Factor out that code for
> > later reuse. This also simplifies the function cxl_add_to_region() as
> > the change reduces its size and the number of used variables.
> > 
> > The reference of cxlrd_dev can be freed earlier. Since the root
> > decoder exists as long as the root port exists and the endpoint
> > already holds a reference to the root port, this additional reference
> > is not needed. Though it looks obvious to use __free() for the
> > reference of cxlrd_dev here too, this is done in a later rework. So
> > just move the code.
> > 
> > Signed-off-by: Robert Richter <rrichter@....com>
> One trivial comment inline.
> 
> Reviewed-by: Jonathan Cameron <Jonathan.Cameron@...wei.com>
> 
> > ---
> >  drivers/cxl/core/region.c | 55 ++++++++++++++++++++++++++-------------
> >  1 file changed, 37 insertions(+), 18 deletions(-)
> > 
> > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> > index 752440a5c162..448408918def 100644
> > --- a/drivers/cxl/core/region.c
> > +++ b/drivers/cxl/core/region.c
> > @@ -3202,6 +3202,38 @@ static int match_root_decoder_by_range(struct device *dev, void *data)
> >  	return range_contains(r1, r2);
> >  }
> >  
> > +static struct cxl_root_decoder *
> > +cxl_find_root_decoder(struct cxl_endpoint_decoder *cxled)
> > +{
> > +	struct cxl_memdev *cxlmd = cxled_to_memdev(cxled);
> > +	struct cxl_port *port = cxled_to_port(cxled);
> > +	struct cxl_root *cxl_root __free(put_cxl_root) = find_cxl_root(port);
> > +	struct range *hpa = &cxled->cxld.hpa_range;
> > +	struct cxl_decoder *cxld = &cxled->cxld;
> 
> Flip this and the line above and you can have
> 
> 	struct range *hpa = cxld->hpa_range;

Changed that to:

	struct range *hpa = &cxld->hpa_range;

-Robert

> 
> which is both shorter and matches original code save a few moments of
> thinking.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ