Linux CXL
 help / color / mirror / Atom feed
From: Jim Harris <jim.harris@samsung.com>
To: Alison Schofield <alison.schofield@intel.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
	Jonathan Cameron <jonathan.cameron@huawei.com>,
	Dave Jiang <dave.jiang@intel.com>,
	"Vishal Verma" <vishal.l.verma@intel.com>,
	Ira Weiny <ira.weiny@intel.com>,
	"Dan Williams" <dan.j.williams@intel.com>,
	"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
	Dmytro Adamenko <dmytro.adamenko@intel.com>
Subject: Re: [PATCH v2 2/3] cxl/region: Calculate a target position in a region interleave
Date: Mon, 23 Oct 2023 18:34:46 +0000	[thread overview]
Message-ID: <ZTa8xNpBybwUXyc/@ubuntu> (raw)
In-Reply-To: <ZTa3FTfSGEDHotqG@aschofie-mobl2>

On Mon, Oct 23, 2023 at 11:10:29AM -0700, Alison Schofield wrote:
> On Tue, Oct 17, 2023 at 05:33:54PM +0000, Jim Harris wrote:
> > 
> > > On Oct 15, 2023, at 11:02 PM, alison.schofield@intel.com wrote:
> > > 
> > > + if (p->nr_targets != p->interleave_ways)
> > > + return 0;
> > 
> > There is code just before this that compares nr_targets and interleave_ways
> > before calling cxl_region_setup_targets().
> > 
> > Decoder fields are set between that comparison and here, but I see no reason
> > these fields shouldn’t be set before that earlier comparison. It actually
> > makes the code more consistent, otherwise in the case where
> > cxl_region_setup_targets() fails, the first n-1 decoders have their fields
> > set, but the last one would not.
> > 
> > Then this return 0 can just be an else clause on the earlier comparison.
> > 
> 
> I see what you mean and my first thought was 'sure this could be a little
> cleanup before this patch', but then I struggle to justify it. Those first
> n-1 decoders have iw,ig,hpa fields set because we had hope that this region
> would create. On the last decoder, is there any value in setting up the
> decoder when we know it's a failed setup?
> 
> 

I have a patch outstanding in this same area, which may provide some
additional context.

https://lore.kernel.org/linux-cxl/169703589120.1202031.14696100866518083806.stgit@bgt-140510-bm03.eng.stellus.in/

I think the value is that the all of the decoders get treated the same.
Note that before the nr_targets == interleave_ways check, it sets
cxled->pos, as well as put the decoder in the targets array and
increments the nr_targets.

But ultimately my suggested changes probably belong more in my patch
(or a follow-up to my patch), so I think it's fine to skip my
feedback on this part.

Jim

  reply	other threads:[~2023-10-23 18:34 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-16  6:02 [PATCH v2 0/3] cxl/region: Autodiscovery position repair alison.schofield
2023-10-16  6:02 ` [PATCH v2 1/3] cxl/region: Prepare the decoder match range helper for reuse alison.schofield
2023-10-17 16:21   ` Jim Harris
2023-10-17 17:24     ` Jim Harris
2023-10-23 23:22       ` Alison Schofield
2023-10-17 20:43     ` Alison Schofield
2023-10-17 22:59       ` Jim Harris
2023-10-23 17:51     ` Alison Schofield
2023-10-23 20:54   ` Dan Williams
2023-10-23 23:30     ` Alison Schofield
2023-10-16  6:02 ` [PATCH v2 2/3] cxl/region: Calculate a target position in a region interleave alison.schofield
2023-10-17 17:33   ` Jim Harris
2023-10-23 18:10     ` Alison Schofield
2023-10-23 18:34       ` Jim Harris [this message]
2023-10-23 21:47   ` Dan Williams
2023-10-16  6:02 ` [PATCH v2 3/3] cxl/region: Use calc_interleave_pos() with autodiscovered regions alison.schofield
2023-10-17 17:40   ` Jim Harris
2023-10-23 21:58   ` Dan Williams
2023-10-24  0:42     ` Alison Schofield

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=ZTa8xNpBybwUXyc/@ubuntu \
    --to=jim.harris@samsung.com \
    --cc=alison.schofield@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=dave@stgolabs.net \
    --cc=dmytro.adamenko@intel.com \
    --cc=ira.weiny@intel.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=linux-cxl@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