From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Schofield, Alison" <alison.schofield@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 v3 5/5] cxl/test: add cxl-poison.sh unit test
Date: Fri, 17 Nov 2023 23:20:46 +0000 [thread overview]
Message-ID: <bb600f5ce13d2c6e16d069485f1f940159338508.camel@intel.com> (raw)
In-Reply-To: <2c7aa46e399738867b21bb35120196310ed2613d.1700258145.git.alison.schofield@intel.com>
On Fri, 2023-11-17 at 14:35 -0800, alison.schofield@intel.com wrote:
> From: Alison Schofield <alison.schofield@intel.com>
>
[..]
Rest of the series is looking good, just a few minor things below.
>
> +
> +find_media_errors()
> +{
> + local json="$1"
> +
> + nr="$(jq -r ".nr_records" <<< "$json")"
> + if [[ $nr != $NR_ERRS ]]; then
Minor shellcheck complaint, the right hand side of a [[ ]] check should
be quoted, so [[ $nr != "$NR_ERRS" ]]
> + echo "$mem: $NR_ERRS poison records expected, $nr found"
$mem is never set, maybe it needs to be extracted from the json above?
> + err "$LINENO"
> + fi
> +}
> +
> +# Turn tracing on. Note that 'cxl list --poison' does toggle the tracing.
> +# Turning it on here allows the test user to also view inject and clear
> +# trace events.
> +echo 1 > /sys/kernel/tracing/events/cxl/cxl_poison/enable
> +
> +# Poison by memdev
> +# Inject then clear into cxl_test known pmem and ram partitions
> +find_memdev
> +inject_poison_sysfs "$memdev" "0x40000000"
> +inject_poison_sysfs "$memdev" "0x40001000"
> +inject_poison_sysfs "$memdev" "0x600"
> +inject_poison_sysfs "$memdev" "0x0"
> +NR_ERRS=4
> +json=$("$CXL" list -m "$memdev" --poison | jq -r '.[].poison')
> +find_media_errors "$json"
Instead of setting NR_ERRS 'globally', just pass it to the
find_media_errors function as well alongside $json, and maybe rename it
to validate_nr_records() or something. More generaly, no need to
capitalize something like NR_ERRS - all caps is usually only for
variables coming from the env.
> +clear_poison_sysfs "$memdev" "0x40000000"
> +clear_poison_sysfs "$memdev" "0x40001000"
> +clear_poison_sysfs "$memdev" "0x600"
> +clear_poison_sysfs "$memdev" "0x0"
> +NR_ERRS=0
> +json=$("$CXL" list -m "$memdev" --poison | jq -r '.[].poison')
Fairly minor but shellcheck complains about quoting all the "$()"
command substitutions.
> +find_media_errors "$json"
> +
> +# Poison by region
> +# Inject then clear into cxl_test known pmem dpa mappings
> +create_region
> +inject_poison_sysfs "$mem0" "0x40000000"
> +inject_poison_sysfs "$mem1" "0x40000000"
> +NR_ERRS=2
> +json=$("$CXL" list -r "$region" --poison | jq -r '.[].poison')
> +find_media_errors "$json"
> +clear_poison_sysfs "$mem0" "0x40000000"
> +clear_poison_sysfs "$mem1" "0x40000000"
> +NR_ERRS=0
> +json=$("$CXL" list -r "$region" --poison | jq -r '.[].poison')
> +find_media_errors "$json"
> +
> +check_dmesg "$LINENO"
> +
> +modprobe -r cxl-test
> diff --git a/test/meson.build b/test/meson.build
> index 224adaf41fcc..2706fa5d633c 100644
> --- a/test/meson.build
> +++ b/test/meson.build
> @@ -157,6 +157,7 @@ cxl_create_region = find_program('cxl-create-region.sh')
> cxl_xor_region = find_program('cxl-xor-region.sh')
> cxl_update_firmware = find_program('cxl-update-firmware.sh')
> cxl_events = find_program('cxl-events.sh')
> +cxl_poison = find_program('cxl-poison.sh')
>
> tests = [
> [ 'libndctl', libndctl, 'ndctl' ],
> @@ -186,6 +187,7 @@ tests = [
> [ 'cxl-create-region.sh', cxl_create_region, 'cxl' ],
> [ 'cxl-xor-region.sh', cxl_xor_region, 'cxl' ],
> [ 'cxl-events.sh', cxl_events, 'cxl' ],
> + [ 'cxl-poison.sh', cxl_poison, 'cxl' ],
> ]
>
> if get_option('destructive').enabled()
prev parent reply other threads:[~2023-11-17 23:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-17 22:35 [ndctl PATCH v3 0/5] Support poison list retrieval alison.schofield
2023-11-17 22:35 ` [ndctl PATCH v3 1/5] libcxl: add interfaces for GET_POISON_LIST mailbox commands alison.schofield
2023-11-17 22:35 ` [ndctl PATCH v3 2/5] cxl: add an optional pid check to event parsing alison.schofield
2023-11-17 22:35 ` [ndctl PATCH v3 3/5] cxl/list: collect and parse the poison list records alison.schofield
2023-11-17 22:35 ` [ndctl PATCH v3 4/5] cxl/list: add --poison option to cxl list alison.schofield
2023-11-17 22:35 ` [ndctl PATCH v3 5/5] cxl/test: add cxl-poison.sh unit test alison.schofield
2023-11-17 23:20 ` Verma, Vishal L [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=bb600f5ce13d2c6e16d069485f1f940159338508.camel@intel.com \
--to=vishal.l.verma@intel.com \
--cc=alison.schofield@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