NVDIMM Device and Persistent Memory development
 help / color / mirror / Atom feed
From: alison.schofield@intel.com
To: Vishal Verma <vishal.l.verma@intel.com>
Cc: Alison Schofield <alison.schofield@intel.com>,
	nvdimm@lists.linux.dev, linux-cxl@vger.kernel.org
Subject: [ndctl PATCH] cxl/test: Add test case for region info to cxl-events.sh
Date: Wed, 27 Mar 2024 21:37:26 -0700	[thread overview]
Message-ID: <20240328043727.2186722-1-alison.schofield@intel.com> (raw)

From: Alison Schofield <alison.schofield@intel.com>

Events cxl_general_media and cxl_dram both report DPAs that may
be mapped in a region. If the DPA is mapped, the trace event will
include the HPA translation, region name and region uuid in the
trace event.

Add a test case that triggers these events with DPAs that map
into a region. Verify the region is included in the trace event.

Signed-off-by: Alison Schofield <alison.schofield@intel.com>
---
 test/cxl-events.sh | 24 ++++++++++++++++++++++++
 1 file changed, 24 insertions(+)

diff --git a/test/cxl-events.sh b/test/cxl-events.sh
index fe702bf98ad4..ff4f3fdff1d8 100644
--- a/test/cxl-events.sh
+++ b/test/cxl-events.sh
@@ -23,6 +23,26 @@ modprobe cxl_test
 rc=1
 
 dev_path="/sys/bus/platform/devices"
+trace_path="/sys/kernel/tracing"
+
+test_region_info()
+{
+	# Trigger a memdev in the cxl_test autodiscovered region
+	region=$($CXL list  -R | jq -r ".[] | .region")
+	memdev=$($CXL list -r "$region" --targets |
+		jq -r '.[].mappings' |
+		jq -r '.[0].memdev')
+	host=$($CXL list -m "$memdev" | jq -r '.[].host')
+
+	echo 1 > "$dev_path"/"$host"/event_trigger
+
+	if ! grep "cxl_general_media.*$region" "$trace_path"/trace; then
+		err "$LINENO"
+	fi
+	if ! grep "cxl_dram.*$region" "$trace_path"/trace; then
+		err "$LINENO"
+	fi
+}
 
 test_cxl_events()
 {
@@ -74,6 +94,10 @@ if [ "$num_info" -ne $num_info_expected ]; then
 	err "$LINENO"
 fi
 
+echo 1 > /sys/kernel/tracing/tracing_on
+test_region_info
+echo 0 > /sys/kernel/tracing/tracing_on
+
 check_dmesg "$LINENO"
 
 modprobe -r cxl_test
-- 
2.37.3


             reply	other threads:[~2024-03-28  4:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-28  4:37 alison.schofield [this message]
2024-03-29 15:38 ` [ndctl PATCH] cxl/test: Add test case for region info to cxl-events.sh Dave Jiang

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=20240328043727.2186722-1-alison.schofield@intel.com \
    --to=alison.schofield@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).