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 v5 4/4] ndctl: add test for qos_class in CXL test suite
Date: Fri, 2 Feb 2024 08:17:50 -0800	[thread overview]
Message-ID: <Zb0VrjTUimEMFkT2@aschofie-mobl2> (raw)
In-Reply-To: <20240201230646.1328211-5-dave.jiang@intel.com>

On Thu, Feb 01, 2024 at 04:05:07PM -0700, Dave Jiang wrote:
> Add tests in cxl-qos-class.sh to verify qos_class are set with the fake
> qos_class create by the kernel.  Root decoders should have qos_class
> attribute set. Memory devices should have ram_qos_class or pmem_qos_class
> set depending on which partitions are valid.
> 
> Signed-off-by: Dave Jiang <dave.jiang@intel.com>
> ---
> v5:
> - Split out from cxl-topology.sh (Vishal)
> ---
>  test/common           |  4 +++
>  test/cxl-qos-class.sh | 65 +++++++++++++++++++++++++++++++++++++++++++
>  test/meson.build      |  2 ++
>  3 files changed, 71 insertions(+)
>  create mode 100755 test/cxl-qos-class.sh
> 
> diff --git a/test/common b/test/common
> index f1023ef20f7e..5694820c7adc 100644
> --- a/test/common
> +++ b/test/common
> @@ -150,3 +150,7 @@ check_dmesg()
>  	grep -q "Call Trace" <<< $log && err $1
>  	true
>  }
> +
> +
> +# CXL COMMON
> +TEST_QOS_CLASS=42
> diff --git a/test/cxl-qos-class.sh b/test/cxl-qos-class.sh
> new file mode 100755
> index 000000000000..365a7df9c1e4
> --- /dev/null
> +++ b/test/cxl-qos-class.sh
> @@ -0,0 +1,65 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +# Copyright (C) 2024 Intel Corporation. All rights reserved.
> +
> +check_qos_decoders () {
> +	# check root decoders have expected fake qos_class
> +	# also make sure the number of root decoders equal to the number
> +	# with qos_class found
> +	json=$($CXL list -b cxl_test -D -d root)
> +	decoders=$(echo "$json" | jq length)
> +	count=0
> +	while read -r qos_class
> +	do
> +		((qos_class == TEST_QOS_CLASS)) || err "$LINENO"
> +		count=$((count+1))
> +	done <<< "$(echo "$json" | jq -r '.[] | .qos_class')"
> +
> +	((count == decoders)) || err "$LINENO";
> +}
> +
> +check_qos_memdevs () {
> +	# Check that memdevs that expose ram_qos_class or pmem_qos_class have
> +	# expected fake value programmed.
> +	json=$(cxl list -b cxl_test -M)
> +	readarray -t lines < <(jq ".[] | .ram_size, .pmem_size, .ram_qos_class, .pmem_qos_class" <<<"$json")
> +	for (( i = 0; i < ${#lines[@]}; i += 4 ))
> +	do
> +		ram_size=${lines[i]}
> +		pmem_size=${lines[i+1]}
> +		ram_qos_class=${lines[i+2]}
> +		pmem_qos_class=${lines[i+3]}
> +
> +		if [[ "$ram_size" != null ]]
> +		then
> +			((ram_qos_class == TEST_QOS_CLASS)) || err "$LINENO"
> +		fi
> +		if [[ "$pmem_size" != null ]]
> +		then
> +			((pmem_qos_class == TEST_QOS_CLASS)) || err "$LINENO"
> +		fi
> +	done
> +}
> +
> +
> +. $(dirname $0)/common
> +
> +rc=77
> +
> +set -ex
> +
> +trap 'err $LINENO' ERR
> +
> +check_prereq "jq"
> +
> +modprobe -r cxl_test
> +modprobe cxl_test
> +rc=1

This different style, boiler plate not first in file, caught my eye.
Functionally no difference but stopped me for a second.

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

> +
> +check_qos_decoders
> +
> +check_qos_memdevs
> +
> +check_dmesg "$LINEO"
> +
> +modprobe -r cxl_test
> diff --git a/test/meson.build b/test/meson.build
> index 5eb35749a95b..4892df11119f 100644
> --- a/test/meson.build
> +++ b/test/meson.build
> @@ -160,6 +160,7 @@ cxl_events = find_program('cxl-events.sh')
>  cxl_poison = find_program('cxl-poison.sh')
>  cxl_sanitize = find_program('cxl-sanitize.sh')
>  cxl_destroy_region = find_program('cxl-destroy-region.sh')
> +cxl_qos_class = find_program('cxl-qos-class.sh')
>  
>  tests = [
>    [ 'libndctl',               libndctl,		  'ndctl' ],
> @@ -192,6 +193,7 @@ tests = [
>    [ 'cxl-poison.sh',          cxl_poison,         'cxl'   ],
>    [ 'cxl-sanitize.sh',        cxl_sanitize,       'cxl'   ],
>    [ 'cxl-destroy-region.sh',  cxl_destroy_region, 'cxl'   ],
> +  [ 'cxl-qos-class.sh',       cxl_qos_class,      'cxl'   ],
>  ]
>  
>  if get_option('destructive').enabled()
> -- 
> 2.43.0
> 
> 

      reply	other threads:[~2024-02-02 16:17 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-01 23:05 ndctl: Add support of qos_class for CXL CLI Dave Jiang
2024-02-01 23:05 ` [NDCTL PATCH v5 1/4] ndctl: cxl: Add QoS class retrieval for the root decoder Dave Jiang
2024-02-01 23:05 ` [NDCTL PATCH v5 2/4] ndctl: cxl: Add QoS class support for the memory device Dave Jiang
2024-02-01 23:05 ` [NDCTL PATCH v5 3/4] ndctl: cxl: add QoS class check for CXL region creation Dave Jiang
2024-02-06  6:00   ` Wonjae Lee
2024-02-06 21:05     ` Dave Jiang
2024-02-01 23:05 ` [NDCTL PATCH v5 4/4] ndctl: add test for qos_class in CXL test suite Dave Jiang
2024-02-02 16:17   ` Alison Schofield [this message]

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=Zb0VrjTUimEMFkT2@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