From: "Verma, Vishal L" <vishal.l.verma@intel.com>
To: "Williams, Dan J" <dan.j.williams@intel.com>,
"linux-cxl@vger.kernel.org" <linux-cxl@vger.kernel.org>,
"nvdimm@lists.linux.dev" <nvdimm@lists.linux.dev>
Cc: "joao.m.martins@oracle.com" <joao.m.martins@oracle.com>
Subject: Re: [PATCH ndctl] test/daxctl-create.sh: remove region and dax device assumptions
Date: Thu, 11 Jan 2024 22:54:21 +0000 [thread overview]
Message-ID: <24009232372b8f554f2b0f272da55b582c74703f.camel@intel.com> (raw)
In-Reply-To: <65a0403d151f9_5cee2944d@dwillia2-xfh.jf.intel.com.notmuch>
On Thu, 2024-01-11 at 11:23 -0800, Dan Williams wrote:
> 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"))
Oh yep this whole simplified by just doing this directly:
region_id="$("$DAXCTL" list -R | jq -r '.[] | select(.path | contains("hmem")) | .id')"
Thanks - will send v2.
>
> > 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
> >
prev parent reply other threads:[~2024-01-11 22:54 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
2024-01-11 22:54 ` 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=24009232372b8f554f2b0f272da55b582c74703f.camel@intel.com \
--to=vishal.l.verma@intel.com \
--cc=dan.j.williams@intel.com \
--cc=joao.m.martins@oracle.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).