Linux CXL
 help / color / mirror / Atom feed
From: Alison Schofield <alison.schofield@intel.com>
To: Dave Jiang <dave.jiang@intel.com>
Cc: linux-cxl@vger.kernel.org, nvdimm@lists.linux.dev,
	vishal.l.verma@intel.com
Subject: Re: [NDCTL PATCH v3 2/3] ndctl: cxl: Add QoS class support for the memory device
Date: Fri, 26 Jan 2024 10:01:51 -0800	[thread overview]
Message-ID: <ZbPzj90keGE0zr0K@aschofie-mobl2> (raw)
In-Reply-To: <170612968788.2745924.12035270102793649199.stgit@djiang5-mobl3>

On Wed, Jan 24, 2024 at 01:54:47PM -0700, Dave Jiang wrote:
> Add libcxl API to retrieve the QoS class tokens for the memory
> devices. Two API calls are added. One for 'ram' or 'volatile'
> mode and another for 'pmem' or 'persistent' mode. Support also added
> for displaying the QoS class tokens through the 'cxl list' command.
> There can be 1 or more QoS class tokens for the memory device if
> they are valid. The qos_class tokens are displayed behind -vvv
> verbose level.
> 
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>

One tidbit below. 

Reviewed-by: Alison Schofield <alison.schofield@intel.com>


> ---
> v3:
> - Rebase to pending branch
> - Skip from failing if no qos_class sysfs attrib found
> ---
>  cxl/json.c         |   36 +++++++++++++++++++++++++++++++++++-
>  cxl/lib/libcxl.c   |   48 ++++++++++++++++++++++++++++++++++++++++++++++++
>  cxl/lib/libcxl.sym |    2 ++
>  cxl/lib/private.h  |    2 ++
>  cxl/libcxl.h       |    7 +++++++
>  5 files changed, 94 insertions(+), 1 deletion(-)
> 
> diff --git a/cxl/json.c b/cxl/json.c
> index 48a43ddf14b0..dcbac8c14f03 100644
> --- a/cxl/json.c
> +++ b/cxl/json.c
> @@ -770,12 +770,32 @@ err_free:
>  	return jpoison;
>  }
>  
> +static struct json_object *get_qos_json_object(struct json_object *jdev,
> +					       struct qos_class *qos_class)
> +{
> +	struct json_object *jqos_array = json_object_new_array();
> +	struct json_object *jobj;
> +	int i;
> +
> +	if (!jqos_array)
> +		return NULL;
> +
> +	for (i = 0; i < qos_class->nr; i++) {
> +		jobj = json_object_new_int(qos_class->qos[i]);
> +		if (jobj)
> +			json_object_array_add(jqos_array, jobj);
> +	}
> +
> +	return jqos_array;
> +}
> +
>  struct json_object *util_cxl_memdev_to_json(struct cxl_memdev *memdev,
>  		unsigned long flags)
>  {
>  	const char *devname = cxl_memdev_get_devname(memdev);
> -	struct json_object *jdev, *jobj;
> +	struct json_object *jdev, *jobj, *jqos;

Can the generic *jobj be used below rather than adding the new *jqos?


>  	unsigned long long serial, size;
> +	struct qos_class *qos_class;
>  	int numa_node;
>  
>  	jdev = json_object_new_object();
> @@ -791,6 +811,13 @@ struct json_object *util_cxl_memdev_to_json(struct cxl_memdev *memdev,
>  		jobj = util_json_object_size(size, flags);
>  		if (jobj)
>  			json_object_object_add(jdev, "pmem_size", jobj);
> +
> +		if (flags & UTIL_JSON_QOS_CLASS) {
> +			qos_class = cxl_memdev_get_pmem_qos_class(memdev);
> +			jqos = get_qos_json_object(jdev, qos_class);
> +			if (jqos)
> +				json_object_object_add(jdev, "pmem_qos_class", jqos);
> +		}
>  	}
>  
>  	size = cxl_memdev_get_ram_size(memdev);
> @@ -798,6 +825,13 @@ struct json_object *util_cxl_memdev_to_json(struct cxl_memdev *memdev,
>  		jobj = util_json_object_size(size, flags);
>  		if (jobj)
>  			json_object_object_add(jdev, "ram_size", jobj);
> +
> +		if (flags & UTIL_JSON_QOS_CLASS) {
> +			qos_class = cxl_memdev_get_ram_qos_class(memdev);
> +			jqos = get_qos_json_object(jdev, qos_class);
> +			if (jqos)
> +				json_object_object_add(jdev, "ram_qos_class", jqos);
> +		}
>  	}
>  
>  	if (flags & UTIL_JSON_HEALTH) {

snip

> 
> 

  reply	other threads:[~2024-01-26 18:01 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-24 20:54 [NDCTL PATCH v3 0/3] ndctl: Add support of qos_class for CXL CLI Dave Jiang
2024-01-24 20:54 ` [NDCTL PATCH v3 1/3] ndctl: cxl: Add QoS class retrieval for the root decoder Dave Jiang
2024-01-26 17:45   ` Alison Schofield
2024-01-24 20:54 ` [NDCTL PATCH v3 2/3] ndctl: cxl: Add QoS class support for the memory device Dave Jiang
2024-01-26 18:01   ` Alison Schofield [this message]
2024-01-30 20:48     ` Dave Jiang
2024-01-24 20:54 ` [NDCTL PATCH v3 3/3] ndctl: cxl: add QoS class check for CXL region creation Dave Jiang
2024-01-26 18:14   ` Alison Schofield
2024-01-30 20:53     ` Dave Jiang
2024-01-25 21:16 ` [NDCTL PATCH v3 0/3] ndctl: Add support of qos_class for CXL CLI Dan Williams
2024-01-25 21:40   ` Dave Jiang
2024-01-25 22:07     ` Dan Williams

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=ZbPzj90keGE0zr0K@aschofie-mobl2 \
    --to=alison.schofield@intel.com \
    --cc=dave.jiang@intel.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