All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] irqdesc: Add function to identify percpu_devid irqs
@ 2017-10-13 10:44 Julien Thierry
  2017-10-13 10:44 ` [PATCH 2/2] arm/arm64: pmu: Distinguish percpu irq and percpu_devid irq Julien Thierry
  2017-10-13 10:52 ` [PATCH 1/2] irqdesc: Add function to identify percpu_devid irqs Marc Zyngier
  0 siblings, 2 replies; 4+ messages in thread
From: Julien Thierry @ 2017-10-13 10:44 UTC (permalink / raw)
  To: linux-arm-kernel

Signed-off-by: Julien Thierry <julien.thierry@arm.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Marc Zyngier <marc.zyngier@arm.com>
---
 include/linux/irqdesc.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
index 3e90a09..93960cf 100644
--- a/include/linux/irqdesc.h
+++ b/include/linux/irqdesc.h
@@ -244,6 +244,14 @@ static inline int irq_is_percpu(unsigned int irq)
 	return desc->status_use_accessors & IRQ_PER_CPU;
 }

+static inline int irq_is_percpu_devid(unsigned int irq)
+{
+	struct irq_desc *desc;
+
+	desc = irq_to_desc(irq);
+	return desc->status_use_accessors & IRQ_PER_CPU_DEVID;
+}
+
 static inline void
 irq_set_lockdep_class(unsigned int irq, struct lock_class_key *class)
 {
--
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] arm/arm64: pmu: Distinguish percpu irq and percpu_devid irq
  2017-10-13 10:44 [PATCH 1/2] irqdesc: Add function to identify percpu_devid irqs Julien Thierry
@ 2017-10-13 10:44 ` Julien Thierry
  2017-10-13 10:52 ` [PATCH 1/2] irqdesc: Add function to identify percpu_devid irqs Marc Zyngier
  1 sibling, 0 replies; 4+ messages in thread
From: Julien Thierry @ 2017-10-13 10:44 UTC (permalink / raw)
  To: linux-arm-kernel

arm_pmu interrupts are maked as PERCPU even when these are not local
physical interrupts to a single CPU. When using non-local interrupts,
interrupts marked as PERCPU will not get freed not disabled properly
by the PMU driver.

Check if interrupts are local to a single CPU with PERCPU_DEVID since
this is what the PMU driver really needs to know.

Signed-off-by: Julien Thierry <julien.thierry@arm.com>
Will Deacon <will.deacon@arm.com>
Mark Rutland <mark.rutland@arm.com>
---
 drivers/perf/arm_pmu.c          | 10 +++++-----
 drivers/perf/arm_pmu_platform.c |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

So far this has not been an issue because enable_percpu_irq does nothing
when the irq is not marked as percpu devid.

diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
index d14fc2e..7bc5eee 100644
--- a/drivers/perf/arm_pmu.c
+++ b/drivers/perf/arm_pmu.c
@@ -539,7 +539,7 @@ void armpmu_free_irq(struct arm_pmu *armpmu, int cpu)
 	if (!cpumask_test_and_clear_cpu(cpu, &armpmu->active_irqs))
 		return;

