diff mbox series

[ndctl] cxl/test: Add test case for region info to cxl-events.sh

Message ID 20240328043727.2186722-1-alison.schofield@intel.com
State New, archived
Headers show
Series [ndctl] cxl/test: Add test case for region info to cxl-events.sh | expand

Commit Message

Alison Schofield March 28, 2024, 4:37 a.m. UTC
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(+)

Comments

Dave Jiang March 29, 2024, 3:38 p.m. UTC | #1
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
Ira Weiny June 25, 2024, 9:36 p.m. UTC | #2
alison.schofield@ 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: Ira Weiny <ira.weiny@intel.com>

[snip]
diff mbox series

Patch

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