arm64: perf: add support for percpu pmu interrupt
Subsystems (3)
PATCH 1/1 arm64: perf: add support for percpu pmu interrupt
This patch adds support for irq registration when pmu interrupt type is PPI. The patch also fixes ARMV8_EVTYPE_* macros since evtCount field width is 10bits.
--- arch/arm64/kernel/perf_event.c | 108 +++++++++++++++++++++++++++++----------- 1 file changed, 78 insertions(+), 30 deletions(-)
arch/arm64/kernel/perf_event.c +78 -30
@@ -363,22 +363,53 @@ validate_group(struct perf_event *event) }static void +armpmu_disable_percpu_irq (void *data) +{ +struct arm_pmu *armpmu = (struct arm_pmu *)data; +struct platform_device *pmu_device = armpmu->plat_device; +int irq =platform_get_irq (pmu_device,0 ); + +cpumask_test_and_clear_cpu (smp_processor_id (), &armpmu->active_irqs); +disable_percpu_irq (irq); +} + +static void armpmu_release_hardware (struct arm_pmu *armpmu) {int i, irq, irqs;struct platform_device *pmu_device = armpmu->plat_device; - irqs =min (pmu_device->num_resources,num_possible_cpus ()); + irq =platform_get_irq (pmu_device,0 ); -for (i =0 ; i < irqs; ++i) { -if (!cpumask_test_and_clear_cpu (i, &armpmu->active_irqs)) -continue ; - irq =platform_get_irq (pmu_device, i); -if (irq >=0 ) -free_irq (irq, armpmu); +if (irq >=16 && irq <=31 ) { +on_each_cpu (armpmu_disable_percpu_irq, (void *)armpmu,1 ); + +free_percpu_irq (irq, armpmu); + }else { + irqs =min (pmu_device->num_resources,num_possible_cpus ()); + +for (i =0 ; i < irqs; ++i) { +if (!cpumask_test_and_clear_cpu (i, &armpmu->active_irqs)) +continue ; + irq =platform_get_irq (pmu_device, i); +if (irq >=0 ) +free_irq (irq, armpmu); + } } } +static void +armpmu_enable_percpu_irq (void *data) +{ +struct arm_pmu *armpmu = (struct arm_pmu *)data; +struct platform_device *pmu_device = armpmu->plat_device; +int irq =platform_get_irq (pmu_device,0 ); + +enable_percpu_irq (irq,0 ); + +cpumask_set_cpu (smp_processor_id (), &armpmu->active_irqs); +} +static int armpmu_reserve_hardware (struct arm_pmu *armpmu) {
@@ -396,36 +427,53 @@ armpmu_reserve_hardware(struct arm_pmu *armpmu)return -ENODEV ; } -for (i =0 ; i < irqs; ++i) { - err =0 ; - irq =platform_get_irq (pmu_device, i); -if (irq <0 ) -continue ; + irq =platform_get_irq (pmu_device,0 ); +if (irq >=16 && irq <=31 ) {/* -* If we have a single PMU interrupt that we can't shift, -* assume that we're running on a uniprocessor machine and -* continue. Otherwise, continue without this interrupt. +* percpu PMU interrupt. */ -if (irq_set_affinity (irq,cpumask_of (i)) && irqs >1 ) { -pr_warning ("unable to set irq affinity (irq=%d, cpu=%u)\n" , - irq, i); -continue ; - } - - err =request_irq (irq, armpmu->handle_irq, -IRQF_NOBALANCING , -"arm-pmu" , armpmu); + err =request_percpu_irq (irq, armpmu->handle_irq, +"arm-pmu" , armpmu);if (err) {pr_err ("unable to request IRQ%d for ARM PMU counters\n" , - irq); + irq);armpmu_release_hardware (armpmu);return err; } -cpumask_set_cpu (i, &armpmu->active_irqs); +on_each_cpu (armpmu_enable_percpu_irq, (void *)armpmu,1 ); + }else { +for (i =0 ; i < irqs; ++i) { + err =0 ; + irq =platform_get_irq (pmu_device, i); +if (irq <0 ) +continue ; + +/* +* If we have a single PMU interrupt that we can't shift, +* assume that we're running on a uniprocessor machine and +* continue. Otherwise, continue without this interrupt. +*/ +if (irq_set_affinity (irq,cpumask_of (i)) && irqs >1 ) { +pr_warning ("unable to set irq affinity (irq=%d, cpu=%u)\n" , + irq, i); +continue ; + } + + err =request_irq (irq, armpmu->handle_irq, +IRQF_NOBALANCING , +"arm-pmu" , armpmu); +if (err) { +pr_err ("unable to request IRQ%d for ARM PMU counters\n" , + irq); +armpmu_release_hardware (armpmu); +return err; + } + +cpumask_set_cpu (i, &armpmu->active_irqs); + } } -return 0 ; }
@@ -784,8 +832,8 @@ static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]/* * PMXEVTYPER: Event selection reg */ -#define ARMV8_EVTYPE_MASK 0xc80000ff/* Mask for writable bits */ -#define ARMV8_EVTYPE_EVENT 0xff/* Mask for EVENT bits */ +#define ARMV8_EVTYPE_MASK 0xc80003ff/* Mask for writable bits */ +#define ARMV8_EVTYPE_EVENT 0x3ff/* Mask for EVENT bits */ /* * Event filters for PMUv3
@@ -1175,7 +1223,7 @@ static void armv8pmu_reset(void *info)static int armv8_pmuv3_map_event (struct perf_event *event) {return map_cpu_event (event, &armv8_pmuv3_perf_map, - &armv8_pmuv3_perf_cache_map,0xFF ); + &armv8_pmuv3_perf_cache_map,0x3FF ); }static struct arm_pmu armv8pmu = {
Signature · 1 line
1.7.9.5
PATCH 1/1 arm64: perf: add support for percpu pmu interrupt
Hi Vinayak,
Quoted 16 lines · Vinayak Kale
This patch adds support for irq registration when pmu interrupt type is PPI. The patch also fixes ARMV8_EVTYPE_* macros since evtCount field width is 10bits.
Signed-off-by Vinayak Kale <[email protected]>Signed-off-by Tuan Phan <[email protected]>--- arch/arm64/kernel/perf_event.c | 108 +++++++++++++++++++++++++++++----------- 1 file changed, 78 insertions(+), 30 deletions(-)arch/arm64/kernel/perf_event.c +0
-0@@ -363,22 +363,53 @@ validate_group(struct perf_event *event) }
[...]
Quoted 5 lines
static int
armpmu_reserve_hardware(struct arm_pmu *armpmu)
{arch/arm64/kernel/perf_event.c +0
-0@@ -396,36 +427,53 @@ armpmu_reserve_hardware(struct arm_pmu *armpmu)return -ENODEV ;
arch/arm64/kernel/perf_event.c armpmu_reserve_hardware(struct arm_pmu *armpmu) · line 432
Quoted 10 lines
arch/arm64/kernel/perf_event.c +2
-5} -for (i =0 ; i < irqs; ++i) { - err =0 ; - irq =platform_get_irq (pmu_device, i); -if (irq <0 ) -continue ; + irq =platform_get_irq (pmu_device,0 ); +if (irq >=16 && irq <=31 ) {
This is horribly GIC specific and will break in the face of IRQ domains (since this is a virtual interrupt number).
Quoted 7 lines
arch/arm64/kernel/perf_event.c +1
-4/* -* If we have a single PMU interrupt that we can't shift, -* assume that we're running on a uniprocessor machine and -* continue. Otherwise, continue without this interrupt. +* percpu PMU interrupt. */ -if (irq_set_affinity (irq,cpumask_of (i)) && irqs >1 ) {
arch/arm64/kernel/perf_event.c armpmu_reserve_hardware(struct arm_pmu *armpmu) · line 437
Quoted 10 lines
arch/arm64/kernel/perf_event.c +2
-8-pr_warning ("unable to set irq affinity (irq=%d, cpu=%u)\n" , - irq, i); -continue ; - } - - err =request_irq (irq, armpmu->handle_irq, -IRQF_NOBALANCING , -"arm-pmu" , armpmu); + err =request_percpu_irq (irq, armpmu->handle_irq, +"arm-pmu" , armpmu);
This is broken -- the dev_id *must* be a __percpu variable for percpu irqs.
Quoted 21 lines
arch/arm64/kernel/perf_event.c +13
-2if (err) {pr_err ("unable to request IRQ%d for ARM PMU counters\n" , - irq); + irq);armpmu_release_hardware (armpmu);return err; } -cpumask_set_cpu (i, &armpmu->active_irqs); +on_each_cpu (armpmu_enable_percpu_irq, (void *)armpmu,1 ); + }else { +for (i =0 ; i < irqs; ++i) { + err =0 ; + irq =platform_get_irq (pmu_device, i); +if (irq <0 ) +continue ; + +/* +* If we have a single PMU interrupt that we can't shift, +* assume that we're running on a uniprocessor machine and +* continue. Otherwise, continue without this interrupt.
arch/arm64/kernel/perf_event.c armpmu_reserve_hardware(struct arm_pmu *armpmu) · line 466
Quoted 10 lines
arch/arm64/kernel/perf_event.c +10
-0+*/ +if (irq_set_affinity (irq,cpumask_of (i)) && irqs >1 ) { +pr_warning ("unable to set irq affinity (irq=%d, cpu=%u)\n" , + irq, i); +continue ; + } + + err =request_irq (irq, armpmu->handle_irq, +IRQF_NOBALANCING , +"arm-pmu" , armpmu);
A better way to do this is to try request_percpu_irq first. If that fails, then try request_irq. However, the error reporting out of request_percpu_irq could do with some cleanup (rather than just return -EINVAL) so we can detect the difference between this interrupt isn't per-cpu' and this per-cpu interrupt is invalid'. This can help us avoid the WARN_ON in request_irq when it is passed a per-cpu interrupt.
Quoted 12 lines
arch/arm64/kernel/perf_event.c +2
-2@@ -784,8 +832,8 @@ static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]/* * PMXEVTYPER: Event selection reg */ -#define ARMV8_EVTYPE_MASK 0xc80000ff/* Mask for writable bits */ -#define ARMV8_EVTYPE_EVENT 0xff/* Mask for EVENT bits */ +#define ARMV8_EVTYPE_MASK 0xc80003ff/* Mask for writable bits */ +#define ARMV8_EVTYPE_EVENT 0x3ff/* Mask for EVENT bits */ /* * Event filters for PMUv3
arch/arm64/kernel/perf_event.c static void armv8pmu_reset(void *info) · line 1227
Quoted 6 lines
arch/arm64/kernel/perf_event.c +1
-1@@ -1175,7 +1223,7 @@ static void armv8pmu_reset(void *info)static int armv8_pmuv3_map_event (struct perf_event *event) {return map_cpu_event (event, &armv8_pmuv3_perf_map, - &armv8_pmuv3_perf_cache_map,0xFF ); + &armv8_pmuv3_perf_cache_map,0x3FF ); }
What's all this?
Will
PATCH 1/1 arm64: perf: add support for percpu pmu interrupt
Hi Will,
Thanks for your comments. Please see inline below.
Quoted 36 lines · Will Deacon
Hi Vinayak,
Quoted 16 lines · Vinayak Kale
This patch adds support for irq registration when pmu interrupt type is PPI. The patch also fixes ARMV8_EVTYPE_* macros since evtCount field width is 10bits.
Signed-off-by Vinayak Kale <[email protected]>Signed-off-by Tuan Phan <[email protected]>--- arch/arm64/kernel/perf_event.c | 108 +++++++++++++++++++++++++++++----------- 1 file changed, 78 insertions(+), 30 deletions(-)arch/arm64/kernel/perf_event.c +0
-0@@ -363,22 +363,53 @@ validate_group(struct perf_event *event) }[...]
Quoted 14 lines
static int
armpmu_reserve_hardware(struct arm_pmu *armpmu)
{arch/arm64/kernel/perf_event.c +1
-5@@ -396,36 +427,53 @@ armpmu_reserve_hardware(struct arm_pmu *armpmu)return -ENODEV ; } -for (i =0 ; i < irqs; ++i) { - err =0 ; - irq =platform_get_irq (pmu_device, i); -if (irq <0 ) -continue ; + irq =platform_get_irq (pmu_device,0 );
Quoted 5 lines
arch/arm64/kernel/perf_event.c armpmu_reserve_hardware(struct arm_pmu *armpmu) · line 432
Quoted 1 line
arch/arm64/kernel/perf_event.c +1
-0+if (irq >=16 && irq <=31 ) {This is horribly GIC specific and will break in the face of IRQ domains (since this is a virtual interrupt number).
hmm, yes. I had not considered irq domain mapping.
Quoted 18 lines
Quoted 7 lines
arch/arm64/kernel/perf_event.c +1
-4/* -* If we have a single PMU interrupt that we can't shift, -* assume that we're running on a uniprocessor machine and -* continue. Otherwise, continue without this interrupt. +* percpu PMU interrupt. */ -if (irq_set_affinity (irq,cpumask_of (i)) && irqs >1 ) {arch/arm64/kernel/perf_event.c armpmu_reserve_hardware(struct arm_pmu *armpmu) · line 437
Quoted 10 lines
arch/arm64/kernel/perf_event.c +2
-8-pr_warning ("unable to set irq affinity (irq=%d, cpu=%u)\n" , - irq, i); -continue ; - } - - err =request_irq (irq, armpmu->handle_irq, -IRQF_NOBALANCING , -"arm-pmu" , armpmu); + err =request_percpu_irq (irq, armpmu->handle_irq, +"arm-pmu" , armpmu);
Quoted 2 lines
This is broken -- the
dev_id*must* be a__percpuvariable for percpu irqs.
Yes, this needs to be fixed.
Quoted 30 lines
Quoted 30 lines
arch/arm64/kernel/perf_event.c +22
-2if (err) {pr_err ("unable to request IRQ%d for ARM PMU counters\n" , - irq); + irq);armpmu_release_hardware (armpmu);return err; } -cpumask_set_cpu (i, &armpmu->active_irqs); +on_each_cpu (armpmu_enable_percpu_irq, (void *)armpmu,1 ); + }else { +for (i =0 ; i < irqs; ++i) { + err =0 ; + irq =platform_get_irq (pmu_device, i); +if (irq <0 ) +continue ; + +/* +* If we have a single PMU interrupt that we can't shift, +* assume that we're running on a uniprocessor machine and +* continue. Otherwise, continue without this interrupt. +*/ +if (irq_set_affinity (irq,cpumask_of (i)) && irqs >1 ) { +pr_warning ("unable to set irq affinity (irq=%d, cpu=%u)\n" , + irq, i); +continue ; + } + + err = request_irq(irq, armpmu->handle_irq, + IRQF_NOBALANCING,
Quoted 9 lines
arch/arm64/kernel/perf_event.c armpmu_reserve_hardware(struct arm_pmu *armpmu) · line 466
Quoted 1 line
arch/arm64/kernel/perf_event.c +1
-0+ "arm-pmu", armpmu);A better way to do this is to try
request_percpu_irqfirst. If that fails, then tryrequest_irq. However, the error reporting out ofrequest_percpu_irqcould do with some cleanup (rather than just return-EINVAL) so we can detect the difference betweenthis interrupt isn't per-cpu' andthis per-cpu interrupt is invalid'. This can help us avoid theWARN_ONinrequest_irqwhen it is passed a per-cpu interrupt.
Trying request_percpu_irq first seems better. But if it fails then we would straight away
assume it's not per-cpu interrupt and try request_irq. In this case we may not be able to
detect 'this per-cpu interrupt is invalid' case.
Quoted 9 lines
Quoted 9 lines
arch/arm64/kernel/perf_event.c +2
-2@@ -784,8 +832,8 @@ static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]/* * PMXEVTYPER: Event selection reg */ -#define ARMV8_EVTYPE_MASK 0xc80000ff/* Mask for writable bits */ -#define ARMV8_EVTYPE_EVENT 0xff/* Mask for EVENT bits */ +#define ARMV8_EVTYPE_MASK 0xc80003ff/* Mask for writable bits */ +#define ARMV8_EVTYPE_EVENT 0x3ff/* Mask for EVENT bits */
Quoted 12 lines
arch/arm64/kernel/perf_event.c static void armv8pmu_reset(void *info) · line 1227
Quoted 9 lines
arch/arm64/kernel/perf_event.c +1
-1/* * Event filters for PMUv3 @@ -1175,7 +1223,7 @@ static void armv8pmu_reset(void *info)static int armv8_pmuv3_map_event (struct perf_event *event) {return map_cpu_event (event, &armv8_pmuv3_perf_map, - &armv8_pmuv3_perf_cache_map,0xFF ); + &armv8_pmuv3_perf_cache_map,0x3FF ); }What's all this?
The evtCount (event number) field width is 10bits in event selection register. So need to fix ARMV8_EVTYPE_* macros and related mask value.
Quoted 1 line
From the subject of patch, one may think that the patch is specific
only to percpu irq changes (which is not true).
I had mentioned about fixing ARMV8_EVTYPE_* macros in patch description.
Quoted 1 line
Will
-Vinayak
PATCH 1/1 arm64: perf: add support for percpu pmu interrupt
Quoted 42 lines · Vinayak Kale
Quoted 31 lines · Will Deacon
Quoted 30 lines · Vinayak Kale
if (err) {
pr_err("unable to request IRQ%d for ARM PMU counters\n",arch/arm64/kernel/perf_event.c +22
-2- irq); + irq);armpmu_release_hardware (armpmu);return err; } -cpumask_set_cpu (i, &armpmu->active_irqs); +on_each_cpu (armpmu_enable_percpu_irq, (void *)armpmu,1 ); + }else { +for (i =0 ; i < irqs; ++i) { + err =0 ; + irq =platform_get_irq (pmu_device, i); +if (irq <0 ) +continue ; + +/* +* If we have a single PMU interrupt that we can't shift, +* assume that we're running on a uniprocessor machine and +* continue. Otherwise, continue without this interrupt. +*/ +if (irq_set_affinity (irq,cpumask_of (i)) && irqs >1 ) { +pr_warning ("unable to set irq affinity (irq=%d, cpu=%u)\n" , + irq, i); +continue ; + } + + err = request_irq(irq, armpmu->handle_irq, + IRQF_NOBALANCING,Quoted 9 lines
Quoted 1 line
+ "arm-pmu", armpmu);
A better way to do this is to try
request_percpu_irqfirst. If that fails, then tryrequest_irq. However, the error reporting out ofrequest_percpu_irqcould do with some cleanup (rather than just return-EINVAL) so we can detect the difference betweenthis interrupt isn't per-cpu' andthis per-cpu interrupt is invalid'. This can help us avoid theWARN_ONinrequest_irqwhen it is passed a per-cpu interrupt.
Quoted 5 lines
Trying
request_percpu_irqfirst seems better. But if it fails then we would straight away
assume it's not per-cpu interrupt and tryrequest_irq. In this case we may not be able to
detect 'this per-cpu interrupt is invalid' case.
Right, but you could have a patch to fix the core code as part of this series, as I hinted at above.
Quoted 22 lines
Quoted 9 lines
Quoted 9 lines
arch/arm64/kernel/perf_event.c +2
-2@@ -784,8 +832,8 @@ static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]/* * PMXEVTYPER: Event selection reg */ -#define ARMV8_EVTYPE_MASK 0xc80000ff/* Mask for writable bits */ -#define ARMV8_EVTYPE_EVENT 0xff/* Mask for EVENT bits */ +#define ARMV8_EVTYPE_MASK 0xc80003ff/* Mask for writable bits */ +#define ARMV8_EVTYPE_EVENT 0x3ff/* Mask for EVENT bits */ Quoted 12 lines
arch/arm64/kernel/perf_event.c static void armv8pmu_reset(void *info) · line 1227
Quoted 9 lines
arch/arm64/kernel/perf_event.c +1
-1/* * Event filters for PMUv3 @@ -1175,7 +1223,7 @@ static void armv8pmu_reset(void *info)static int armv8_pmuv3_map_event (struct perf_event *event) {return map_cpu_event (event, &armv8_pmuv3_perf_map, - &armv8_pmuv3_perf_cache_map,0xFF ); + &armv8_pmuv3_perf_cache_map,0x3FF ); }What's all this?
Quoted 7 lines
The evtCount (event number) field width is 10bits in event selection register. So need to fix ARMV8_EVTYPE_* macros and related mask value.
From the subject of patch, one may think that the patch is specific only to percpu irq changes (which is not true).
I had mentioned about fixing ARMV8_EVTYPE_* macros in patch description.
Ok, please put this change in a separate patch.
Will
PATCH 1/1 arm64: perf: add support for percpu pmu interrupt
Quoted 43 lines · Will Deacon
Quoted 42 lines · Vinayak Kale
Quoted 40 lines · Will Deacon
Quoted 21 lines · Vinayak Kale
if (err) {
pr_err("unable to request IRQ%d for ARM PMU counters\n",arch/arm64/kernel/perf_event.c +13
-2- irq); + irq);armpmu_release_hardware (armpmu);return err; } -cpumask_set_cpu (i, &armpmu->active_irqs); +on_each_cpu (armpmu_enable_percpu_irq, (void *)armpmu,1 ); + }else { +for (i =0 ; i < irqs; ++i) { + err =0 ; + irq =platform_get_irq (pmu_device, i); +if (irq <0 ) +continue ; + +/* +* If we have a single PMU interrupt that we can't shift, +* assume that we're running on a uniprocessor machine and +* continue. Otherwise, continue without this interrupt. arch/arm64/kernel/perf_event.c armpmu_reserve_hardware(struct arm_pmu *armpmu) · line 466
Quoted 10 lines
arch/arm64/kernel/perf_event.c +10
-0+*/ +if (irq_set_affinity (irq,cpumask_of (i)) && irqs >1 ) { +pr_warning ("unable to set irq affinity (irq=%d, cpu=%u)\n" , + irq, i); +continue ; + } + + err =request_irq (irq, armpmu->handle_irq, +IRQF_NOBALANCING , +"arm-pmu" , armpmu);A better way to do this is to try
request_percpu_irqfirst. If that fails, then tryrequest_irq. However, the error reporting out ofrequest_percpu_irqcould do with some cleanup (rather than just return-EINVAL) so we can detect the difference betweenthis interrupt isn't per-cpu' andthis per-cpu interrupt is invalid'. This can help us avoid theWARN_ONinrequest_irqwhen it is passed a per-cpu interrupt.
Quoted 9 lines
Quoted 5 lines
Trying
request_percpu_irqfirst seems better. But if it fails then we would straight away
assume it's not per-cpu interrupt and tryrequest_irq. In this case we may not be able to
detect 'this per-cpu interrupt is invalid' case.Right, but you could have a patch to fix the core code as part of this series, as I hinted at above.
Modifying core code to change return value of request_percpu_irq seems risky as other drivers might be checking the error code.
As you said, passing invalid ppi to request_irq would cause unwanted WARN_ON. But this would be rare case and platform specific. Can we just live with this WARN_ON in such rare cases?
Quoted 25 lines
Quoted 25 lines
Quoted 9 lines
Quoted 9 lines
arch/arm64/kernel/perf_event.c +2
-2@@ -784,8 +832,8 @@ static const unsigned armv8_pmuv3_perf_cache_map[PERF_COUNT_HW_CACHE_MAX]/* * PMXEVTYPER: Event selection reg */ -#define ARMV8_EVTYPE_MASK 0xc80000ff/* Mask for writable bits */ -#define ARMV8_EVTYPE_EVENT 0xff/* Mask for EVENT bits */ +#define ARMV8_EVTYPE_MASK 0xc80003ff/* Mask for writable bits */ +#define ARMV8_EVTYPE_EVENT 0x3ff/* Mask for EVENT bits */ Quoted 12 lines
arch/arm64/kernel/perf_event.c static void armv8pmu_reset(void *info) · line 1227
Quoted 9 lines
arch/arm64/kernel/perf_event.c +1
-1/* * Event filters for PMUv3 @@ -1175,7 +1223,7 @@ static void armv8pmu_reset(void *info)static int armv8_pmuv3_map_event (struct perf_event *event) {return map_cpu_event (event, &armv8_pmuv3_perf_map, - &armv8_pmuv3_perf_cache_map,0xFF ); + &armv8_pmuv3_perf_cache_map,0x3FF ); }What's all this?
The evtCount (event number) field width is 10bits in event selection register. So need to fix ARMV8_EVTYPE_* macros and related mask value.
Quoted 7 lines
Quoted 4 lines
From the subject of patch, one may think that the patch is specific only to percpu irq changes (which is not true).
I had mentioned about fixing ARMV8_EVTYPE_* macros in patch description.
Ok, please put this change in a separate patch.
Okay.
Quoted 1 line
Will
PATCH 1/1 arm64: perf: add support for percpu pmu interrupt
Quoted 15 lines · Vinayak Kale
Quoted 14 lines · Will Deacon
Quoted 13 lines
Quoted 7 lines
A better way to do this is to try
request_percpu_irqfirst. If that fails, then tryrequest_irq. However, the error reporting out ofrequest_percpu_irqcould do with some cleanup (rather than just return-EINVAL) so we can detect the difference betweenthis interrupt isn't per-cpu' andthis per-cpu interrupt is invalid'. This can help us avoid theWARN_ONinrequest_irqwhen it is passed a per-cpu interrupt.Trying
request_percpu_irqfirst seems better. But if it fails then we would straight away
assume it's not per-cpu interrupt and tryrequest_irq. In this case we may not be able to
detect 'this per-cpu interrupt is invalid' case.
Quoted 6 lines
Quoted 3 lines
Right, but you could have a patch to fix the core code as part of this series, as I hinted at above.
Modifying core code to change return value of
request_percpu_irqseems risky as other drivers might be checking the error code.
Well, grepping for "request_percpu_irq" shows a handful of callers, which doesn't look too onerous to audit.
Quoted 3 lines
As you said, passing invalid ppi to
request_irqwould cause unwantedWARN_ON. But this would be rare case and platform specific. Can we just live with thisWARN_ONin such rare cases?
Just fix the fundamental problem rather than paper over it.
Will