nvdimm.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
* [ndctl PATCH] cxl/test: Add test case for region info to cxl-events.sh
@ 2024-03-28  4:37 alison.schofield
  2024-03-29 15:38 ` Dave Jiang
  0 siblings, 1 reply; 2+ messages in thread
From: alison.schofield @ 2024-03-28  4:37 UTC (permalink / raw)
  To: Vishal Verma; +Cc: Alison Schofield, nvdimm, linux-cxl

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [ndctl PATCH] cxl/test: Add test case for region info to cxl-events.sh
  2024-03-28  4:37 [ndctl PATCH] cxl/test: Add test case for region info to cxl-events.sh alison.schofield
@ 2024-03-29 15:38 ` Dave Jiang
  0 siblings, 0 replies; 2+ messages in thread
From: Dave Jiang @ 2024-03-29 15:38 UTC (permalink / raw)
  To: alison.schofield, Vishal Verma; +Cc: nvdimm, linux-cxl



On 3/27/24 9:37 PM, alison.schofield@intel.com wrote:
> 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>

Reviewed-by: Dave Jiang <dave.jiang@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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-03-29 15:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-28  4:37 [ndctl PATCH] cxl/test: Add test case for region info to cxl-events.sh alison.schofield
2024-03-29 15:38 ` Dave Jiang

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 NNTP newsgroup(s).