Skip to content

Commit c2b34d4

Browse files
jic23djbw
authored andcommitted
docs: perf: Minimal introduction the the CXL PMU device and driver
Very basic introduction to the device and the current driver support provided. I expect to expand on this in future versions of this patch set. Reviewed-by: Dave Jiang <dave.jiang@intel.com> Reviewed-by: Kan Liang <kan.liang@linux.intel.com> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20230526095824.16336-6-Jonathan.Cameron@huawei.com Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 5d7107c commit c2b34d4

3 files changed

Lines changed: 70 additions & 0 deletions

File tree

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
.. SPDX-License-Identifier: GPL-2.0
2+
3+
======================================
4+
CXL Performance Monitoring Unit (CPMU)
5+
======================================
6+
7+
The CXL rev 3.0 specification provides a definition of CXL Performance
8+
Monitoring Unit in section 13.2: Performance Monitoring.
9+
10+
CXL components (e.g. Root Port, Switch Upstream Port, End Point) may have
11+
any number of CPMU instances. CPMU capabilities are fully discoverable from
12+
the devices. The specification provides event definitions for all CXL protocol
13+
message types and a set of additional events for things commonly counted on
14+
CXL devices (e.g. DRAM events).
15+
16+
CPMU driver
17+
===========
18+
19+
The CPMU driver registers a perf PMU with the name pmu_mem<X>.<Y> on the CXL bus
20+
representing the Yth CPMU for memX.
21+
22+
/sys/bus/cxl/device/pmu_mem<X>.<Y>
23+
24+
The associated PMU is registered as
25+
26+
/sys/bus/event_sources/devices/cxl_pmu_mem<X>.<Y>
27+
28+
In common with other CXL bus devices, the id has no specific meaning and the
29+
relationship to specific CXL device should be established via the device parent
30+
of the device on the CXL bus.
31+
32+
PMU driver provides description of available events and filter options in sysfs.
33+
34+
The "format" directory describes all formats of the config (event vendor id,
35+
group id and mask) config1 (threshold, filter enables) and config2 (filter
36+
parameters) fields of the perf_event_attr structure. The "events" directory
37+
describes all documented events show in perf list.
38+
39+
The events shown in perf list are the most fine grained events with a single
40+
bit of the event mask set. More general events may be enable by setting
41+
multiple mask bits in config. For example, all Device to Host Read Requests
42+
may be captured on a single counter by setting the bits for all of
43+
44+
* d2h_req_rdcurr
45+
* d2h_req_rdown
46+
* d2h_req_rdshared
47+
* d2h_req_rdany
48+
* d2h_req_rdownnodata
49+
50+
Example of usage::
51+
52+
$#perf list
53+
cxl_pmu_mem0.0/clock_ticks/ [Kernel PMU event]
54+
cxl_pmu_mem0.0/d2h_req_rdshared/ [Kernel PMU event]
55+
cxl_pmu_mem0.0/h2d_req_snpcur/ [Kernel PMU event]
56+
cxl_pmu_mem0.0/h2d_req_snpdata/ [Kernel PMU event]
57+
cxl_pmu_mem0.0/h2d_req_snpinv/ [Kernel PMU event]
58+
-----------------------------------------------------------
59+
60+
$# perf stat -a -e cxl_pmu_mem0.0/clock_ticks/ -e cxl_pmu_mem0.0/d2h_req_rdshared/
61+
62+
Vendor specific events may also be available and if so can be used via
63+
64+
$# perf stat -a -e cxl_pmu_mem0.0/vid=VID,gid=GID,mask=MASK/
65+
66+
The driver does not support sampling so "perf record" is unsupported.
67+
It only supports system-wide counting so attaching to a task is
68+
unsupported.

Documentation/admin-guide/perf/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ Performance monitor support
2121
alibaba_pmu
2222
nvidia-pmu
2323
meson-ddr-pmu
24+
cxl

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5197,6 +5197,7 @@ COMPUTE EXPRESS LINK PMU (CPMU)
51975197
M: Jonathan Cameron <jonathan.cameron@huawei.com>
51985198
L: linux-cxl@vger.kernel.org
51995199
S: Maintained
5200+
F: Documentation/admin-guide/perf/cxl.rst
52005201
F: drivers/perf/cxl_pmu.c
52015202

52025203
CONEXANT ACCESSRUNNER USB DRIVER

0 commit comments

Comments
 (0)