lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250623105657.00003996@huawei.com>
Date: Mon, 23 Jun 2025 10:56:57 +0100
From: Jonathan Cameron <Jonathan.Cameron@...wei.com>
To: Neeraj Kumar <s.neeraj@...sung.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 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.


> 
> 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()

> +	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.

> +};
> +
> +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.
>  };



Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