From: Dan Williams <dan.j.williams@intel.com>
To: Vishal Verma <vishal.l.verma@intel.com>,
<linux-cxl@vger.kernel.org>, <nvdimm@lists.linux.dev>
Cc: Dan Williams <dan.j.williams@intel.com>,
Joao Martins <joao.m.martins@oracle.com>,
Vishal Verma <vishal.l.verma@intel.com>
Subject: RE: [PATCH ndctl] test/daxctl-create.sh: remove region and dax device assumptions
Date: Thu, 11 Jan 2024 11:23:41 -0800 [thread overview]
Message-ID: <65a0403d151f9_5cee2944d@dwillia2-xfh.jf.intel.com.notmuch> (raw)
In-Reply-To: <20240110-vv-daxctl-create-v1-1-01f5d58afcd8@intel.com>
Vishal Verma wrote:
> The daxctl-create.sh test had some hard-coded assumptions about what dax
> device it expects to find, and what region number it will be under. This
> usually worked when the unit test environment only had efi_fake_mem
> devices as the sources of hmem memory. With CXL however, the region
> numbering namespace is shared with CXL regions, often pushing the
> efi_fake_mem region to something other than 'region0'.
>
> Remove any region and device number assumptions from this test so it
> works regardless of how regions get enumerated.
>
> Cc: Joao Martins <joao.m.martins@oracle.com>
> Cc: Dan Williams <dan.j.williams@intel.com>
> Signed-off-by: Vishal Verma <vishal.l.verma@intel.com>
> ---
> test/daxctl-create.sh | 62 +++++++++++++++++++++++++++++----------------------
> 1 file changed, 35 insertions(+), 27 deletions(-)
>
> diff --git a/test/daxctl-create.sh b/test/daxctl-create.sh
> index d319a39..a5df6f2 100755
> --- a/test/daxctl-create.sh
> +++ b/test/daxctl-create.sh
> @@ -29,14 +29,20 @@ find_testdev()
> fi
>
> # find a victim region provided by dax_hmem
> - testpath=$("$DAXCTL" list -r 0 | jq -er '.[0].path | .//""')
> + region_json="$("$DAXCTL" list -R)"
> + testpath=$(jq -er '.[0].path | .//""' <<< "$region_json")
This fixes the case where the first dax-region may not be region-id 0,
but would it also fail if the first region is not the "hmem" region?
I wonder if the above and the next line can be fixed with a jq select()
like?
select(.path | contains("hmem"))
> if [[ ! "$testpath" == *"hmem"* ]]; then
> printf "Unable to find a victim region\n"
> exit "$rc"
> fi
> + region_id=$(jq -er '.[0].id | .//""' <<< "$region_json")
> + if [[ ! "$region_id" ]]; then
> + printf "Unable to determine victim region id\n"
> + exit "$rc"
> + fi
>
> # find a victim device
> - testdev=$("$DAXCTL" list -D -r 0 | jq -er '.[0].chardev | .//""')
> + testdev=$("$DAXCTL" list -D -r "$region_id" | jq -er '.[0].chardev | .//""')
> if [[ ! $testdev ]]; then
> printf "Unable to find a victim device\n"
> exit "$rc"
> @@ -56,9 +62,10 @@ setup_dev()
> exit "$rc"
> fi
>
> + "$DAXCTL" reconfigure-device -m devdax -f "$testdev"
> "$DAXCTL" disable-device "$testdev"
> "$DAXCTL" reconfigure-device -s 0 "$testdev"
> - available=$("$DAXCTL" list -r 0 | jq -er '.[0].available_size | .//""')
> + available=$("$DAXCTL" list -r "$region_id" | jq -er '.[0].available_size | .//""')
These and the rest of the changes look good.
[..]
next prev parent reply other threads:[~2024-01-11 19:23 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-10 22:51 [PATCH ndctl] test/daxctl-create.sh: remove region and dax device assumptions Vishal Verma
2024-01-11 19:23 ` Dan Williams [this message]
2024-01-11 22:54 ` 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=65a0403d151f9_5cee2944d@dwillia2-xfh.jf.intel.com.notmuch \
--to=dan.j.williams@intel.com \
--cc=joao.m.martins@oracle.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