xref: /OK3568_Linux_fs/kernel/Documentation/admin-guide/perf/xgene-pmu.rst (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun================================================
2*4882a593SmuzhiyunAPM X-Gene SoC Performance Monitoring Unit (PMU)
3*4882a593Smuzhiyun================================================
4*4882a593Smuzhiyun
5*4882a593SmuzhiyunX-Gene SoC PMU consists of various independent system device PMUs such as
6*4882a593SmuzhiyunL3 cache(s), I/O bridge(s), memory controller bridge(s) and memory
7*4882a593Smuzhiyuncontroller(s). These PMU devices are loosely architected to follow the
8*4882a593Smuzhiyunsame model as the PMU for ARM cores. The PMUs share the same top level
9*4882a593Smuzhiyuninterrupt and status CSR region.
10*4882a593Smuzhiyun
11*4882a593SmuzhiyunPMU (perf) driver
12*4882a593Smuzhiyun-----------------
13*4882a593Smuzhiyun
14*4882a593SmuzhiyunThe xgene-pmu driver registers several perf PMU drivers. Each of the perf
15*4882a593Smuzhiyundriver provides description of its available events and configuration options
16*4882a593Smuzhiyunin sysfs, see /sys/devices/<l3cX/iobX/mcbX/mcX>/.
17*4882a593Smuzhiyun
18*4882a593SmuzhiyunThe "format" directory describes format of the config (event ID),
19*4882a593Smuzhiyunconfig1 (agent ID) fields of the perf_event_attr structure. The "events"
20*4882a593Smuzhiyundirectory provides configuration templates for all supported event types that
21*4882a593Smuzhiyuncan be used with perf tool. For example, "l3c0/bank-fifo-full/" is an
22*4882a593Smuzhiyunequivalent of "l3c0/config=0x0b/".
23*4882a593Smuzhiyun
24*4882a593SmuzhiyunMost of the SoC PMU has a specific list of agent ID used for monitoring
25*4882a593Smuzhiyunperformance of a specific datapath. For example, agents of a L3 cache can be
26*4882a593Smuzhiyuna specific CPU or an I/O bridge. Each PMU has a set of 2 registers capable of
27*4882a593Smuzhiyunmasking the agents from which the request come from. If the bit with
28*4882a593Smuzhiyunthe bit number corresponding to the agent is set, the event is counted only if
29*4882a593Smuzhiyunit is caused by a request from that agent. Each agent ID bit is inversely mapped
30*4882a593Smuzhiyunto a corresponding bit in "config1" field. By default, the event will be
31*4882a593Smuzhiyuncounted for all agent requests (config1 = 0x0). For all the supported agents of
32*4882a593Smuzhiyuneach PMU, please refer to APM X-Gene User Manual.
33*4882a593Smuzhiyun
34*4882a593SmuzhiyunEach perf driver also provides a "cpumask" sysfs attribute, which contains a
35*4882a593Smuzhiyunsingle CPU ID of the processor which will be used to handle all the PMU events.
36*4882a593Smuzhiyun
37*4882a593SmuzhiyunExample for perf tool use::
38*4882a593Smuzhiyun
39*4882a593Smuzhiyun / # perf list | grep -e l3c -e iob -e mcb -e mc
40*4882a593Smuzhiyun   l3c0/ackq-full/                                    [Kernel PMU event]
41*4882a593Smuzhiyun <...>
42*4882a593Smuzhiyun   mcb1/mcb-csw-stall/                                [Kernel PMU event]
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun / # perf stat -a -e l3c0/read-miss/,mcb1/csw-write-request/ sleep 1
45*4882a593Smuzhiyun
46*4882a593Smuzhiyun / # perf stat -a -e l3c0/read-miss,config1=0xfffffffffffffffe/ sleep 1
47*4882a593Smuzhiyun
48*4882a593SmuzhiyunThe driver does not support sampling, therefore "perf record" will
49*4882a593Smuzhiyunnot work. Per-task (without "-a") perf sessions are not supported.
50