cxl/test: Add generic mock events
authorIra Weiny <ira.weiny@intel.com>
Wed, 18 Jan 2023 05:53:41 +0000 (21:53 -0800)
committerDan Williams <dan.j.williams@intel.com>
Fri, 27 Jan 2023 00:51:07 +0000 (16:51 -0800)
commitd1dca858f058f53f68aeacb6db0e1cb3568fa6ef
tree3b336d464fdbdbb2724a09f9ad225670e25afca0
parent95b4947992858f725ad6a65a2087a3533749660f
cxl/test: Add generic mock events

Facilitate testing basic Get/Clear Event functionality by creating
multiple logs and generic events with made up UUID's.

Data is completely made up with data patterns which should be easy to
spot in trace output.

A single sysfs entry resets the event data and triggers collecting the
events for testing.

Test traces are easy to obtain with a small script such as this:

#!/bin/bash -x

devices=`find /sys/devices/platform -name cxl_mem*`

# Turn on tracing
echo "" > /sys/kernel/tracing/trace
echo 1 > /sys/kernel/tracing/events/cxl/enable
echo 1 > /sys/kernel/tracing/tracing_on

# Generate fake interrupt
for device in $devices; do
        echo 1 > $device/event_trigger
done

# Turn off tracing and report events
echo 0 > /sys/kernel/tracing/tracing_on
cat /sys/kernel/tracing/trace

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Link: https://lore.kernel.org/r/20221216-cxl-ev-log-v7-6-2316a5c8f7d8@intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
tools/testing/cxl/test/Kbuild
tools/testing/cxl/test/mem.c