From: Ira Weiny <ira.weiny@intel.com>
To: Ben Widawsky <ben.widawsky@intel.com>
Cc: Dan Williams <dan.j.williams@intel.com>,
Alison Schofield <alison.schofield@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>,
linux-cxl@vger.kernel.org
Subject: Re: [PATCH 3/3] cxl/mem: Add partition information to sysfs
Date: Fri, 11 Jun 2021 13:09:29 -0700 [thread overview]
Message-ID: <20210611200929.GD1600546@iweiny-DESK2.sc.intel.com> (raw)
In-Reply-To: <20210611172615.xwugp25dxhzyxs4f@intel.com>
On Fri, Jun 11, 2021 at 10:26:15AM -0700, Widawsky, Ben wrote:
> On 21-06-10 17:22:24, ira.weiny@intel.com wrote:
> > From: Ira Weiny <ira.weiny@intel.com>
> >
> > Partitionable space is added to the ram and pmem size sysfs attributes
> > but this does not show the entire story.
> >
> > Add full partition information about the device under <sysfs>/partition.
>
> Please add these to:
> Documentation/ABI/testing/sysfs-bus-cxl
Good point... Thanks!
>
> It might be time to break that file up... maybe a syfs-bus-cxl-memdev?
>
> I'll also pose the original question here, what's the justification for exposing
> this via sysfs versus having userspace executing the mailbox command itself? Are
> you planning to have these attributes be writable at some point to do the
> partition programming?
Well... if we have ram/size and pmem/size this is nice to have to know how it
is configured...
For me I like not having to have to execute mailbox commands for everything but
I understand having sysfs 'explosion'... not really sure were to draw the
line. For now this helps me to see what the emulators are returning.
Ira
> >
> > Signed-off-by: Ira Weiny <ira.weiny@intel.com>
> > ---
> > drivers/cxl/pci.c | 49 +++++++++++++++++++++++++++++++++++++++++++++++
> > 1 file changed, 49 insertions(+)
> >
> > diff --git a/drivers/cxl/pci.c b/drivers/cxl/pci.c
> > index bcc2829e4475..7e4e9605e4ed 100644
> > --- a/drivers/cxl/pci.c
> > +++ b/drivers/cxl/pci.c
> > @@ -1226,6 +1226,42 @@ static ssize_t pmem_size_show(struct device *dev, struct device_attribute *attr,
> > static struct device_attribute dev_attr_pmem_size =
> > __ATTR(size, 0444, pmem_size_show, NULL);
> >
> > +static ssize_t part_vo_show(struct device *dev, struct device_attribute *attr,
> > + char *buf)
> > +{
> > + struct cxl_memdev *cxlmd = to_cxl_memdev(dev);
> > + struct cxl_mem *cxlm = cxlmd->cxlm;
> > +
> > + return sysfs_emit(buf, "%#llx\n", cxlm->volatile_cap_bytes);
> > +}
> > +
> > +static struct device_attribute dev_attr_part_vo =
> > + __ATTR(volatile_only, 0444, part_vo_show, NULL);
> > +
> > +static ssize_t part_po_show(struct device *dev, struct device_attribute *attr,
> > + char *buf)
> > +{
> > + struct cxl_memdev *cxlmd = to_cxl_memdev(dev);
> > + struct cxl_mem *cxlm = cxlmd->cxlm;
> > +
> > + return sysfs_emit(buf, "%#llx\n", cxlm->persistent_cap_bytes);
> > +}
> > +
> > +static struct device_attribute dev_attr_part_po =
> > + __ATTR(persistent_only, 0444, part_po_show, NULL);
> > +
> > +static ssize_t part_total_show(struct device *dev, struct device_attribute *attr,
> > + char *buf)
> > +{
> > + struct cxl_memdev *cxlmd = to_cxl_memdev(dev);
> > + struct cxl_mem *cxlm = cxlmd->cxlm;
> > +
> > + return sysfs_emit(buf, "%#llx\n", cxlm->total_cap_bytes);
> > +}
> > +
> > +static struct device_attribute dev_attr_part_total =
> > + __ATTR(total, 0444, part_total_show, NULL);
> > +
> > static struct attribute *cxl_memdev_attributes[] = {
> > &dev_attr_firmware_version.attr,
> > &dev_attr_payload_max.attr,
> > @@ -1243,6 +1279,13 @@ static struct attribute *cxl_memdev_ram_attributes[] = {
> > NULL,
> > };
> >
> > +static struct attribute *cxl_memdev_part_attributes[] = {
> > + &dev_attr_part_vo.attr,
> > + &dev_attr_part_po.attr,
> > + &dev_attr_part_total.attr,
> > + NULL,
> > +};
> > +
> > static struct attribute_group cxl_memdev_attribute_group = {
> > .attrs = cxl_memdev_attributes,
> > };
> > @@ -1257,10 +1300,16 @@ static struct attribute_group cxl_memdev_pmem_attribute_group = {
> > .attrs = cxl_memdev_pmem_attributes,
> > };
> >
> > +static struct attribute_group cxl_memdev_part_attribute_group = {
> > + .name = "partition",
> > + .attrs = cxl_memdev_part_attributes,
> > +};
> > +
> > static const struct attribute_group *cxl_memdev_attribute_groups[] = {
> > &cxl_memdev_attribute_group,
> > &cxl_memdev_ram_attribute_group,
> > &cxl_memdev_pmem_attribute_group,
> > + &cxl_memdev_part_attribute_group,
> > NULL,
> > };
> >
> > --
> > 2.28.0.rc0.12.gb6a658bd00c9
> >
prev parent reply other threads:[~2021-06-11 20:09 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-11 0:22 [PATCH 0/3] Query and use Partition Info ira.weiny
2021-06-11 0:22 ` [PATCH 1/3] cxl/pci: Store memory capacity values ira.weiny
2021-06-11 17:18 ` Ben Widawsky
2021-06-11 17:26 ` Dan Williams
2021-06-11 17:50 ` Ben Widawsky
2021-06-11 19:58 ` Ira Weiny
2021-06-11 0:22 ` [PATCH 2/3] cxl/mem: Report correct ram/pmem size in sysfs ira.weiny
2021-06-11 11:00 ` Jonathan Cameron
2021-06-11 15:59 ` Ira Weiny
2021-06-11 17:14 ` Dan Williams
2021-06-11 19:59 ` Ira Weiny
2021-06-11 0:22 ` [PATCH 3/3] cxl/mem: Add partition information to sysfs ira.weiny
2021-06-11 11:05 ` Jonathan Cameron
2021-06-11 17:26 ` Ben Widawsky
2021-06-11 20:09 ` Ira Weiny [this message]
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=20210611200929.GD1600546@iweiny-DESK2.sc.intel.com \
--to=ira.weiny@intel.com \
--cc=alison.schofield@intel.com \
--cc=ben.widawsky@intel.com \
--cc=dan.j.williams@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