^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 1) ==========================
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 2) ARM Cache Coherent Network
^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) CCN-504 is a ring-bus interconnect consisting of 11 crosspoints
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 6) (XPs), with each crosspoint supporting up to two device ports,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 7) so nodes (devices) 0 and 1 are connected to crosspoint 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 8) nodes 2 and 3 to crosspoint 1 etc.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 9)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 10) PMU (perf) driver
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 11) -----------------
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 12)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 13) The CCN driver registers a perf PMU driver, which provides
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 14) description of available events and configuration options
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 15) in sysfs, see /sys/bus/event_source/devices/ccn*.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 16)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 17) The "format" directory describes format of the config, config1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 18) and config2 fields of the perf_event_attr structure. The "events"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 19) directory provides configuration templates for all documented
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 20) events, that can be used with perf tool. For example "xp_valid_flit"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 21) is an equivalent of "type=0x8,event=0x4". Other parameters must be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 22) explicitly specified.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 23)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 24) For events originating from device, "node" defines its index.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 25)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 26) Crosspoint PMU events require "xp" (index), "bus" (bus number)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 27) and "vc" (virtual channel ID).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 28)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 29) Crosspoint watchpoint-based events (special "event" value 0xfe)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 30) require "xp" and "vc" as above plus "port" (device port index),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 31) "dir" (transmit/receive direction), comparator values ("cmp_l"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 32) and "cmp_h") and "mask", being index of the comparator mask.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 33)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 34) Masks are defined separately from the event description
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 35) (due to limited number of the config values) in the "cmp_mask"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 36) directory, with first 8 configurable by user and additional
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 37) 4 hardcoded for the most frequent use cases.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 38)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 39) Cycle counter is described by a "type" value 0xff and does
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 40) not require any other settings.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 41)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 42) The driver also provides a "cpumask" sysfs attribute, which contains
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 43) a single CPU ID, of the processor which will be used to handle all
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 44) the CCN PMU events. It is recommended that the user space tools
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 45) request the events on this processor (if not, the perf_event->cpu value
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 46) will be overwritten anyway). In case of this processor being offlined,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 47) the events are migrated to another one and the attribute is updated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 48)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 49) Example of perf tool use::
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 50)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 51) / # perf list | grep ccn
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 52) ccn/cycles/ [Kernel PMU event]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 53) <...>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 54) ccn/xp_valid_flit,xp=?,port=?,vc=?,dir=?/ [Kernel PMU event]
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 55) <...>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 56)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 57) / # perf stat -a -e ccn/cycles/,ccn/xp_valid_flit,xp=1,port=0,vc=1,dir=1/ \
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 58) sleep 1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 59)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 60) The driver does not support sampling, therefore "perf record" will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 61) not work. Per-task (without "-a") perf sessions are not supported.