From: Alison Schofield <alison.schofield@intel.com>
To: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Davidlohr Bueso <dave@stgolabs.net>,
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
Subject: Re: [PATCH v2 1/4] cxl/core: Rename cxl_trace_hpa() to cxl_translate()
Date: Fri, 7 Jun 2024 10:45:42 -0700 [thread overview]
Message-ID: <ZmNHRrzl2tJvR2SW@aschofie-mobl2> (raw)
In-Reply-To: <20240607154025.0000786d@Huawei.com>
On Fri, Jun 07, 2024 at 03:40:25PM +0100, Jonathan Cameron wrote:
> On Wed, 8 May 2024 11:47:50 -0700
> alison.schofield@intel.com wrote:
>
> > From: Alison Schofield <alison.schofield@intel.com>
> >
> > Although cxl_trace_hpa() is used to populate TRACE EVENTs with HPA
> > addresses, the work it performs is a translation (dpa->hpa), not a
> > trace. Rename it. Since this is the only translate work in CXL,
> > drop the _hpa suffix in the rename.
> >
> > Suggested-by: Dan Williams <dan.j.williams@intel.com>
> > Signed-off-by: Alison Schofield <alison.schofield@intel.com>
>
> Maybe makes some sense to keep the direction in the name?
>
> I can see for things like PPR we may need to go HPA to DPA as
> it'll be based on error counts that may be reported in HPA.
>
> So Friday bikeshedding time.
> cxl_dpa_to_hpa()?
Thanks for the review Jonathan!
Let's sync on the possible dpa->hpa->dpa use cases and then I'll
weigh in on your bikeshedding.
Agree we need HPA->DPA support for userspace. User needs ability
to find which device maps an HPA.
wrt PPR, do you think that is an in kernel need?
If the PPR maintenance was done in response to a CXL event, the DPA
is already in the event trace along with the HPA so I wouldn't expect
that a lookup is needed, at least not within the kernel.
Your explicit cxl_dpa_to_hpa() name is good.
--Alison
>
>
> > ---
> > drivers/cxl/core/core.h | 4 ++--
> > drivers/cxl/core/mbox.c | 2 +-
> > drivers/cxl/core/region.c | 2 +-
> > drivers/cxl/core/trace.h | 2 +-
> > 4 files changed, 5 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/cxl/core/core.h b/drivers/cxl/core/core.h
> > index 625394486459..8ceebd3b51d2 100644
> > --- a/drivers/cxl/core/core.h
> > +++ b/drivers/cxl/core/core.h
> > @@ -28,12 +28,12 @@ int cxl_region_init(void);
> > void cxl_region_exit(void);
> > int cxl_get_poison_by_endpoint(struct cxl_port *port);
> > struct cxl_region *cxl_dpa_to_region(const struct cxl_memdev *cxlmd, u64 dpa);
> > -u64 cxl_trace_hpa(struct cxl_region *cxlr, const struct cxl_memdev *cxlmd,
> > +u64 cxl_translate(struct cxl_region *cxlr, const struct cxl_memdev *cxlmd,
> > u64 dpa);
> >
> > #else
> > static inline u64
> > -cxl_trace_hpa(struct cxl_region *cxlr, const struct cxl_memdev *cxlmd, u64 dpa)
> > +cxl_translate(struct cxl_region *cxlr, const struct cxl_memdev *cxlmd, u64 dpa)
> > {
> > return ULLONG_MAX;
> > }
> > diff --git a/drivers/cxl/core/mbox.c b/drivers/cxl/core/mbox.c
> > index 2626f3fff201..edc54a1ca298 100644
> > --- a/drivers/cxl/core/mbox.c
> > +++ b/drivers/cxl/core/mbox.c
> > @@ -878,7 +878,7 @@ void cxl_event_trace_record(const struct cxl_memdev *cxlmd,
> > dpa = le64_to_cpu(evt->common.phys_addr) & CXL_DPA_MASK;
> > cxlr = cxl_dpa_to_region(cxlmd, dpa);
> > if (cxlr)
> > - hpa = cxl_trace_hpa(cxlr, cxlmd, dpa);
> > + hpa = cxl_translate(cxlr, cxlmd, dpa);
> >
> > if (event_type == CXL_CPER_EVENT_GEN_MEDIA)
> > trace_cxl_general_media(cxlmd, type, cxlr, hpa,
> > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c
> > index 00a9f0eef8dd..245edf748906 100644
> > --- a/drivers/cxl/core/region.c
> > +++ b/drivers/cxl/core/region.c
> > @@ -2797,7 +2797,7 @@ static u64 cxl_dpa_to_hpa(u64 dpa, struct cxl_region *cxlr,
> > return hpa;
> > }
> >
> > -u64 cxl_trace_hpa(struct cxl_region *cxlr, const struct cxl_memdev *cxlmd,
> > +u64 cxl_translate(struct cxl_region *cxlr, const struct cxl_memdev *cxlmd,
> > u64 dpa)
> > {
> > struct cxl_region_params *p = &cxlr->params;
> > diff --git a/drivers/cxl/core/trace.h b/drivers/cxl/core/trace.h
> > index 07a0394b1d99..6925a6a31f01 100644
> > --- a/drivers/cxl/core/trace.h
> > +++ b/drivers/cxl/core/trace.h
> > @@ -704,7 +704,7 @@ TRACE_EVENT(cxl_poison,
> > if (cxlr) {
> > __assign_str(region, dev_name(&cxlr->dev));
> > memcpy(__entry->uuid, &cxlr->params.uuid, 16);
> > - __entry->hpa = cxl_trace_hpa(cxlr, cxlmd,
> > + __entry->hpa = cxl_translate(cxlr, cxlmd,
> > __entry->dpa);
> > } else {
> > __assign_str(region, "");
>
next prev parent reply other threads:[~2024-06-07 17:45 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-05-08 18:47 [PATCH v2 0/4] XOR Math Fixups: translation & position alison.schofield
2024-05-08 18:47 ` [PATCH v2 1/4] cxl/core: Rename cxl_trace_hpa() to cxl_translate() alison.schofield
2024-05-30 3:45 ` Dan Williams
2024-06-07 14:40 ` Jonathan Cameron
2024-06-07 17:45 ` Alison Schofield [this message]
2024-06-07 17:55 ` Jonathan Cameron
2024-05-08 18:47 ` [PATCH v2 2/4] cxl/acpi: Restore XOR'd position bits during address translation alison.schofield
2024-05-30 3:55 ` Dan Williams
2024-05-30 22:29 ` Alison Schofield
2024-05-31 1:46 ` Dan Williams
2024-06-07 15:01 ` Jonathan Cameron
2024-06-07 18:20 ` Alison Schofield
2024-06-10 10:20 ` Jonathan Cameron
2024-05-08 18:47 ` [PATCH v2 3/4] cxl/region: Verify target positions using the ordered target list alison.schofield
2024-06-07 15:04 ` Jonathan Cameron
2024-06-11 21:50 ` Dan Williams
2024-05-08 18:47 ` [PATCH v2 4/4] cxl: Remove defunct code calculating host bridge target positions alison.schofield
2024-06-07 15:06 ` Jonathan Cameron
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=ZmNHRrzl2tJvR2SW@aschofie-mobl2 \
--to=alison.schofield@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=ira.weiny@intel.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