From: Ira Weiny <ira.weiny@intel.com>
To: Dan Williams <dan.j.williams@intel.com>,
Ira Weiny <ira.weiny@intel.com>, <linux-cxl@vger.kernel.org>
Cc: Dave Jiang <dave.jiang@intel.com>,
Alejandro Lucero <alucerop@amd.com>,
Ira Weiny <ira.weiny@intel.com>, <Jonathan.Cameron@huawei.com>
Subject: Re: [PATCH v2 3/5] cxl: Introduce 'struct cxl_dpa_partition' and 'struct cxl_range_info'
Date: Wed, 22 Jan 2025 21:10:40 -0600 [thread overview]
Message-ID: <6791b3308b5f9_55840294ad@iweiny-mobl.notmuch> (raw)
In-Reply-To: <67917029386b5_20fa2942a@dwillia2-xfh.jf.intel.com.notmuch>
Dan Williams wrote:
> Ira Weiny wrote:
> > Dan Williams wrote:
> >
> > [snip]
> >
> > > +/* if this fails the caller must destroy @cxlds, there is no recovery */
> > > +int cxl_dpa_setup(struct cxl_dev_state *cxlds, const struct cxl_dpa_info *info)
> > > +{
> > > + struct device *dev = cxlds->dev;
> > > +
> > > + guard(rwsem_write)(&cxl_dpa_rwsem);
> > > +
> > > + if (cxlds->nr_partitions)
> > > + return -EBUSY;
> > > +
> > > + if (!info->size || !info->nr_partitions) {
> > > + cxlds->dpa_res = DEFINE_RES_MEM(0, 0);
> > > + cxlds->nr_partitions = 0;
> > > + return 0;
> > > + }
> > > +
> > > + cxlds->dpa_res = DEFINE_RES_MEM(0, info->size);
> > > +
> > > + for (int i = 0; i < info->nr_partitions; i++) {
> > > + const struct cxl_dpa_part_info *part = &info->part[i];
> > > + const char *desc;
> > > + int rc;
> > > +
> > > + if (part->mode == CXL_PARTMODE_RAM)
> > > + desc = "ram";
> > > + else if (part->mode == CXL_PARTMODE_PMEM)
> > > + desc = "pmem";
> > > + else
> > > + desc = "";
> >
> > This can be a follow on patch but why not allow devices to name their
> > partitions?
>
> The proposal in patch5 is that the partition resource name is the
> operation mode. See the changes to mode_show().
>
> So the name is there for the kernel/user ABI to tie the decoder's
> assigned partition to an operation mode.
>
> Now, what may need to happen is that the partitions and their modes get
> exported in case userspace needs to know that allocating a decoder to
> "dynamic ram" before it allocates a decoder to "ram" implies that future
> attempts to allocate "ram" will fail. That may not need to include the
> actual partition indices, just an ordering of operation modes.
I'm not buying the 'dynamic ram' partition type just yet. What evidence
do we have that a device will not have 2 dynamic ram partitions?
Further, in all our discussions on the use cases of DCD no one has
mentioned a need for the partition attributes to be communicated to the
user.
I'm starting to think this is better left to the user with the export of
the attributes of each partition to the user.
But that has little to do with this patch now.
>
> So far we have been saved from needing such a thing as "ram+pmem"
> devices are only an emulation test case, not something where end users
> can get themselves into trouble by doing out-of-order allocations.
>
> Usually RAM is pre-allocated by BIOS which also limits the possibility
> of the 'skip' code ever being used.
>
> > > + cxlds->part[i].perf.qos_class = CXL_QOS_CLASS_INVALID;
> > > + cxlds->part[i].mode = part->mode;
> > > + rc = add_dpa_res(dev, &cxlds->dpa_res, &cxlds->part[i].res,
> > > + part->range.start, range_len(&part->range),
> > > + desc);
> > > + if (rc)
> > > + return rc;
> > > + cxlds->nr_partitions++;
> > > + }
> > > +
> > > + return 0;
> > > +}
> > > +EXPORT_SYMBOL_GPL(cxl_dpa_setup);
> > > +
> > > int devm_cxl_dpa_reserve(struct cxl_endpoint_decoder *cxled,
> > > resource_size_t base, resource_size_t len,
> > > resource_size_t skipped)
> >
> > [snip]
> >
> > >
> > > -static inline struct resource *to_ram_res(struct cxl_dev_state *cxlds)
> > > +
> > > +/* Static RAM is only expected at partition 0. */
> >
> > Is this because the spec requires RAM first and the partition array must
> > remain in DPA order?
>
> Yes.
>
> > This could be in a follow on patch, but unless I'm missing something the
> > partition information must be specified in increasing DPA order. Perhaps
> > that is accounted for in this series later.
>
> The partition information is specified in increasing DPA order in these
> patches, so I am missing the concern?
No not missing anything.
Ira
next prev parent reply other threads:[~2025-01-23 3:11 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-22 8:59 [PATCH v2 0/5] cxl: DPA partition metadata is a mess Dan Williams
2025-01-22 8:59 ` [PATCH v2 1/5] cxl: Remove the CXL_DECODER_MIXED mistake Dan Williams
2025-01-22 14:11 ` Ira Weiny
2025-01-23 15:49 ` Jonathan Cameron
2025-01-23 15:58 ` Alejandro Lucero Palau
2025-01-23 16:03 ` Dave Jiang
2025-01-22 8:59 ` [PATCH v2 2/5] cxl: Introduce to_{ram,pmem}_{res,perf}() helpers Dan Williams
2025-01-22 14:18 ` Ira Weiny
2025-01-23 15:57 ` Jonathan Cameron
2025-01-23 20:01 ` Dan Williams
2025-01-23 16:13 ` Dave Jiang
2025-01-23 16:25 ` Alejandro Lucero Palau
2025-01-23 21:04 ` Dan Williams
2025-01-24 10:15 ` Alejandro Lucero Palau
2025-01-25 0:45 ` Dan Williams
2025-01-22 8:59 ` [PATCH v2 3/5] cxl: Introduce 'struct cxl_dpa_partition' and 'struct cxl_range_info' Dan Williams
2025-01-22 14:53 ` Ira Weiny
2025-01-22 22:24 ` Dan Williams
2025-01-23 3:10 ` Ira Weiny [this message]
2025-01-23 16:09 ` Jonathan Cameron
2025-01-23 20:24 ` Dan Williams
2025-01-23 16:57 ` Dave Jiang
2025-01-23 17:00 ` Alejandro Lucero Palau
2025-01-23 22:43 ` Dan Williams
2025-01-23 17:17 ` Alejandro Lucero Palau
2025-01-23 22:48 ` Dan Williams
2025-01-24 10:29 ` Alejandro Lucero Palau
2025-01-22 8:59 ` [PATCH v2 4/5] cxl: Make cxl_dpa_alloc() DPA partition number agnostic Dan Williams
2025-01-22 16:29 ` Ira Weiny
2025-01-22 22:35 ` Dan Williams
2025-01-23 3:14 ` Ira Weiny
2025-01-23 3:28 ` Dan Williams
2025-01-23 16:41 ` Jonathan Cameron
2025-01-23 21:34 ` Dan Williams
2025-01-23 17:21 ` Alejandro Lucero Palau
2025-01-23 20:52 ` Dave Jiang
2025-01-22 8:59 ` [PATCH v2 5/5] cxl: Kill enum cxl_decoder_mode Dan Williams
2025-01-22 17:42 ` Ira Weiny
2025-01-22 22:58 ` Dan Williams
2025-01-23 3:39 ` Ira Weiny
2025-01-23 4:11 ` Dan Williams
2025-01-23 21:30 ` Dave Jiang
2025-01-24 22:22 ` Ira Weiny
2025-01-23 16:51 ` Jonathan Cameron
2025-01-23 21:50 ` Dan Williams
2025-01-23 17:20 ` Alejandro Lucero Palau
2025-01-23 21:29 ` Dave Jiang
2025-01-23 17:23 ` [PATCH v2 0/5] cxl: DPA partition metadata is a mess Alejandro Lucero Palau
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=6791b3308b5f9_55840294ad@iweiny-mobl.notmuch \
--to=ira.weiny@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=alucerop@amd.com \
--cc=dan.j.williams@intel.com \
--cc=dave.jiang@intel.com \
--cc=linux-cxl@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