-	if (irq_is_percpu(irq)) {
+	if (irq_is_percpu_devid(irq)) {
 		free_percpu_irq(irq, &hw_events->percpu_pmu);
 		cpumask_clear(&armpmu->active_irqs);
 		return;
@@ -565,10 +565,10 @@ int armpmu_request_irq(struct arm_pmu *armpmu, int cpu)
 	if (!irq)
 		return 0;

-	if (irq_is_percpu(irq) && cpumask_empty(&armpmu->active_irqs)) {
+	if (irq_is_percpu_devid(irq) && cpumask_empty(&armpmu->active_irqs)) {
 		err = request_percpu_irq(irq, handler, "arm-pmu",
 					 &hw_events->percpu_pmu);
-	} else if (irq_is_percpu(irq)) {
+	} else if (irq_is_percpu_devid(irq)) {
 		int other_cpu = cpumask_first(&armpmu->active_irqs);
 		int other_irq = per_cpu(hw_events->irq, other_cpu);

@@ -649,7 +649,7 @@ static int arm_perf_starting_cpu(unsigned int cpu, struct hlist_node *node)

 	irq = armpmu_get_cpu_irq(pmu, cpu);
 	if (irq) {
-		if (irq_is_percpu(irq)) {
+		if (irq_is_percpu_devid(irq)) {
 			enable_percpu_irq(irq, IRQ_TYPE_NONE);
 			return 0;
 		}
@@ -667,7 +667,7 @@ static int arm_perf_teardown_cpu(unsigned int cpu, struct hlist_node *node)
 		return 0;

 	irq = armpmu_get_cpu_irq(pmu, cpu);
-	if (irq && irq_is_percpu(irq))
+	if (irq && irq_is_percpu_devid(irq))
 		disable_percpu_irq(irq);

 	return 0;
diff --git a/drivers/perf/arm_pmu_platform.c b/drivers/perf/arm_pmu_platform.c
index 4eafa7a..bbc64ee 100644
--- a/drivers/perf/arm_pmu_platform.c
+++ b/drivers/perf/arm_pmu_platform.c
@@ -126,7 +126,7 @@ static int pmu_parse_irqs(struct arm_pmu *pmu)

 	if (num_irqs == 1) {
 		int irq = platform_get_irq(pdev, 0);
-		if (irq && irq_is_percpu(irq))
+		if (irq && irq_is_percpu_devid(irq))
 			return pmu_parse_percpu_irq(pmu, irq);
 	}

@@ -149,7 +149,7 @@ static int pmu_parse_irqs(struct arm_pmu *pmu)
 		if (WARN_ON(irq <= 0))
 			continue;

-		if (irq_is_percpu(irq)) {
+		if (irq_is_percpu_devid(irq)) {
 			pr_warn("multiple PPIs or mismatched SPI/PPI detected\n");
 			return -EINVAL;
 		}
--
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 1/2] irqdesc: Add function to identify percpu_devid irqs
  2017-10-13 10:44 [PATCH 1/2] irqdesc: Add function to identify percpu_devid irqs Julien Thierry
  2017-10-13 10:44 ` [PATCH 2/2] arm/arm64: pmu: Distinguish percpu irq and percpu_devid irq Julien Thierry
@ 2017-10-13 10:52 ` Marc Zyngier
  2017-10-13 11:25   ` Julien Thierry
  1 sibling, 1 reply; 4+ messages in thread
From: Marc Zyngier @ 2017-10-13 10:52 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Julien,

On 13/10/17 11:44, Julien Thierry wrote:
> Signed-off-by: Julien Thierry <julien.thierry@arm.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Marc Zyngier <marc.zyngier@arm.com>
> ---
>  include/linux/irqdesc.h | 8 ++++++++
>  1 file changed, 8 insertions(+)
> 
> diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
> index 3e90a09..93960cf 100644
> --- a/include/linux/irqdesc.h
> +++ b/include/linux/irqdesc.h
> @@ -244,6 +244,14 @@ static inline int irq_is_percpu(unsigned int irq)
>  	return desc->status_use_accessors & IRQ_PER_CPU;
>  }
> 
> +static inline int irq_is_percpu_devid(unsigned int irq)
> +{
> +	struct irq_desc *desc;
> +
> +	desc = irq_to_desc(irq);
> +	return desc->status_use_accessors & IRQ_PER_CPU_DEVID;
> +}
> +
>  static inline void
>  irq_set_lockdep_class(unsigned int irq, struct lock_class_key *class)
>  {
> --
> 1.9.1
> 

Please write a proper commit message (for example explaining why
irq_is_percpu is not necessarily the right thing). A cover letter also
wouldn't hurt (that's pretty much customary if you send more than a
single patch).

Thanks,

	M.
-- 
Jazz is not dead. It just smells funny...

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] irqdesc: Add function to identify percpu_devid irqs
  2017-10-13 10:52 ` [PATCH 1/2] irqdesc: Add function to identify percpu_devid irqs Marc Zyngier
@ 2017-10-13 11:25   ` Julien Thierry
  0 siblings, 0 replies; 4+ messages in thread
From: Julien Thierry @ 2017-10-13 11:25 UTC (permalink / raw)
  To: linux-arm-kernel



On 13/10/17 11:52, Marc Zyngier wrote:
> Hi Julien,
> 
> On 13/10/17 11:44, Julien Thierry wrote:
>> Signed-off-by: Julien Thierry <julien.thierry@arm.com>
>> Cc: Thomas Gleixner <tglx@linutronix.de>
>> Cc: Marc Zyngier <marc.zyngier@arm.com>
>> ---
>>   include/linux/irqdesc.h | 8 ++++++++
>>   1 file changed, 8 insertions(+)
>>
>> diff --git a/include/linux/irqdesc.h b/include/linux/irqdesc.h
>> index 3e90a09..93960cf 100644
>> --- a/include/linux/irqdesc.h
>> +++ b/include/linux/irqdesc.h
>> @@ -244,6 +244,14 @@ static inline int irq_is_percpu(unsigned int irq)
>>   	return desc->status_use_accessors & IRQ_PER_CPU;
>>   }
>>
>> +static inline int irq_is_percpu_devid(unsigned int irq)
>> +{
>> +	struct irq_desc *desc;
>> +
>> +	desc = irq_to_desc(irq);
>> +	return desc->status_use_accessors & IRQ_PER_CPU_DEVID;
>> +}
>> +
>>   static inline void
>>   irq_set_lockdep_class(unsigned int irq, struct lock_class_key *class)
>>   {
>> --
>> 1.9.1
>>
> 
> Please write a proper commit message (for example explaining why
> irq_is_percpu is not necessarily the right thing). A cover letter also
> wouldn't hurt (that's pretty much customary if you send more than a
> single patch).
> 

Sorry, I'll do that.

Cheers,

-- 
Julien Thierry

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-13 11:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-13 10:44 [PATCH 1/2] irqdesc: Add function to identify percpu_devid irqs Julien Thierry
2017-10-13 10:44 ` [PATCH 2/2] arm/arm64: pmu: Distinguish percpu irq and percpu_devid irq Julien Thierry
2017-10-13 10:52 ` [PATCH 1/2] irqdesc: Add function to identify percpu_devid irqs Marc Zyngier
2017-10-13 11:25   ` Julien Thierry

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.