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