soc: qcom: add l2 cache perf events driver
Subsystems (3)
PATCH v5 1/1 soc: qcom: add 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.
---
v5:
Fold the header and l2-accessors into .c file Use multi-instance framework for hotplug Change terminology from slice to cluster for clarity Remove unnecessary rmw sequence for enable registers Use prev_count in hwc rather than in slice Enforce all events in same group on same CPU Add comments, rename variables for clarity
v4:
Replace notifier with hotplug statemachine
Allocate PMU struct dynamically
v3:
Remove exports from l2-accessors
Change l2-accessors Kconfig to make it not user-selectable Reorder and remove unnecessary includes
v2:
Add the l2-accessors patch to this patchset, previously posted separately. Remove sampling and per-task functionality for this uncore PMU. Use cpumask to replace code which filtered events to one cpu per slice. Replace manual event filtering with filter_match callback.
Use a separate used_mask for event groups.
Add hotplug notifier for CPU and irq migration.
Remove extraneous synchronisation instructions.
Other miscellaneous cleanup.
drivers/soc/qcom/Kconfig | 9 + drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/perf_event_l2.c | 948 +++++++++++++++++++++++++++++++++++++++ include/linux/cpuhotplug.h | 1 + 4 files changed, 959 insertions(+) create mode 100644 drivers/soc/qcom/perf_event_l2.c
drivers/soc/qcom/Kconfig +9 -0
@@ -10,6 +10,15 @@ config QCOM_GSBI functions for connecting the underlying serial UART, SPI, and I2C devices to the output pins. +config QCOM_PERF_EVENTS_L2 + bool "Qualcomm Technologies L2-cache perf events" + depends on ARCH_QCOM && HW_PERF_EVENTS + help + Provides support for the L2 cache performance monitor unit (PMU) + in Qualcomm Technologies processors. + Adds the L2 cache PMU into the perf events subsystem for + monitoring L2 cache events. + config QCOM_PM bool "Qualcomm Power Management" depends on ARCH_QCOM && !ARM64
drivers/soc/qcom/Makefile +1 -0
@@ -1,4 +1,5 @@ obj-$(CONFIG_QCOM_GSBI) += qcom_gsbi.o +obj-$(CONFIG_QCOM_PERF_EVENTS_L2) += perf_event_l2.o obj-$(CONFIG_QCOM_PM) += spm.o obj-$(CONFIG_QCOM_SMD) += smd.o obj-$(CONFIG_QCOM_SMD_RPM) += smd-rpm.o
drivers/soc/qcom/perf_event_l2.c new file +948 -0
948 lines not on this page · raw message
include/linux/cpuhotplug.h +1 -0
@@ -102,6 +102,7 @@ enum cpuhp_state {CPUHP_AP_PERF_ARM_CCI_ONLINE ,CPUHP_AP_PERF_ARM_CCN_ONLINE ,CPUHP_AP_PERF_ARM_L2X0_ONLINE , +CPUHP_AP_PERF_ARM_QCOM_L2_ONLINE ,CPUHP_AP_WORKQUEUE_ONLINE ,CPUHP_AP_RCUTREE_ONLINE , CPUHP_AP_NOTIFY_ONLINE,
Signature · 3 lines
Qualcomm Datacenter Technologies, Inc. as an affiliate of Qualcomm Technologies Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
kbuild test robot
build boturl: https://github.com/0day-ci/linux/commits/Neil-Leeder/soc-qcom-add-l2-cache-perf-events-driver/20160922-000500 config: arm-allmodconfig (attached as .config) compiler: arm-linux-gnueabi-gcc…
Hi Neil,
[auto build test ERROR on next-20160921]
[cannot apply to linus/master linux/master v4.8-rc7 v4.8-rc6 v4.8-rc5 v4.8-rc7]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]
[Suggest to use git(>=2.9.0) format-patch --base=<commit> (or --base=auto for convenience) to record what (public, well-known) commit your patch series was built on] [Check https://git-scm.com/docs/git-format-patch for more information]
url: https://github.com/0day-ci/linux/commits/Neil-Leeder/soc-qcom-add-l2-cache-perf-events-driver/20160922-000500
config: arm-allmodconfig (attached as .config)
compiler: arm-linux-gnueabi-gcc (Debian 6.1.1-9) 6.1.1 20160705
reproduce:
wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# save the attached .config to linux build tree
make.cross ARCH=arm
All error/warnings (new ones prefixed by >>):
drivers/soc/qcom/perf_event_l2.c: In function 'set_l2_indirect_reg':
>> drivers/soc/qcom/perf_event_l2.c:92:2: error: implicit declaration of function 'write_sysreg' [-Werror=implicit-function-declaration]
write_sysreg(reg, L2CPUSRSELR_EL1);
^~~~~~~~~~~~
>> drivers/soc/qcom/perf_event_l2.c:74:33: error: 'S3_3_c15_c0_6' undeclared (first use in this function)
#define L2CPUSRSELR_EL1 S3_3_c15_c0_6
^
>> drivers/soc/qcom/perf_event_l2.c:92:20: note: in expansion of macro 'L2CPUSRSELR_EL1'
write_sysreg(reg, L2CPUSRSELR_EL1);
^~~~~~~~~~~~~~~
drivers/soc/qcom/perf_event_l2.c:74:33: note: each undeclared identifier is reported only once for each function it appears in
#define L2CPUSRSELR_EL1 S3_3_c15_c0_6
^
>> drivers/soc/qcom/perf_event_l2.c:92:20: note: in expansion of macro 'L2CPUSRSELR_EL1'
write_sysreg(reg, L2CPUSRSELR_EL1);
^~~~~~~~~~~~~~~
>> drivers/soc/qcom/perf_event_l2.c:75:33: error: 'S3_3_c15_c0_7' undeclared (first use in this function)
#define L2CPUSRDR_EL1 S3_3_c15_c0_7
^
>> drivers/soc/qcom/perf_event_l2.c:94:20: note: in expansion of macro 'L2CPUSRDR_EL1'
write_sysreg(val, L2CPUSRDR_EL1);
^~~~~~~~~~~~~
drivers/soc/qcom/perf_event_l2.c: In function 'get_l2_indirect_reg':
>> drivers/soc/qcom/perf_event_l2.c:74:33: error: 'S3_3_c15_c0_6' undeclared (first use in this function)
#define L2CPUSRSELR_EL1 S3_3_c15_c0_6
^
drivers/soc/qcom/perf_event_l2.c:112:20: note: in expansion of macro 'L2CPUSRSELR_EL1'
write_sysreg(reg, L2CPUSRSELR_EL1);
^~~~~~~~~~~~~~~
>> drivers/soc/qcom/perf_event_l2.c:114:8: error: implicit declaration of function 'read_sysreg' [-Werror=implicit-function-declaration]
val = read_sysreg(L2CPUSRDR_EL1);
^~~~~~~~~~~
>> drivers/soc/qcom/perf_event_l2.c:75:33: error: 'S3_3_c15_c0_7' undeclared (first use in this function)
#define L2CPUSRDR_EL1 S3_3_c15_c0_7
^
drivers/soc/qcom/perf_event_l2.c:114:20: note: in expansion of macro 'L2CPUSRDR_EL1'
val = read_sysreg(L2CPUSRDR_EL1);
^~~~~~~~~~~~~
drivers/soc/qcom/perf_event_l2.c: In function 'l2_cache_pmu_probe_cluster':
>> drivers/soc/qcom/perf_event_l2.c:787:6: error: implicit declaration of function 'acpi_bus_get_device' [-Werror=implicit-function-declaration]
if (acpi_bus_get_device(ACPI_HANDLE(dev), &device))
^~~~~~~~~~~~~~~~~~~
>> drivers/soc/qcom/perf_event_l2.c:790:20: error: dereferencing pointer to incomplete type 'struct acpi_device'
if (kstrtol(device->pnp.unique_id, 10, &fw_cluster_id) < 0) {
^~cc1: some warnings being treated as errors
vim +/write_sysreg +92 drivers/soc/qcom/perf_event_l2.c
68
69 #define L2_EVT_GROUP_MAX 7
70
71 #define L2_MAX_PERIOD U32_MAX
72 #define L2_CNT_PERIOD (U32_MAX - GENMASK(26, 0))
73
> 74 #define L2CPUSRSELR_EL1 S3_3_c15_c0_6
> 75 #define L2CPUSRDR_EL1 S3_3_c15_c0_7
76
77 static DEFINE_RAW_SPINLOCK(l2_access_lock);
78
79 /**
80 * set_l2_indirect_reg: write value to an L2 register
81 * @reg: Address of L2 register.
82 * @value: Value to be written to register.
83 *
84 * Use architecturally required barriers for ordering between system register
85 * accesses
86 */
87 static void set_l2_indirect_reg(u64 reg, u64 val)
88 {
89 unsigned long flags;
90
91 raw_spin_lock_irqsave(&l2_access_lock, flags);
> 92 write_sysreg(reg, L2CPUSRSELR_EL1);
93 isb();
> 94 write_sysreg(val, L2CPUSRDR_EL1);
95 isb();
96 raw_spin_unlock_irqrestore(&l2_access_lock, flags);
97 }
98
99 /**
100 * get_l2_indirect_reg: read an L2 register value
101 * @reg: Address of L2 register.
102 *
103 * Use architecturally required barriers for ordering between system register
104 * accesses
105 */
106 static u64 get_l2_indirect_reg(u64 reg)
107 {
108 u64 val;
109 unsigned long flags;
110
111 raw_spin_lock_irqsave(&l2_access_lock, flags);
112 write_sysreg(reg, L2CPUSRSELR_EL1);
113 isb();
> 114 val = read_sysreg(L2CPUSRDR_EL1); 115 raw_spin_unlock_irqrestore(&l2_access_lock, flags);
116
117 return val;
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
-------------- next part --------------
A non-text attachment was scrubbed...
Name: .config.gz
Type: application/gzip
Size: 59315 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20160922/bf497f00/attachment-0001.gz>