From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
To: Dan Williams <dan.j.williams@intel.com>
Cc: Ira Weiny <ira.weiny@intel.com>,
Dave Jiang <dave.jiang@intel.com>, "Fan Ni" <fan.ni@samsung.com>,
Jonathan Corbet <corbet@lwn.net>,
Andrew Morton <akpm@linux-foundation.org>,
Kees Cook <kees@kernel.org>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Davidlohr Bueso <dave@stgolabs.net>,
"Alison Schofield" <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
<linux-cxl@vger.kernel.org>, <linux-doc@vger.kernel.org>,
<nvdimm@lists.linux.dev>, <linux-kernel@vger.kernel.org>,
<linux-hardening@vger.kernel.org>, Li Ming <ming.li@zohomail.com>
Subject: Re: [PATCH v8 02/21] cxl/mem: Read dynamic capacity configuration from the device
Date: Thu, 16 Jan 2025 10:32:07 +0000 [thread overview]
Message-ID: <20250116103207.00005461@huawei.com> (raw)
In-Reply-To: <678837fcc0ed_20f3294fb@dwillia2-xfh.jf.intel.com.notmuch>
On Wed, 15 Jan 2025 14:34:36 -0800
Dan Williams <dan.j.williams@intel.com> wrote:
> Ira Weiny wrote:
> > Dan Williams wrote:
> > > Ira Weiny wrote:
> >
> > [snip]
> >
> > > > diff --git a/drivers/cxl/cxlmem.h b/drivers/cxl/cxlmem.h
> > > > index e8907c403edbd83c8a36b8d013c6bc3391207ee6..05a0718aea73b3b2a02c608bae198eac7c462523 100644
> > > > --- a/drivers/cxl/cxlmem.h
> > > > +++ b/drivers/cxl/cxlmem.h
> > > > @@ -403,6 +403,7 @@ enum cxl_devtype {
> > > > CXL_DEVTYPE_CLASSMEM,
> > > > };
> > > >
> > > > +#define CXL_MAX_DC_REGION 8
> > >
> > > Please no, lets not sign up to have the "which cxl 'region' concept are
> > > you referring to?" debate in perpetuity. "DPA partition", "DPA
> > > resource", "DPA capacity" anything but "region".
> > >
> >
> > I'm inclined to agree with Alejandro on this one. I've walked this
> > tightrope quite a bit with this series. But there are other places where
> > we have chosen to change the verbiage from the spec and it has made it
> > difficult for new comers to correlate the spec with the code.
> >
> > So I like Alejandro's idea of adding "HW" to the name to indicate that we
> > are talking about a spec or hardware defined thing.
>
> See below, the only people that could potentially be bothered by the
> lack of spec terminology matching are the very same people that are
> sophisticated enough to have read the spec to know its a problem.
It's confusing me. :) I know the confusion source exists but
that doesn't mean I remember how all the terms match up.
>
> >
> > That said I am open to changing some names where it is clear it is a
> > software structure. I'll audit the series for that.
> >
> > > > u64 serial;
> > > > enum cxl_devtype type;
> > > > struct cxl_mailbox cxl_mbox;
> > > > };
> > > >
> > > > +#define CXL_DC_REGION_STRLEN 8
> > > > +struct cxl_dc_region_info {
> > > > + u64 base;
> > > > + u64 decode_len;
> > > > + u64 len;
> > >
> > > Duplicating partition information in multiple places, like
> > > mds->dc_region[X].base and cxlds->dc_res[X].start, feels like an
> > > RFC-quality decision for expediency that needs to reconciled on the way
> > > to upstream.
> >
> > I think this was done to follow a pattern of the mds being passed around
> > rather than creating resources right when partitions are read.
> >
> > Furthermore this stands to hold this information in CPU endianess rather
> > than holding an array of region info coming from the hardware.
>
> Yes, the ask is translate all of this into common information that lives
> at the cxl_dev_state level.
>
> >
> > Let see how other changes fall out before I go hacking this though.
> >
> > >
> > > > + u64 blk_size;
> > > > + u32 dsmad_handle;
> > > > + u8 flags;
> > > > + u8 name[CXL_DC_REGION_STRLEN];
> > >
> > > No, lets not entertain:
> > >
> > > printk("%s\n", mds->dc_region[index].name);
> > >
> > > ...when:
> > >
> > > printk("dc%d\n", index);
> > >
> > > ...will do.
> >
> > Actually these buffers provide a buffer for the (struct
> > resource)dc_res[x].name pointers to point to.
>
> I missed that specific detail, but I still challenge whether this
> precision is needed especially since it makes the data structure
> messier. Given these names are for debug only and multi-partition DCD
> devices seem unlikely to ever exist, just use a static shared name for
> adding to ->dpa_res.
Given the read only shared concept relies on multiple hardware dc regions
(I think they map to partitions) then we are very likely to see
multiples. (maybe I'm lost in terminology as well).
...
> > >
> > > Linux is not obligated to follow the questionable naming decisions of
> > > specifications.
> >
> > We are not. But as Alejandro says it can be confusing if we don't make
> > some association to the spec.
> >
> > What do you think about the HW/SW line I propose above?
>
> Rename to cxl_dc_partition_info and drop the region_ prefixes, sure.
>
> Otherwise, for this init-time only concern I would much rather deal with
> the confusion of:
>
> "why does Linux call this partition when the spec calls it region?":
> which only trips up people that already know the difference because they read the
> spec. In that case the comment will answer their confusion.
>
> ...versus:
>
> "why are there multiple region concepts in the CXL subsystem": which
> trips up everyone that greps through the CXL subsystem especially those
> that have no intention of ever reading the spec.
versus one time rename of all internal infrastructure to align to the spec
and only keep the confusion at the boundaries where we have ABI.
Horrible option but how often are those diving in the code that bothered
about the userspace /kernel interaction terminology?
Anyhow, they are all horrible choices.
Jonathan
>
next prev parent reply other threads:[~2025-01-16 10:32 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-12-11 3:42 [PATCH v8 00/21] DCD: Add support for Dynamic Capacity Devices (DCD) Ira Weiny
2024-12-11 3:42 ` [PATCH v8 01/21] cxl/mbox: Flag " Ira Weiny
2025-01-03 22:57 ` Dan Williams
2025-01-07 1:10 ` Ira Weiny
2024-12-11 3:42 ` [PATCH v8 02/21] cxl/mem: Read dynamic capacity configuration from the device Ira Weiny
2025-01-15 2:35 ` Dan Williams
2025-01-15 13:55 ` Alejandro Lucero Palau
2025-01-15 20:48 ` Ira Weiny
2025-01-16 6:33 ` Dan Williams
2025-01-15 20:32 ` Ira Weiny
2025-01-15 22:34 ` Dan Williams
2025-01-16 10:32 ` Jonathan Cameron [this message]
2025-01-22 21:02 ` Dan Williams
2025-01-22 18:02 ` Ira Weiny
2025-01-22 21:30 ` Dan Williams
2024-12-11 3:42 ` [PATCH v8 03/21] cxl/core: Separate region mode from decoder mode Ira Weiny
2024-12-11 3:42 ` [PATCH v8 04/21] cxl/region: Add dynamic capacity decoder and region modes Ira Weiny
2024-12-11 3:42 ` [PATCH v8 05/21] cxl/hdm: Add dynamic capacity size support to endpoint decoders Ira Weiny
2024-12-11 3:42 ` [PATCH v8 06/21] cxl/cdat: Gather DSMAS data for DCD regions Ira Weiny
2024-12-11 3:42 ` [PATCH v8 07/21] cxl/mem: Expose DCD partition capabilities in sysfs Ira Weiny
2024-12-11 3:42 ` [PATCH v8 08/21] cxl/port: Add endpoint decoder DC mode support to sysfs Ira Weiny
2024-12-11 3:42 ` [PATCH v8 09/21] cxl/region: Add sparse DAX region support Ira Weiny
2024-12-11 3:42 ` [PATCH v8 10/21] cxl/events: Split event msgnum configuration from irq setup Ira Weiny
2024-12-11 3:42 ` [PATCH v8 11/21] cxl/pci: Factor out interrupt policy check Ira Weiny
2024-12-11 3:42 ` [PATCH v8 12/21] cxl/mem: Configure dynamic capacity interrupts Ira Weiny
2024-12-11 3:42 ` [PATCH v8 13/21] cxl/core: Return endpoint decoder information from region search Ira Weiny
2024-12-11 3:42 ` [PATCH v8 14/21] cxl/extent: Process DCD events and realize region extents Ira Weiny
2024-12-11 3:42 ` [PATCH v8 15/21] cxl/region/extent: Expose region extent information in sysfs Ira Weiny
2024-12-11 3:42 ` [PATCH v8 16/21] dax/bus: Factor out dev dax resize logic Ira Weiny
2024-12-11 3:42 ` [PATCH v8 17/21] dax/region: Create resources on sparse DAX regions Ira Weiny
2024-12-11 3:42 ` [PATCH v8 18/21] cxl/region: Read existing extents on region creation Ira Weiny
2024-12-11 3:42 ` [PATCH v8 19/21] cxl/mem: Trace Dynamic capacity Event Record Ira Weiny
2024-12-11 3:42 ` [PATCH v8 20/21] tools/testing/cxl: Make event logs dynamic Ira Weiny
2024-12-11 3:42 ` [PATCH v8 21/21] tools/testing/cxl: Add DC Regions to mock mem data Ira Weiny
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=20250116103207.00005461@huawei.com \
--to=jonathan.cameron@huawei.com \
--cc=akpm@linux-foundation.org \
--cc=alison.schofield@intel.com \
--cc=corbet@lwn.net \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=dave@stgolabs.net \
--cc=fan.ni@samsung.com \
--cc=gustavoars@kernel.org \
--cc=ira.weiny@intel.com \
--cc=kees@kernel.org \
--cc=linux-cxl@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ming.li@zohomail.com \
--cc=nvdimm@lists.linux.dev \
--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;
as well as URLs for NNTP newsgroup(s).