[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <1931444790.41750944303583.JavaMail.epsvc@epcpadp1new>
Date: Thu, 26 Jun 2025 16:18:34 +0530
From: Neeraj Kumar <s.neeraj@...sung.com>
To: Jonathan Cameron <Jonathan.Cameron@...wei.com>
Cc: dan.j.williams@...el.com, dave@...olabs.net, dave.jiang@...el.com,
alison.schofield@...el.com, vishal.l.verma@...el.com, ira.weiny@...el.com,
a.manzanares@...sung.com, nifan.cxl@...il.com, anisa.su@...sung.com,
vishak.g@...sung.com, krish.reddy@...sung.com, arun.george@...sung.com,
alok.rathore@...sung.com, neeraj.kernel@...il.com,
linux-kernel@...r.kernel.org, linux-cxl@...r.kernel.org,
nvdimm@...ts.linux.dev, gost.dev@...sung.com, cpgs@...sung.com
Subject: Re: [RFC PATCH 20/20] cxl/pmem_region: Add cxl region label
updation and deletion device attributes
On 23/06/25 10:56AM, Jonathan Cameron wrote:
>On Tue, 17 Jun 2025 18:09:44 +0530
>Neeraj Kumar <s.neeraj@...sung.com> wrote:
>
>> Using these attributes region label is added/deleted into LSA. These
>> attributes are called from userspace (ndctl) after region creation.
>
>These need documentation. Documentation/ABI/testing/sysfs-bus-cxl
>is probably the right place.
>
Sure, Will update this in Documentation as well as update it in commit
message
>
>>
>> Signed-off-by: Neeraj Kumar <s.neeraj@...sung.com>
>> ---
>> drivers/cxl/core/pmem_region.c | 103 +++++++++++++++++++++++++++++++++
>> drivers/cxl/cxl.h | 1 +
>> 2 files changed, 104 insertions(+)
>>
>> diff --git a/drivers/cxl/core/pmem_region.c b/drivers/cxl/core/pmem_region.c
>> index a29526c27d40..f582d796c21b 100644
>> --- a/drivers/cxl/core/pmem_region.c
>> +++ b/drivers/cxl/core/pmem_region.c
>> @@ -45,8 +45,111 @@ static void cxl_pmem_region_release(struct device *dev)
>> kfree(cxlr_pmem);
>> }
>>
>> +static ssize_t region_label_update_store(struct device *dev,
>> + struct device_attribute *attr,
>> + const char *buf, size_t len)
>> +{
>> + struct cxl_pmem_region *cxlr_pmem = to_cxl_pmem_region(dev);
>> + struct cxl_region *cxlr = cxlr_pmem->cxlr;
>> + struct cxl_region_params *p = &cxlr->params;
>> + ssize_t rc;
>> + bool update;
>> +
>> + rc = kstrtobool(buf, &update);
>> + if (rc)
>> + return rc;
>> +
>> + rc = down_write_killable(&cxl_region_rwsem);
>
>Another use case for ACQUIRE()
>
Sure, I will look at Dan's new ACQUIRE() series. I will update it in V1
>> + if (rc)
>> + return rc;
>> +
>> + /* Region not yet committed */
>> + if (update && p->state != CXL_CONFIG_COMMIT) {
>> + dev_dbg(dev, "region not committed, can't update into LSA\n");
>> + rc = -ENXIO;
>> + goto out;
>> + }
>> +
>> + if (cxlr && cxlr->cxlr_pmem && cxlr->cxlr_pmem->nd_region) {
>> + rc = nd_region_label_update(cxlr->cxlr_pmem->nd_region);
>> +
>> + if (!rc)
>> + p->region_label_state = 1;
>> + }
>> +
>> +out:
>> + up_write(&cxl_region_rwsem);
>> +
>> + if (rc)
>> + return rc;
>> +
>> + return len;
>> +}
>
>> +
>> +static struct attribute *cxl_pmem_region_attrs[] = {
>> + &dev_attr_region_label_update.attr,
>> + &dev_attr_region_label_delete.attr,
>> + NULL,
>No need for trailing commas on terminating entries as we don't want it to be easy
>to put something after them.
>
Sure, Will fix it in V1
>> +};
>> +
>> +struct attribute_group cxl_pmem_region_group = {
>> + .attrs = cxl_pmem_region_attrs,
>> +};
>> +
>> static const struct attribute_group *cxl_pmem_region_attribute_groups[] = {
>> &cxl_base_attribute_group,
>> + &cxl_pmem_region_group,
>> NULL,
>Hmm. Drop this trailing comma perhaps whilst here.
>> };
>
Sure, I will update it in V1
>
Powered by blists - more mailing lists