Re: [PATCH v2 5/5] arm64/perf: Extend event mask for ARMv8.1
Jan, There was already a "[PATCH v2 5/5]" that differs from this one. Perhaps you should resend the entire patch set and mark it v3. Thanks, David Daney On 01/29/2016 12:29 AM, Jan Glauber wrote: ARMv8.1 increases the PMU event number space. Detect the presence of this PMUv3 type and extend the event mask. The event mask is moved to struct arm_pmu so different event masks can exist, depending on the PMU type. Signed-off-by: Jan Glauber --- arch/arm/kernel/perf_event_v6.c | 6 -- arch/arm/kernel/perf_event_v7.c | 29 +++-- arch/arm/kernel/perf_event_xscale.c | 4 +++- arch/arm64/kernel/perf_event.c | 33 +++-- drivers/perf/arm_pmu.c | 5 +++-- include/linux/perf/arm_pmu.h| 4 ++-- 6 files changed, 50 insertions(+), 31 deletions(-) diff --git a/arch/arm/kernel/perf_event_v6.c b/arch/arm/kernel/perf_event_v6.c index 09413e7..d6769f5 100644
Re: [PATCH v2 5/5] arm64/perf: Extend event mask for ARMv8.1
On Fri, Jan 29, 2016 at 01:33:35AM +0800, kbuild test robot wrote: > Hi Jan, > > [auto build test ERROR on robh/for-next] > [also build test ERROR on v4.5-rc1 next-20160128] > [cannot apply to tip/perf/core] > [if your patch is applied to the wrong git tree, please drop us a note to > help improving the system] > > url: > https://github.com/0day-ci/linux/commits/Jan-Glauber/Cavium-ThunderX-PMU-support/20160128-225855 > base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux for-next > config: arm-corgi_defconfig (attached as .config) > 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 errors (new ones prefixed by >>): > >arch/arm/kernel/perf_event_xscale.c: In function 'xscale_map_event': > >> arch/arm/kernel/perf_event_xscale.c:360:9: error: too many arguments to > >> function 'armpmu_map_event' > return armpmu_map_event(event, _perf_map, > ^ I forgot the arm32 parts of this patch. I'll resend this patch only, the other patches don't touch arm32. --Jan
[PATCH v2 5/5] arm64/perf: Extend event mask for ARMv8.1
ARMv8.1 increases the PMU event number space. Detect the presence of this PMUv3 type and extend the event mask. The event mask is moved to struct arm_pmu so different event masks can exist, depending on the PMU type. Signed-off-by: Jan Glauber --- arch/arm/kernel/perf_event_v6.c | 6 -- arch/arm/kernel/perf_event_v7.c | 29 +++-- arch/arm/kernel/perf_event_xscale.c | 4 +++- arch/arm64/kernel/perf_event.c | 33 +++-- drivers/perf/arm_pmu.c | 5 +++-- include/linux/perf/arm_pmu.h| 4 ++-- 6 files changed, 50 insertions(+), 31 deletions(-) diff --git a/arch/arm/kernel/perf_event_v6.c b/arch/arm/kernel/perf_event_v6.c index 09413e7..d6769f5 100644 --- a/arch/arm/kernel/perf_event_v6.c +++ b/arch/arm/kernel/perf_event_v6.c @@ -481,7 +481,7 @@ static void armv6mpcore_pmu_disable_event(struct perf_event *event) static int armv6_map_event(struct perf_event *event) { return armpmu_map_event(event, _perf_map, - _perf_cache_map, 0xFF); + _perf_cache_map); } static void armv6pmu_init(struct arm_pmu *cpu_pmu) @@ -494,6 +494,7 @@ static void armv6pmu_init(struct arm_pmu *cpu_pmu) cpu_pmu->get_event_idx = armv6pmu_get_event_idx; cpu_pmu->start = armv6pmu_start; cpu_pmu->stop = armv6pmu_stop; + cpu_pmu->event_mask = 0xFF; cpu_pmu->map_event = armv6_map_event; cpu_pmu->num_events = 3; cpu_pmu->max_period = (1LLU << 32) - 1; @@ -531,7 +532,7 @@ static int armv6_1176_pmu_init(struct arm_pmu *cpu_pmu) static int armv6mpcore_map_event(struct perf_event *event) { return armpmu_map_event(event, _perf_map, - _perf_cache_map, 0xFF); + _perf_cache_map); } static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu) @@ -545,6 +546,7 @@ static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu) cpu_pmu->get_event_idx = armv6pmu_get_event_idx; cpu_pmu->start = armv6pmu_start; cpu_pmu->stop = armv6pmu_stop; + cpu_pmu->event_mask = 0xFF; cpu_pmu->map_event = armv6mpcore_map_event; cpu_pmu->num_events = 3; cpu_pmu->max_period = (1LLU << 32) - 1; diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c index 4152158..8aab098 100644 --- a/arch/arm/kernel/perf_event_v7.c +++ b/arch/arm/kernel/perf_event_v7.c @@ -1042,7 +1042,7 @@ static int armv7pmu_get_event_idx(struct pmu_hw_events *cpuc, int idx; struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); struct hw_perf_event *hwc = >hw; - unsigned long evtype = hwc->config_base & ARMV7_EVTYPE_EVENT; + unsigned long evtype = hwc->config_base & cpu_pmu->event_mask; /* Always place a cycle counter into the cycle counter. */ if (evtype == ARMV7_PERFCTR_CPU_CYCLES) { @@ -1109,55 +1109,55 @@ static void armv7pmu_reset(void *info) static int armv7_a8_map_event(struct perf_event *event) { return armpmu_map_event(event, _a8_perf_map, - _a8_perf_cache_map, 0xFF); + _a8_perf_cache_map); } static int armv7_a9_map_event(struct perf_event *event) { return armpmu_map_event(event, _a9_perf_map, - _a9_perf_cache_map, 0xFF); + _a9_perf_cache_map); } static int armv7_a5_map_event(struct perf_event *event) { return armpmu_map_event(event, _a5_perf_map, - _a5_perf_cache_map, 0xFF); + _a5_perf_cache_map); } static int armv7_a15_map_event(struct perf_event *event) { return armpmu_map_event(event, _a15_perf_map, - _a15_perf_cache_map, 0xFF); + _a15_perf_cache_map); } static int armv7_a7_map_event(struct perf_event *event) { return armpmu_map_event(event, _a7_perf_map, - _a7_perf_cache_map, 0xFF); + _a7_perf_cache_map); } static int armv7_a12_map_event(struct perf_event *event) { return armpmu_map_event(event, _a12_perf_map, - _a12_perf_cache_map, 0xFF); + _a12_perf_cache_map); } static int krait_map_event(struct perf_event *event) { return armpmu_map_event(event, _perf_map, - _perf_cache_map, 0xF); + _perf_cache_map); } static int krait_map_event_no_branch(struct perf_event *event) { return armpmu_map_event(event, _perf_map_no_branch, - _perf_cache_map, 0xF); + _perf_cache_map); } static int scorpion_map_event(struct perf_event *event) {
Re: [PATCH v2 5/5] arm64/perf: Extend event mask for ARMv8.1
On Fri, Jan 29, 2016 at 01:33:35AM +0800, kbuild test robot wrote: > Hi Jan, > > [auto build test ERROR on robh/for-next] > [also build test ERROR on v4.5-rc1 next-20160128] > [cannot apply to tip/perf/core] > [if your patch is applied to the wrong git tree, please drop us a note to > help improving the system] > > url: > https://github.com/0day-ci/linux/commits/Jan-Glauber/Cavium-ThunderX-PMU-support/20160128-225855 > base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux for-next > config: arm-corgi_defconfig (attached as .config) > 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 errors (new ones prefixed by >>): > >arch/arm/kernel/perf_event_xscale.c: In function 'xscale_map_event': > >> arch/arm/kernel/perf_event_xscale.c:360:9: error: too many arguments to > >> function 'armpmu_map_event' > return armpmu_map_event(event, _perf_map, > ^ I forgot the arm32 parts of this patch. I'll resend this patch only, the other patches don't touch arm32. --Jan
[PATCH v2 5/5] arm64/perf: Extend event mask for ARMv8.1
ARMv8.1 increases the PMU event number space. Detect the presence of this PMUv3 type and extend the event mask. The event mask is moved to struct arm_pmu so different event masks can exist, depending on the PMU type. Signed-off-by: Jan Glauber--- arch/arm/kernel/perf_event_v6.c | 6 -- arch/arm/kernel/perf_event_v7.c | 29 +++-- arch/arm/kernel/perf_event_xscale.c | 4 +++- arch/arm64/kernel/perf_event.c | 33 +++-- drivers/perf/arm_pmu.c | 5 +++-- include/linux/perf/arm_pmu.h| 4 ++-- 6 files changed, 50 insertions(+), 31 deletions(-) diff --git a/arch/arm/kernel/perf_event_v6.c b/arch/arm/kernel/perf_event_v6.c index 09413e7..d6769f5 100644 --- a/arch/arm/kernel/perf_event_v6.c +++ b/arch/arm/kernel/perf_event_v6.c @@ -481,7 +481,7 @@ static void armv6mpcore_pmu_disable_event(struct perf_event *event) static int armv6_map_event(struct perf_event *event) { return armpmu_map_event(event, _perf_map, - _perf_cache_map, 0xFF); + _perf_cache_map); } static void armv6pmu_init(struct arm_pmu *cpu_pmu) @@ -494,6 +494,7 @@ static void armv6pmu_init(struct arm_pmu *cpu_pmu) cpu_pmu->get_event_idx = armv6pmu_get_event_idx; cpu_pmu->start = armv6pmu_start; cpu_pmu->stop = armv6pmu_stop; + cpu_pmu->event_mask = 0xFF; cpu_pmu->map_event = armv6_map_event; cpu_pmu->num_events = 3; cpu_pmu->max_period = (1LLU << 32) - 1; @@ -531,7 +532,7 @@ static int armv6_1176_pmu_init(struct arm_pmu *cpu_pmu) static int armv6mpcore_map_event(struct perf_event *event) { return armpmu_map_event(event, _perf_map, - _perf_cache_map, 0xFF); + _perf_cache_map); } static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu) @@ -545,6 +546,7 @@ static int armv6mpcore_pmu_init(struct arm_pmu *cpu_pmu) cpu_pmu->get_event_idx = armv6pmu_get_event_idx; cpu_pmu->start = armv6pmu_start; cpu_pmu->stop = armv6pmu_stop; + cpu_pmu->event_mask = 0xFF; cpu_pmu->map_event = armv6mpcore_map_event; cpu_pmu->num_events = 3; cpu_pmu->max_period = (1LLU << 32) - 1; diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c index 4152158..8aab098 100644 --- a/arch/arm/kernel/perf_event_v7.c +++ b/arch/arm/kernel/perf_event_v7.c @@ -1042,7 +1042,7 @@ static int armv7pmu_get_event_idx(struct pmu_hw_events *cpuc, int idx; struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); struct hw_perf_event *hwc = >hw; - unsigned long evtype = hwc->config_base & ARMV7_EVTYPE_EVENT; + unsigned long evtype = hwc->config_base & cpu_pmu->event_mask; /* Always place a cycle counter into the cycle counter. */ if (evtype == ARMV7_PERFCTR_CPU_CYCLES) { @@ -1109,55 +1109,55 @@ static void armv7pmu_reset(void *info) static int armv7_a8_map_event(struct perf_event *event) { return armpmu_map_event(event, _a8_perf_map, - _a8_perf_cache_map, 0xFF); + _a8_perf_cache_map); } static int armv7_a9_map_event(struct perf_event *event) { return armpmu_map_event(event, _a9_perf_map, - _a9_perf_cache_map, 0xFF); + _a9_perf_cache_map); } static int armv7_a5_map_event(struct perf_event *event) { return armpmu_map_event(event, _a5_perf_map, - _a5_perf_cache_map, 0xFF); + _a5_perf_cache_map); } static int armv7_a15_map_event(struct perf_event *event) { return armpmu_map_event(event, _a15_perf_map, - _a15_perf_cache_map, 0xFF); + _a15_perf_cache_map); } static int armv7_a7_map_event(struct perf_event *event) { return armpmu_map_event(event, _a7_perf_map, - _a7_perf_cache_map, 0xFF); + _a7_perf_cache_map); } static int armv7_a12_map_event(struct perf_event *event) { return armpmu_map_event(event, _a12_perf_map, - _a12_perf_cache_map, 0xFF); + _a12_perf_cache_map); } static int krait_map_event(struct perf_event *event) { return armpmu_map_event(event, _perf_map, - _perf_cache_map, 0xF); + _perf_cache_map); } static int krait_map_event_no_branch(struct perf_event *event) { return armpmu_map_event(event, _perf_map_no_branch, - _perf_cache_map, 0xF); + _perf_cache_map); } static int scorpion_map_event(struct
Re: [PATCH v2 5/5] arm64/perf: Extend event mask for ARMv8.1
Jan, There was already a "[PATCH v2 5/5]" that differs from this one. Perhaps you should resend the entire patch set and mark it v3. Thanks, David Daney On 01/29/2016 12:29 AM, Jan Glauber wrote: ARMv8.1 increases the PMU event number space. Detect the presence of this PMUv3 type and extend the event mask. The event mask is moved to struct arm_pmu so different event masks can exist, depending on the PMU type. Signed-off-by: Jan Glauber--- arch/arm/kernel/perf_event_v6.c | 6 -- arch/arm/kernel/perf_event_v7.c | 29 +++-- arch/arm/kernel/perf_event_xscale.c | 4 +++- arch/arm64/kernel/perf_event.c | 33 +++-- drivers/perf/arm_pmu.c | 5 +++-- include/linux/perf/arm_pmu.h| 4 ++-- 6 files changed, 50 insertions(+), 31 deletions(-) diff --git a/arch/arm/kernel/perf_event_v6.c b/arch/arm/kernel/perf_event_v6.c index 09413e7..d6769f5 100644
Re: [PATCH v2 5/5] arm64/perf: Extend event mask for ARMv8.1
Hi Jan, [auto build test ERROR on robh/for-next] [also build test ERROR on v4.5-rc1 next-20160128] [cannot apply to tip/perf/core] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Jan-Glauber/Cavium-ThunderX-PMU-support/20160128-225855 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux for-next config: arm-corgi_defconfig (attached as .config) 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 errors (new ones prefixed by >>): arch/arm/kernel/perf_event_xscale.c: In function 'xscale_map_event': >> arch/arm/kernel/perf_event_xscale.c:360:9: error: too many arguments to >> function 'armpmu_map_event' return armpmu_map_event(event, _perf_map, ^ In file included from arch/arm/kernel/perf_event_xscale.c:21:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ vim +/armpmu_map_event +360 arch/arm/kernel/perf_event_xscale.c 43eab878 Will Deacon 2010-11-13 354 break; 43eab878 Will Deacon 2010-11-13 355 } 43eab878 Will Deacon 2010-11-13 356 } 43eab878 Will Deacon 2010-11-13 357 e1f431b5 Mark Rutland 2011-04-28 358 static int xscale_map_event(struct perf_event *event) e1f431b5 Mark Rutland 2011-04-28 359 { 6dbc0029 Will Deacon 2012-07-29 @360 return armpmu_map_event(event, _perf_map, e1f431b5 Mark Rutland 2011-04-28 361 _perf_cache_map, 0xFF); e1f431b5 Mark Rutland 2011-04-28 362 } e1f431b5 Mark Rutland 2011-04-28 363 :: The code at line 360 was first introduced by commit :: 6dbc00297095122ea89e016ce6affad0b7c0ddac ARM: perf: prepare for moving CPU PMU code into separate file :: TO: Will Deacon :: CC: Will Deacon --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
Re: [PATCH v2 5/5] arm64/perf: Extend event mask for ARMv8.1
Hi Jan, [auto build test ERROR on robh/for-next] [also build test ERROR on v4.5-rc1 next-20160128] [cannot apply to tip/perf/core] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Jan-Glauber/Cavium-ThunderX-PMU-support/20160128-225855 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux for-next config: arm-imx_v6_v7_defconfig (attached as .config) 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 errors (new ones prefixed by >>): arch/arm/kernel/perf_event_v6.c: In function 'armv6_map_event': >> arch/arm/kernel/perf_event_v6.c:483:9: error: too many arguments to function >> 'armpmu_map_event' return armpmu_map_event(event, _perf_map, ^ In file included from arch/arm/kernel/perf_event_v6.c:39:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v6.c: In function 'armv6mpcore_map_event': arch/arm/kernel/perf_event_v6.c:533:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _perf_map, ^ In file included from arch/arm/kernel/perf_event_v6.c:39:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ -- arch/arm/kernel/perf_event_v7.c: In function 'armv7_a8_map_event': >> arch/arm/kernel/perf_event_v7.c::9: error: too many arguments to >> function 'armpmu_map_event' return armpmu_map_event(event, _a8_perf_map, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In function 'armv7_a9_map_event': arch/arm/kernel/perf_event_v7.c:1117:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _a9_perf_map, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In function 'armv7_a5_map_event': arch/arm/kernel/perf_event_v7.c:1123:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _a5_perf_map, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In function 'armv7_a15_map_event': arch/arm/kernel/perf_event_v7.c:1129:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _a15_perf_map, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In function 'armv7_a7_map_event': arch/arm/kernel/perf_event_v7.c:1135:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _a7_perf_map, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In function 'armv7_a12_map_event': arch/arm/kernel/perf_event_v7.c:1141:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _a12_perf_map, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In function 'krait_map_event': arch/arm/kernel/perf_event_v7.c:1147:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _perf_map, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In function 'krait_map_event_no_branch': arch/arm/kernel/perf_event_v7.c:1153:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _perf_map_no_branch, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In
[PATCH v2 5/5] arm64/perf: Extend event mask for ARMv8.1
ARMv8.1 increases the PMU event number space. Detect the presence of this PMUv3 type and extend the event mask. The event mask is moved to struct arm_pmu so different event masks can exist, depending on the PMU type. Signed-off-by: Jan Glauber --- arch/arm64/kernel/perf_event.c | 33 +++-- drivers/perf/arm_pmu.c | 5 +++-- include/linux/perf/arm_pmu.h | 4 ++-- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index 5e4275e..78b24cb 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -419,7 +419,7 @@ static const struct attribute_group *armv8_pmuv3_attr_groups[] = { /* * PMXEVTYPER: Event selection reg */ -#defineARMV8_EVTYPE_MASK 0xc80003ff /* Mask for writable bits */ +#defineARMV8_EVTYPE_FLT_MASK 0xc800 /* Writable filter bits */ #defineARMV8_EVTYPE_EVENT 0x3ff /* Mask for EVENT bits */ /* @@ -510,10 +510,8 @@ static inline void armv8pmu_write_counter(struct perf_event *event, u32 value) static inline void armv8pmu_write_evtype(int idx, u32 val) { - if (armv8pmu_select_counter(idx) == idx) { - val &= ARMV8_EVTYPE_MASK; + if (armv8pmu_select_counter(idx) == idx) asm volatile("msr pmxevtyper_el0, %0" :: "r" (val)); - } } static inline int armv8pmu_enable_counter(int idx) @@ -570,6 +568,7 @@ static void armv8pmu_enable_event(struct perf_event *event) struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events); int idx = hwc->idx; + u32 val; /* * Enable counter and interrupt, and set the counter to count @@ -585,7 +584,8 @@ static void armv8pmu_enable_event(struct perf_event *event) /* * Set event (if destined for PMNx counters). */ - armv8pmu_write_evtype(idx, hwc->config_base); + val = hwc->config_base & (ARMV8_EVTYPE_FLT_MASK | cpu_pmu->event_mask); + armv8pmu_write_evtype(idx, val); /* * Enable interrupt for this counter @@ -716,7 +716,7 @@ static int armv8pmu_get_event_idx(struct pmu_hw_events *cpuc, int idx; struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); struct hw_perf_event *hwc = >hw; - unsigned long evtype = hwc->config_base & ARMV8_EVTYPE_EVENT; + unsigned long evtype = hwc->config_base & cpu_pmu->event_mask; /* Always place a cycle counter into the cycle counter. */ if (evtype == ARMV8_PMUV3_PERFCTR_CLOCK_CYCLES) { @@ -786,29 +786,25 @@ static void armv8pmu_reset(void *info) static int armv8_pmuv3_map_event(struct perf_event *event) { return armpmu_map_event(event, _pmuv3_perf_map, - _pmuv3_perf_cache_map, - ARMV8_EVTYPE_EVENT); + _pmuv3_perf_cache_map); } static int armv8_a53_map_event(struct perf_event *event) { return armpmu_map_event(event, _a53_perf_map, - _a53_perf_cache_map, - ARMV8_EVTYPE_EVENT); + _a53_perf_cache_map); } static int armv8_a57_map_event(struct perf_event *event) { return armpmu_map_event(event, _a57_perf_map, - _a57_perf_cache_map, - ARMV8_EVTYPE_EVENT); + _a57_perf_cache_map); } static int armv8_thunder_map_event(struct perf_event *event) { return armpmu_map_event(event, _thunder_perf_map, - _thunder_perf_cache_map, - ARMV8_EVTYPE_EVENT); + _thunder_perf_cache_map); } static void armv8pmu_read_num_pmnc_events(void *info) @@ -831,6 +827,8 @@ static int armv8pmu_probe_num_events(struct arm_pmu *arm_pmu) static void armv8_pmu_init(struct arm_pmu *cpu_pmu) { + u64 id; + cpu_pmu->handle_irq = armv8pmu_handle_irq, cpu_pmu->enable = armv8pmu_enable_event, cpu_pmu->disable= armv8pmu_disable_event, @@ -842,6 +840,13 @@ static void armv8_pmu_init(struct arm_pmu *cpu_pmu) cpu_pmu->reset = armv8pmu_reset, cpu_pmu->max_period = (1LLU << 32) - 1, cpu_pmu->set_event_filter = armv8pmu_set_event_filter; + + /* detect ARMv8.1 PMUv3 with extended event mask */ + id = read_cpuid(ID_AA64DFR0_EL1); + if (((id >> 8) & 0xf) == 4) + cpu_pmu->event_mask = 0x; /* ARMv8.1 extended events */ + else + cpu_pmu->event_mask = ARMV8_EVTYPE_EVENT; } static int armv8_pmuv3_init(struct arm_pmu *cpu_pmu) diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index 166637f..79e681f 100644 ---
Re: [PATCH v2 5/5] arm64/perf: Extend event mask for ARMv8.1
Hi Jan, [auto build test ERROR on robh/for-next] [also build test ERROR on v4.5-rc1 next-20160128] [cannot apply to tip/perf/core] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Jan-Glauber/Cavium-ThunderX-PMU-support/20160128-225855 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux for-next config: arm-imx_v6_v7_defconfig (attached as .config) 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 errors (new ones prefixed by >>): arch/arm/kernel/perf_event_v6.c: In function 'armv6_map_event': >> arch/arm/kernel/perf_event_v6.c:483:9: error: too many arguments to function >> 'armpmu_map_event' return armpmu_map_event(event, _perf_map, ^ In file included from arch/arm/kernel/perf_event_v6.c:39:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v6.c: In function 'armv6mpcore_map_event': arch/arm/kernel/perf_event_v6.c:533:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _perf_map, ^ In file included from arch/arm/kernel/perf_event_v6.c:39:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ -- arch/arm/kernel/perf_event_v7.c: In function 'armv7_a8_map_event': >> arch/arm/kernel/perf_event_v7.c::9: error: too many arguments to >> function 'armpmu_map_event' return armpmu_map_event(event, _a8_perf_map, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In function 'armv7_a9_map_event': arch/arm/kernel/perf_event_v7.c:1117:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _a9_perf_map, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In function 'armv7_a5_map_event': arch/arm/kernel/perf_event_v7.c:1123:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _a5_perf_map, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In function 'armv7_a15_map_event': arch/arm/kernel/perf_event_v7.c:1129:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _a15_perf_map, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In function 'armv7_a7_map_event': arch/arm/kernel/perf_event_v7.c:1135:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _a7_perf_map, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In function 'armv7_a12_map_event': arch/arm/kernel/perf_event_v7.c:1141:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _a12_perf_map, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In function 'krait_map_event': arch/arm/kernel/perf_event_v7.c:1147:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _perf_map, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In function 'krait_map_event_no_branch': arch/arm/kernel/perf_event_v7.c:1153:9: error: too many arguments to function 'armpmu_map_event' return armpmu_map_event(event, _perf_map_no_branch, ^ In file included from arch/arm/kernel/perf_event_v7.c:28:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ arch/arm/kernel/perf_event_v7.c: In
Re: [PATCH v2 5/5] arm64/perf: Extend event mask for ARMv8.1
Hi Jan, [auto build test ERROR on robh/for-next] [also build test ERROR on v4.5-rc1 next-20160128] [cannot apply to tip/perf/core] [if your patch is applied to the wrong git tree, please drop us a note to help improving the system] url: https://github.com/0day-ci/linux/commits/Jan-Glauber/Cavium-ThunderX-PMU-support/20160128-225855 base: https://git.kernel.org/pub/scm/linux/kernel/git/robh/linux for-next config: arm-corgi_defconfig (attached as .config) 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 errors (new ones prefixed by >>): arch/arm/kernel/perf_event_xscale.c: In function 'xscale_map_event': >> arch/arm/kernel/perf_event_xscale.c:360:9: error: too many arguments to >> function 'armpmu_map_event' return armpmu_map_event(event, _perf_map, ^ In file included from arch/arm/kernel/perf_event_xscale.c:21:0: include/linux/perf/arm_pmu.h:119:5: note: declared here int armpmu_map_event(struct perf_event *event, ^ vim +/armpmu_map_event +360 arch/arm/kernel/perf_event_xscale.c 43eab878 Will Deacon 2010-11-13 354 break; 43eab878 Will Deacon 2010-11-13 355 } 43eab878 Will Deacon 2010-11-13 356 } 43eab878 Will Deacon 2010-11-13 357 e1f431b5 Mark Rutland 2011-04-28 358 static int xscale_map_event(struct perf_event *event) e1f431b5 Mark Rutland 2011-04-28 359 { 6dbc0029 Will Deacon 2012-07-29 @360 return armpmu_map_event(event, _perf_map, e1f431b5 Mark Rutland 2011-04-28 361 _perf_cache_map, 0xFF); e1f431b5 Mark Rutland 2011-04-28 362 } e1f431b5 Mark Rutland 2011-04-28 363 :: The code at line 360 was first introduced by commit :: 6dbc00297095122ea89e016ce6affad0b7c0ddac ARM: perf: prepare for moving CPU PMU code into separate file :: TO: Will Deacon:: CC: Will Deacon --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: Binary data
[PATCH v2 5/5] arm64/perf: Extend event mask for ARMv8.1
ARMv8.1 increases the PMU event number space. Detect the presence of this PMUv3 type and extend the event mask. The event mask is moved to struct arm_pmu so different event masks can exist, depending on the PMU type. Signed-off-by: Jan Glauber--- arch/arm64/kernel/perf_event.c | 33 +++-- drivers/perf/arm_pmu.c | 5 +++-- include/linux/perf/arm_pmu.h | 4 ++-- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/arch/arm64/kernel/perf_event.c b/arch/arm64/kernel/perf_event.c index 5e4275e..78b24cb 100644 --- a/arch/arm64/kernel/perf_event.c +++ b/arch/arm64/kernel/perf_event.c @@ -419,7 +419,7 @@ static const struct attribute_group *armv8_pmuv3_attr_groups[] = { /* * PMXEVTYPER: Event selection reg */ -#defineARMV8_EVTYPE_MASK 0xc80003ff /* Mask for writable bits */ +#defineARMV8_EVTYPE_FLT_MASK 0xc800 /* Writable filter bits */ #defineARMV8_EVTYPE_EVENT 0x3ff /* Mask for EVENT bits */ /* @@ -510,10 +510,8 @@ static inline void armv8pmu_write_counter(struct perf_event *event, u32 value) static inline void armv8pmu_write_evtype(int idx, u32 val) { - if (armv8pmu_select_counter(idx) == idx) { - val &= ARMV8_EVTYPE_MASK; + if (armv8pmu_select_counter(idx) == idx) asm volatile("msr pmxevtyper_el0, %0" :: "r" (val)); - } } static inline int armv8pmu_enable_counter(int idx) @@ -570,6 +568,7 @@ static void armv8pmu_enable_event(struct perf_event *event) struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); struct pmu_hw_events *events = this_cpu_ptr(cpu_pmu->hw_events); int idx = hwc->idx; + u32 val; /* * Enable counter and interrupt, and set the counter to count @@ -585,7 +584,8 @@ static void armv8pmu_enable_event(struct perf_event *event) /* * Set event (if destined for PMNx counters). */ - armv8pmu_write_evtype(idx, hwc->config_base); + val = hwc->config_base & (ARMV8_EVTYPE_FLT_MASK | cpu_pmu->event_mask); + armv8pmu_write_evtype(idx, val); /* * Enable interrupt for this counter @@ -716,7 +716,7 @@ static int armv8pmu_get_event_idx(struct pmu_hw_events *cpuc, int idx; struct arm_pmu *cpu_pmu = to_arm_pmu(event->pmu); struct hw_perf_event *hwc = >hw; - unsigned long evtype = hwc->config_base & ARMV8_EVTYPE_EVENT; + unsigned long evtype = hwc->config_base & cpu_pmu->event_mask; /* Always place a cycle counter into the cycle counter. */ if (evtype == ARMV8_PMUV3_PERFCTR_CLOCK_CYCLES) { @@ -786,29 +786,25 @@ static void armv8pmu_reset(void *info) static int armv8_pmuv3_map_event(struct perf_event *event) { return armpmu_map_event(event, _pmuv3_perf_map, - _pmuv3_perf_cache_map, - ARMV8_EVTYPE_EVENT); + _pmuv3_perf_cache_map); } static int armv8_a53_map_event(struct perf_event *event) { return armpmu_map_event(event, _a53_perf_map, - _a53_perf_cache_map, - ARMV8_EVTYPE_EVENT); + _a53_perf_cache_map); } static int armv8_a57_map_event(struct perf_event *event) { return armpmu_map_event(event, _a57_perf_map, - _a57_perf_cache_map, - ARMV8_EVTYPE_EVENT); + _a57_perf_cache_map); } static int armv8_thunder_map_event(struct perf_event *event) { return armpmu_map_event(event, _thunder_perf_map, - _thunder_perf_cache_map, - ARMV8_EVTYPE_EVENT); + _thunder_perf_cache_map); } static void armv8pmu_read_num_pmnc_events(void *info) @@ -831,6 +827,8 @@ static int armv8pmu_probe_num_events(struct arm_pmu *arm_pmu) static void armv8_pmu_init(struct arm_pmu *cpu_pmu) { + u64 id; + cpu_pmu->handle_irq = armv8pmu_handle_irq, cpu_pmu->enable = armv8pmu_enable_event, cpu_pmu->disable= armv8pmu_disable_event, @@ -842,6 +840,13 @@ static void armv8_pmu_init(struct arm_pmu *cpu_pmu) cpu_pmu->reset = armv8pmu_reset, cpu_pmu->max_period = (1LLU << 32) - 1, cpu_pmu->set_event_filter = armv8pmu_set_event_filter; + + /* detect ARMv8.1 PMUv3 with extended event mask */ + id = read_cpuid(ID_AA64DFR0_EL1); + if (((id >> 8) & 0xf) == 4) + cpu_pmu->event_mask = 0x; /* ARMv8.1 extended events */ + else + cpu_pmu->event_mask = ARMV8_EVTYPE_EVENT; } static int armv8_pmuv3_init(struct arm_pmu *cpu_pmu) diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c index 166637f..79e681f