From: Ira Weiny <ira.weiny@intel.com>
To: Vishal Verma <vishal.l.verma@intel.com>, <linux-cxl@vger.kernel.org>
Cc: Gregory Price <gregory.price@memverge.com>,
Jonathan Cameron <Jonathan.Cameron@huawei.com>,
Davidlohr Bueso <dave@stgolabs.net>,
"Dan Williams" <dan.j.williams@intel.com>,
Vishal Verma <vishal.l.verma@intel.com>, <nvdimm@lists.linux.dev>
Subject: Re: [PATCH ndctl 4/7] cxl/region: accept user-supplied UUIDs for pmem regions
Date: Tue, 7 Feb 2023 19:56:45 -0800 [thread overview]
Message-ID: <63e31d7d6ca6b_107e3f29448@iweiny-mobl.notmuch> (raw)
In-Reply-To: <20230120-vv-volatile-regions-v1-4-b42b21ee8d0b@intel.com>
Vishal Verma wrote:
> Attempting to add additional checking around user-supplied UUIDs against
> 'ram' type regions revealed that commit 21b089025178 ("cxl: add a 'create-region' command")
> completely neglected to add the requisite support for accepting
> user-supplied UUIDs, even though the man page for cxl-create-region
> advertised the option.
>
> Fix this by actually adding this option now, and add checks to validate
> the user-supplied UUID, and refuse it for ram regions.
>
> Cc: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Ira Weiny <ira.weiny@intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
> cxl/region.c | 22 +++++++++++++++++++---
> 1 file changed, 19 insertions(+), 3 deletions(-)
>
> diff --git a/cxl/region.c b/cxl/region.c
> index 0945a14..9079b2d 100644
> --- a/cxl/region.c
> +++ b/cxl/region.c
> @@ -22,6 +22,7 @@ static struct region_params {
> const char *bus;
> const char *size;
> const char *type;
> + const char *uuid;
> const char *root_decoder;
> const char *region;
> int ways;
> @@ -40,6 +41,7 @@ struct parsed_params {
> u64 ep_min_size;
> int ways;
> int granularity;
> + uuid_t uuid;
> struct json_object *memdevs;
> int num_memdevs;
> int argc;
> @@ -74,6 +76,8 @@ OPT_INTEGER('g', "granularity", ¶m.granularity, \
> "granularity of the interleave set"), \
> OPT_STRING('t', "type", ¶m.type, \
> "region type", "region type - 'pmem' or 'ram'"), \
> +OPT_STRING('U', "uuid", ¶m.uuid, \
> + "region uuid", "uuid for the new region (default: autogenerate)"), \
> OPT_BOOLEAN('m', "memdevs", ¶m.memdevs, \
> "non-option arguments are memdevs"), \
> OPT_BOOLEAN('u', "human", ¶m.human, "use human friendly number formats")
> @@ -293,6 +297,11 @@ static int parse_create_options(struct cxl_ctx *ctx, int count,
>
> if (param.type) {
> p->mode = cxl_decoder_mode_from_ident(param.type);
> + if (p->mode == CXL_DECODER_MODE_RAM && param.uuid) {
> + log_err(&rl,
> + "can't set UUID for ram / volatile regions");
> + return -EINVAL;
> + }
> if (p->mode == CXL_DECODER_MODE_NONE) {
> log_err(&rl, "unsupported type: %s\n", param.type);
> return -EINVAL;
> @@ -341,6 +350,13 @@ static int parse_create_options(struct cxl_ctx *ctx, int count,
> }
> }
>
> + if (param.uuid) {
> + if (uuid_parse(param.uuid, p->uuid)) {
> + error("failed to parse uuid: '%s'\n", param.uuid);
> + return -EINVAL;
> + }
> + }
> +
> return 0;
> }
>
> @@ -566,7 +582,6 @@ static int create_region(struct cxl_ctx *ctx, int *count,
> int i, rc, granularity;
> u64 size, max_extent;
> const char *devname;
> - uuid_t uuid;
>
> rc = create_region_validate_config(ctx, p);
> if (rc)
> @@ -627,8 +642,9 @@ static int create_region(struct cxl_ctx *ctx, int *count,
> try(cxl_region, set_interleave_granularity, region, granularity);
> try(cxl_region, set_interleave_ways, region, p->ways);
> if (p->mode == CXL_DECODER_MODE_PMEM) {
> - uuid_generate(uuid);
> - try(cxl_region, set_uuid, region, uuid);
> + if (!param.uuid)
> + uuid_generate(p->uuid);
> + try(cxl_region, set_uuid, region, p->uuid);
> }
> try(cxl_region, set_size, region, size);
>
>
> --
> 2.39.1
>
>
next prev parent reply other threads:[~2023-02-08 3:56 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-02-07 19:16 [PATCH ndctl 0/7] cxl: add support for listing and creating volatile regions Vishal Verma
2023-02-07 19:16 ` [PATCH ndctl 1/7] cxl/region: skip region_actions for region creation Vishal Verma
2023-02-07 22:07 ` Fan Ni
2023-02-08 0:19 ` Verma, Vishal L
2023-02-08 3:45 ` Ira Weiny
2023-02-08 5:41 ` Dan Williams
2023-02-07 19:16 ` [PATCH ndctl 2/7] cxl: add a type attribute to region listings Vishal Verma
2023-02-08 3:46 ` Ira Weiny
2023-02-08 5:47 ` Dan Williams
2023-02-08 6:10 ` Verma, Vishal L
2023-02-10 0:47 ` Fan Ni
2023-02-07 19:16 ` [PATCH ndctl 3/7] cxl: add core plumbing for creation of ram regions Vishal Verma
2023-02-08 3:55 ` Ira Weiny
2023-02-08 6:23 ` Verma, Vishal L
2023-02-08 22:07 ` Ira Weiny
2023-02-08 5:49 ` Dan Williams
2023-02-10 1:04 ` Fan Ni
2023-02-10 1:10 ` Verma, Vishal L
2023-02-10 1:15 ` Fan Ni
2023-02-07 19:16 ` [PATCH ndctl 4/7] cxl/region: accept user-supplied UUIDs for pmem regions Vishal Verma
2023-02-08 3:56 ` Ira Weiny [this message]
2023-02-08 5:51 ` Dan Williams
2023-02-07 19:16 ` [PATCH ndctl 5/7] cxl/region: determine region type based on root decoder capability Vishal Verma
2023-02-08 4:07 ` Ira Weiny
2023-02-08 6:34 ` Verma, Vishal L
2023-02-08 22:09 ` Ira Weiny
2023-02-08 5:55 ` Dan Williams
2023-02-08 6:36 ` Verma, Vishal L
2023-02-07 19:16 ` [PATCH ndctl 6/7] cxl/list: Include regions in the verbose listing Vishal Verma
2023-02-08 4:08 ` Ira Weiny
2023-02-07 19:16 ` [PATCH ndctl 7/7] cxl/list: Enumerate device-dax properties for regions Vishal Verma
2023-02-08 4:15 ` Ira Weiny
2023-02-08 6:00 ` Dan Williams
2023-02-08 6:48 ` Verma, Vishal L
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=63e31d7d6ca6b_107e3f29448@iweiny-mobl.notmuch \
--to=ira.weiny@intel.com \
--cc=Jonathan.Cameron@huawei.com \
--cc=dan.j.williams@intel.com \
--cc=dave@stgolabs.net \
--cc=gregory.price@memverge.com \
--cc=linux-cxl@vger.kernel.org \
--cc=nvdimm@lists.linux.dev \
--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