Message ID | 167601994558.1924368.12612811533724694444.stgit@dwillia2-xfh.jf.intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | CXL RAM and the 'Soft Reserved' => 'System RAM' default | expand |
On Fri, 10 Feb 2023 01:05:45 -0800 Dan Williams <dan.j.williams@intel.com> wrote: > Shipping versions of the cxl-cli utility expect all regions to have a > 'uuid' attribute. In preparation for 'ram' regions, update the 'uuid' > attribute to return an empty string which satisfies the current > expectations of 'cxl list -R'. Otherwise, 'cxl list -R' fails in the > presence of regions with the 'uuid' attribute missing. Force the > attribute to be read-only as there is no facility or expectation for a > 'ram' region to recall its uuid from one boot to the next. > > Reviewed-by: Vishal Verma <vishal.l.verma@intel.com> > Tested-by: Fan Ni <fan.ni@samsung.com> > Link: https://lore.kernel.org/r/167564536587.847146.12703125206459604597.stgit@dwillia2-xfh.jf.intel.com > Signed-off-by: Dan Williams <dan.j.williams@intel.com> After your explanations in v1 thread, I'm fine with this. Just another bit of slightly inelegant ABI that we are stuck with. Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> > --- > Documentation/ABI/testing/sysfs-bus-cxl | 3 ++- > drivers/cxl/core/region.c | 11 +++++++++-- > 2 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/Documentation/ABI/testing/sysfs-bus-cxl b/Documentation/ABI/testing/sysfs-bus-cxl > index 058b0c45001f..4c4e1cbb1169 100644 > --- a/Documentation/ABI/testing/sysfs-bus-cxl > +++ b/Documentation/ABI/testing/sysfs-bus-cxl > @@ -317,7 +317,8 @@ Contact: linux-cxl@vger.kernel.org > Description: > (RW) Write a unique identifier for the region. This field must > be set for persistent regions and it must not conflict with the > - UUID of another region. > + UUID of another region. For volatile ram regions this > + attribute is a read-only empty string. > > > What: /sys/bus/cxl/devices/regionZ/interleave_granularity > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c > index 17d2d0c12725..0fc80478ff6b 100644 > --- a/drivers/cxl/core/region.c > +++ b/drivers/cxl/core/region.c > @@ -45,7 +45,10 @@ static ssize_t uuid_show(struct device *dev, struct device_attribute *attr, > rc = down_read_interruptible(&cxl_region_rwsem); > if (rc) > return rc; > - rc = sysfs_emit(buf, "%pUb\n", &p->uuid); > + if (cxlr->mode != CXL_DECODER_PMEM) > + rc = sysfs_emit(buf, "\n"); > + else > + rc = sysfs_emit(buf, "%pUb\n", &p->uuid); > up_read(&cxl_region_rwsem); > > return rc; > @@ -300,8 +303,12 @@ static umode_t cxl_region_visible(struct kobject *kobj, struct attribute *a, > struct device *dev = kobj_to_dev(kobj); > struct cxl_region *cxlr = to_cxl_region(dev); > > + /* > + * Support tooling that expects to find a 'uuid' attribute for all > + * regions regardless of mode. > + */ > if (a == &dev_attr_uuid.attr && cxlr->mode != CXL_DECODER_PMEM) > - return 0; > + return 0444; > return a->mode; > } > > >
Dan Williams wrote: > Shipping versions of the cxl-cli utility expect all regions to have a > 'uuid' attribute. In preparation for 'ram' regions, update the 'uuid' > attribute to return an empty string which satisfies the current > expectations of 'cxl list -R'. Otherwise, 'cxl list -R' fails in the > presence of regions with the 'uuid' attribute missing. Force the > attribute to be read-only as there is no facility or expectation for a > 'ram' region to recall its uuid from one boot to the next. > > Reviewed-by: Vishal Verma <vishal.l.verma@intel.com> Reviewed-by: Ira Weiny <ira.weiny@intel.com> > Tested-by: Fan Ni <fan.ni@samsung.com> > Link: https://lore.kernel.org/r/167564536587.847146.12703125206459604597.stgit@dwillia2-xfh.jf.intel.com > Signed-off-by: Dan Williams <dan.j.williams@intel.com> > --- > Documentation/ABI/testing/sysfs-bus-cxl | 3 ++- > drivers/cxl/core/region.c | 11 +++++++++-- > 2 files changed, 11 insertions(+), 3 deletions(-) > > diff --git a/Documentation/ABI/testing/sysfs-bus-cxl b/Documentation/ABI/testing/sysfs-bus-cxl > index 058b0c45001f..4c4e1cbb1169 100644 > --- a/Documentation/ABI/testing/sysfs-bus-cxl > +++ b/Documentation/ABI/testing/sysfs-bus-cxl > @@ -317,7 +317,8 @@ Contact: linux-cxl@vger.kernel.org > Description: > (RW) Write a unique identifier for the region. This field must > be set for persistent regions and it must not conflict with the > - UUID of another region. > + UUID of another region. For volatile ram regions this > + attribute is a read-only empty string. > > > What: /sys/bus/cxl/devices/regionZ/interleave_granularity > diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c > index 17d2d0c12725..0fc80478ff6b 100644 > --- a/drivers/cxl/core/region.c > +++ b/drivers/cxl/core/region.c > @@ -45,7 +45,10 @@ static ssize_t uuid_show(struct device *dev, struct device_attribute *attr, > rc = down_read_interruptible(&cxl_region_rwsem); > if (rc) > return rc; > - rc = sysfs_emit(buf, "%pUb\n", &p->uuid); > + if (cxlr->mode != CXL_DECODER_PMEM) > + rc = sysfs_emit(buf, "\n"); > + else > + rc = sysfs_emit(buf, "%pUb\n", &p->uuid); > up_read(&cxl_region_rwsem); > > return rc; > @@ -300,8 +303,12 @@ static umode_t cxl_region_visible(struct kobject *kobj, struct attribute *a, > struct device *dev = kobj_to_dev(kobj); > struct cxl_region *cxlr = to_cxl_region(dev); > > + /* > + * Support tooling that expects to find a 'uuid' attribute for all > + * regions regardless of mode. > + */ > if (a == &dev_attr_uuid.attr && cxlr->mode != CXL_DECODER_PMEM) > - return 0; > + return 0444; > return a->mode; > } > > >
diff --git a/Documentation/ABI/testing/sysfs-bus-cxl b/Documentation/ABI/testing/sysfs-bus-cxl index 058b0c45001f..4c4e1cbb1169 100644 --- a/Documentation/ABI/testing/sysfs-bus-cxl +++ b/Documentation/ABI/testing/sysfs-bus-cxl @@ -317,7 +317,8 @@ Contact: linux-cxl@vger.kernel.org Description: (RW) Write a unique identifier for the region. This field must be set for persistent regions and it must not conflict with the - UUID of another region. + UUID of another region. For volatile ram regions this + attribute is a read-only empty string. What: /sys/bus/cxl/devices/regionZ/interleave_granularity diff --git a/drivers/cxl/core/region.c b/drivers/cxl/core/region.c index 17d2d0c12725..0fc80478ff6b 100644 --- a/drivers/cxl/core/region.c +++ b/drivers/cxl/core/region.c @@ -45,7 +45,10 @@ static ssize_t uuid_show(struct device *dev, struct device_attribute *attr, rc = down_read_interruptible(&cxl_region_rwsem); if (rc) return rc; - rc = sysfs_emit(buf, "%pUb\n", &p->uuid); + if (cxlr->mode != CXL_DECODER_PMEM) + rc = sysfs_emit(buf, "\n"); + else + rc = sysfs_emit(buf, "%pUb\n", &p->uuid); up_read(&cxl_region_rwsem); return rc; @@ -300,8 +303,12 @@ static umode_t cxl_region_visible(struct kobject *kobj, struct attribute *a, struct device *dev = kobj_to_dev(kobj); struct cxl_region *cxlr = to_cxl_region(dev); + /* + * Support tooling that expects to find a 'uuid' attribute for all + * regions regardless of mode. + */ if (a == &dev_attr_uuid.attr && cxlr->mode != CXL_DECODER_PMEM) - return 0; + return 0444; return a->mode; }