Skip to content

Commit 21bdbb7

Browse files
Neil Leederwildea01
authored andcommitted
perf: add qcom l2 cache perf events driver
Adds perf events support for L2 cache PMU. The L2 cache PMU driver is named 'l2cache_0' and can be used with perf events to profile L2 events such as cache hits and misses on Qualcomm Technologies processors. Reviewed-by: Mark Rutland <[email protected]> Signed-off-by: Neil Leeder <[email protected]> [will: minimise nesting in l2_cache_associate_cpu_with_cluster] [will: use kstrtoul for unsigned long, remove redunant .owner setting] Signed-off-by: Will Deacon <[email protected]>
1 parent fe0a7ef commit 21bdbb7

File tree

5 files changed

+1062
-0
lines changed

5 files changed

+1062
-0
lines changed

Documentation/perf/qcom_l2_pmu.txt

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
Qualcomm Technologies Level-2 Cache Performance Monitoring Unit (PMU)
2+
=====================================================================
3+
4+
This driver supports the L2 cache clusters found in Qualcomm Technologies
5+
Centriq SoCs. There are multiple physical L2 cache clusters, each with their
6+
own PMU. Each cluster has one or more CPUs associated with it.
7+
8+
There is one logical L2 PMU exposed, which aggregates the results from
9+
the physical PMUs.
10+
11+
The driver provides a description of its available events and configuration
12+
options in sysfs, see /sys/devices/l2cache_0.
13+
14+
The "format" directory describes the format of the events.
15+
16+
Events can be envisioned as a 2-dimensional array. Each column represents
17+
a group of events. There are 8 groups. Only one entry from each
18+
group can be in use at a time. If multiple events from the same group
19+
are specified, the conflicting events cannot be counted at the same time.
20+
21+
Events are specified as 0xCCG, where CC is 2 hex digits specifying
22+
the code (array row) and G specifies the group (column) 0-7.
23+
24+
In addition there is a cycle counter event specified by the value 0xFE
25+
which is outside the above scheme.
26+
27+
The driver provides a "cpumask" sysfs attribute which contains a mask
28+
consisting of one CPU per cluster which will be used to handle all the PMU
29+
events on that cluster.
30+
31+
Examples for use with perf:
32+
33+
perf stat -e l2cache_0/config=0x001/,l2cache_0/config=0x042/ -a sleep 1
34+
35+
perf stat -e l2cache_0/config=0xfe/ -C 2 sleep 1
36+
37+
The driver does not support sampling, therefore "perf record" will
38+
not work. Per-task perf sessions are not supported.

drivers/perf/Kconfig

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ config ARM_PMU
1212
Say y if you want to use CPU performance monitors on ARM-based
1313
systems.
1414

15+
config QCOM_L2_PMU
16+
bool "Qualcomm Technologies L2-cache PMU"
17+
depends on ARCH_QCOM && ARM64 && PERF_EVENTS && ACPI
18+
help
19+
Provides support for the L2 cache performance monitor unit (PMU)
20+
in Qualcomm Technologies processors.
21+
Adds the L2 cache PMU into the perf events subsystem for
22+
monitoring L2 cache events.
23+
1524
config XGENE_PMU
1625
depends on PERF_EVENTS && ARCH_XGENE
1726
bool "APM X-Gene SoC PMU"

drivers/perf/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
obj-$(CONFIG_ARM_PMU) += arm_pmu.o
2+
obj-$(CONFIG_QCOM_L2_PMU) += qcom_l2_pmu.o
23
obj-$(CONFIG_XGENE_PMU) += xgene_pmu.o

0 commit comments

Comments
 (0)