Linux CXL
 help / color / mirror / Atom feed
From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>
Cc: "linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
	"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>
Subject: Re: [ndctl PATCH 14/15] cxl/test: Extend cxl-topology.sh for a single root-port host-bridge
Date: Tue, 8 Nov 2022 20:23:38 +0000	[thread overview]
Message-ID: <9b6565a8b59f3180f5d1d5edabebe8f32a35c172.camel@intel.com> (raw)
In-Reply-To: <166777848711.1238089.14027431355477472365.stgit@dwillia2-xfh.jf.intel.com>

On Sun, 2022-11-06 at 15:48 -0800, Dan Williams wrote:
> A recent extension of cxl_test adds 2 memory devices attached through a
> switch to a single ported host-bridge to reproduce a bug report.
> 
> Reported-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> Link: http://lore.kernel.org/r/20221010172057.00001559@huawei.com
> Signed-off-by: Dan Williams <dan.j.williams@intel.com>
> ---
>  test/cxl-topology.sh |   48 +++++++++++++++++++++++++++++-------------------
>  1 file changed, 29 insertions(+), 19 deletions(-)

This looks good, just a minor nit below.

> 
> diff --git a/test/cxl-topology.sh b/test/cxl-topology.sh
> index 1f15d29f0600..f1e0a2b01e98 100644
> --- a/test/cxl-topology.sh
> +++ b/test/cxl-topology.sh
> @@ -29,27 +29,30 @@ count=$(jq "length" <<< $json)
>  root=$(jq -r ".[] | .bus" <<< $json)
>  
>  
> -# validate 2 host bridges under a root port
> +# validate 2 or 3 host bridges under a root port
>  port_sort="sort_by(.port | .[4:] | tonumber)"
>  json=$($CXL list -b cxl_test -BP)
>  count=$(jq ".[] | .[\"ports:$root\"] | length" <<< $json)
> -((count == 2)) || err "$LINENO"
> +((count == 2)) || ((count == 3)) || err "$LINENO"
> +bridges=$count
>  
>  bridge[0]=$(jq -r ".[] | .[\"ports:$root\"] | $port_sort | .[0].port" <<< $json)
>  bridge[1]=$(jq -r ".[] | .[\"ports:$root\"] | $port_sort | .[1].port" <<< $json)
> +((bridges > 2)) && bridge[2]=$(jq -r ".[] | .[\"ports:$root\"] | $port_sort | .[2].port" <<< $json)
>  
> +# validate root ports per host bridge
> +check_host_bridge()
> +{
> +       json=$($CXL list -b cxl_test -T -p $1)
> +       count=$(jq ".[] | .dports | length" <<< $json)
> +       ((count == $2)) || err "$3"
> +}
>  
> -# validate 2 root ports per host bridge
> -json=$($CXL list -b cxl_test -T -p ${bridge[0]})
> -count=$(jq ".[] | .dports | length" <<< $json)
> -((count == 2)) || err "$LINENO"
> -
> -json=$($CXL list -b cxl_test -T -p ${bridge[1]})
> -count=$(jq ".[] | .dports | length" <<< $json)
> -((count == 2)) || err "$LINENO"
> +check_host_bridge ${bridge[0]} 2 $LINENO
> +check_host_bridge ${bridge[1]} 2 $LINENO
> +((bridges > 2)) && check_host_bridge ${bridge[2]} 1 $LINENO
>  
> -
> -# validate 2 switches per-root port
> +# validate 2 switches per root-port
>  json=$($CXL list -b cxl_test -P -p ${bridge[0]})
>  count=$(jq ".[] | .[\"ports:${bridge[0]}\"] | length" <<< $json)
>  ((count == 2)) || err "$LINENO"
> @@ -65,9 +68,9 @@ switch[2]=$(jq -r ".[] | .[\"ports:${bridge[1]}\"] | $port_sort | .[0].host" <<<
>  switch[3]=$(jq -r ".[] | .[\"ports:${bridge[1]}\"] | $port_sort | .[1].host" <<< $json)
>  
>  
> -# validate the expected properties of the 4 root decoders
> -# use the size of the first decoder to determine the cxl_test version /
> -# properties
> +# validate the expected properties of the 4 or 5 root decoders
> +# use the size of the first decoder to determine the
> +# cxl_test version / properties
>  json=$($CXL list -b cxl_test -D -d root)
>  port_id=${root:4}
>  port_id_len=${#port_id}
> @@ -103,12 +106,19 @@ count=$(jq "[ $decoder_sort | .[3] |
>         select(.nr_targets == 2) ] | length" <<< $json)
>  ((count == 1)) || err "$LINENO"
>  
> +if [ $bridges -eq 3 ]; then

The $bridges should be quoted if using the posix sh style [ ],
or use the bash style without quoting: if [[ $bridges == "3" ]]
or use a 'math' context: if (( bridges == 3 ))

> +       count=$(jq "[ $decoder_sort | .[4] |
> +               select(.pmem_capable == true) |
> +               select(.size == $decoder_base_size) |
> +               select(.nr_targets == 1) ] | length" <<< $json)
> +       ((count == 1)) || err "$LINENO"
> +fi
>  
> -# check that all 8 cxl_test memdevs are enabled by default and have a
> +# check that all 8 or 10 cxl_test memdevs are enabled by default and have a
>  # pmem size of 256M, or 1G
>  json=$($CXL list -b cxl_test -M)
>  count=$(jq "map(select(.pmem_size == $pmem_size)) | length" <<< $json)
> -((count == 8)) || err "$LINENO"
> +((bridges == 2 && count == 8 || bridges == 3 && count == 10)) || err "$LINENO"
>  
>  
>  # check that switch ports disappear after all of their memdevs have been
> @@ -151,8 +161,8 @@ do
>  done
>  
>  
> -# validate host bridge tear down
> -for b in ${bridge[@]}
> +# validate host bridge tear down for the first 2 bridges
> +for b in ${bridge[0]} ${bridge[1]}
>  do
>         $CXL disable-port $b -f
>         json=$($CXL list -M -i -p $b)
> 


  parent reply	other threads:[~2022-11-08 20:23 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-06 23:46 [ndctl PATCH 00/15] cxl-cli test and usability updates Dan Williams
2022-11-06 23:46 ` [ndctl PATCH 01/15] ndctl/test: Move firmware-update.sh to the 'descructive' set Dan Williams
2022-11-06 23:46 ` [ndctl PATCH 02/15] ndctl/test: Add kernel backtrace detection to some dax tests Dan Williams
2022-11-07 22:55   ` Alison Schofield
2022-11-06 23:47 ` [ndctl PATCH 03/15] ndctl/clang-format: Move minimum version to 6 Dan Williams
2022-11-06 23:47 ` [ndctl PATCH 04/15] ndctl/clang-format: Fix space after for_each macros Dan Williams
2022-11-06 23:47 ` [ndctl PATCH 05/15] cxl/list: Always attempt to collect child objects Dan Williams
2022-11-06 23:47 ` [ndctl PATCH 06/15] cxl/list: Skip emitting pmem_size when it is zero Dan Williams
2022-11-07 20:23   ` Alison Schofield
2022-11-07 23:42     ` Dan Williams
2022-12-08  3:36     ` Dan Williams
2022-11-07 22:47   ` Alison Schofield
2022-11-07 23:51     ` Dan Williams
2022-12-08  4:14     ` Dan Williams
2022-11-06 23:47 ` [ndctl PATCH 07/15] cxl/filter: Return json-c topology Dan Williams
2022-11-06 23:47 ` [ndctl PATCH 08/15] cxl/list: Record cxl objects in json objects Dan Williams
2022-11-06 23:47 ` [ndctl PATCH 09/15] cxl/region: Make ways an integer argument Dan Williams
2022-11-07 22:43   ` Alison Schofield
2022-11-07 23:50     ` Dan Williams
2022-11-08 19:36   ` Verma, Vishal L
2022-11-06 23:47 ` [ndctl PATCH 10/15] cxl/region: Make granularity " Dan Williams
2022-11-06 23:47 ` [ndctl PATCH 11/15] cxl/region: Use cxl_filter_walk() to gather create-region targets Dan Williams
2022-11-08  8:31   ` Verma, Vishal L
2022-12-08 20:23     ` Dan Williams
2022-11-06 23:47 ` [ndctl PATCH 12/15] cxl/region: Trim region size by max available extent Dan Williams
2022-11-06 23:48 ` [ndctl PATCH 13/15] cxl/region: Default to memdev mode for create with no arguments Dan Williams
2022-11-07 20:36   ` Alison Schofield
2022-11-07 23:48     ` Dan Williams
2022-11-08 16:03       ` Alison Schofield
2022-12-08  4:09     ` Dan Williams
2022-11-06 23:48 ` [ndctl PATCH 14/15] cxl/test: Extend cxl-topology.sh for a single root-port host-bridge Dan Williams
2022-11-07 22:38   ` Alison Schofield
2022-11-08 20:23   ` Verma, Vishal L [this message]
2022-12-08 20:25     ` Dan Williams
2022-11-06 23:48 ` [ndctl PATCH 15/15] cxl/test: Test single-port host-bridge region creation Dan Williams
2022-11-07 22:36   ` Alison Schofield

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=9b6565a8b59f3180f5d1d5edabebe8f32a35c172.camel@intel.com \
    --to=vishal.l.verma@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=linux-cxl@vger.kernel.org \
    --cc=nvdimm@lists.linux.dev \
    /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