mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Huang, Ying" <ying.huang@intel.com>
To: Alison Schofield <alison.schofield@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
	 <linux-cxl@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	 Andrew Morton <akpm@linux-foundation.org>,
	 Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	 Dave Jiang <dave.jiang@intel.com>,
	Bharata B Rao <bharata@amd.com>,
	 Alistair Popple <apopple@nvidia.com>,
	"Aneesh Kumar K . V" <aneesh.kumar@linux.ibm.com>
Subject: Re: [PATCH -V2] cxl/region: Support to calculate memory tier abstract distance
Date: Thu, 13 Jun 2024 08:40:04 +0800	[thread overview]
Message-ID: <87ikyd7k0r.fsf@yhuang6-desk2.ccr.corp.intel.com> (raw)
In-Reply-To: <Zmnc/bIkAQp6dpxQ@aschofie-mobl2> (Alison Schofield's message of "Wed, 12 Jun 2024 10:38:05 -0700")

Alison Schofield <alison.schofield@intel.com> writes:

> On Wed, Jun 12, 2024 at 10:09:14AM +0800, Ying Huang wrote:
>
> snip
>
>> >> ---
>> >>  drivers/cxl/core/region.c | 40 +++++++++++++++++++++++++++++++++++----
>> >>  drivers/cxl/cxl.h         |  2 ++
>> >>  2 files changed, 38 insertions(+), 4 deletions(-)
>> >> 
>> >> diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
>> >> index 3c2b6144be23..81d0910c0a02 100644
>> >> --- a/drivers/cxl/core/region.c
>> >> +++ b/drivers/cxl/core/region.c
>> >> @@ -9,6 +9,7 @@
>> >>  #include <linux/uuid.h>
>> >>  #include <linux/sort.h>
>> >>  #include <linux/idr.h>
>> >> +#include <linux/memory-tiers.h>
>> >>  #include <cxlmem.h>
>> >>  #include <cxl.h>
>> >>  #include "core.h"
>> >> @@ -2304,14 +2305,20 @@ static bool cxl_region_update_coordinates(struct cxl_region *cxlr, int nid)
>> >>  	return true;
>> >>  }
>> >>  
>> >> +static int cxl_region_nid(struct cxl_region *cxlr)
>> >> +{
>> >> +	struct cxl_region_params *p = &cxlr->params;
>> >> +	struct cxl_endpoint_decoder *cxled = p->targets[0];
>> >> +	struct cxl_decoder *cxld = &cxled->cxld;
>> >> +
>> >> +	return phys_to_target_node(cxld->hpa_range.start);
>> >> +}
>> >> +
>> >
>> > I believe it's OK to send a resource_size_t to phys_to_target_node()
>> > like this:
>> >
>> > --- a/drivers/cxl/core/region.c
>> > +++ b/drivers/cxl/core/region.c
>> > @@ -2308,10 +2308,8 @@ static bool cxl_region_update_coordinates(struct cxl_region *cxlr, int nid)
>> >  static int cxl_region_nid(struct cxl_region *cxlr)
>> >  {
>> >         struct cxl_region_params *p = &cxlr->params;
>> > -       struct cxl_endpoint_decoder *cxled = p->targets[0];
>> > -       struct cxl_decoder *cxld = &cxled->cxld;
>> >
>> > -       return phys_to_target_node(cxld->hpa_range.start);
>> > +       return phys_to_target_node(p->res->start);
>> >  }
>> >
>> 
>> I believe this works.  But the original implementation is just a
>> mechanical code movement from cxl_region_perf_attrs_callback().  So, I
>> prefer to keep it stupid. Then, further optimization can be done on top
>> of it.  Is it good for you?
>
> I prefer to do it now while we are thinking about it.
>
> How about a precursor patch:
> Patch 1/2: cxl/region: Add a region to node id helper
>
> --and then in that commit log you can say it's a simplified lookup 
> and is being done in preparation for adding another caller.

This works.  Will do it.

--
Best Regards,
Huang, Ying

  reply	other threads:[~2024-06-13  0:41 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-11  5:54 Huang Ying
2024-06-11 21:28 ` Alison Schofield
2024-06-12  2:09   ` Huang, Ying
2024-06-12 17:38     ` Alison Schofield
2024-06-13  0:40       ` Huang, Ying [this message]
2024-06-17  2:10   ` Huang, Ying
2024-06-17 17:06     ` Dave Jiang
2024-06-18  0:28       ` Huang, Ying
2024-06-12  4:22 ` Dan Williams

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=87ikyd7k0r.fsf@yhuang6-desk2.ccr.corp.intel.com \
    --to=ying.huang@intel.com \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=alison.schofield@intel.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=apopple@nvidia.com \
    --cc=bharata@amd.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.jiang@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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®