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