[PATCH 5/5] arm_pmu: acpi: request IRQs up-front

Will Deacon will.deacon at arm.com
Mon Dec 11 10:45:54 PST 2017


On Mon, Dec 11, 2017 at 05:55:40PM +0000, Mark Rutland wrote:
> On Mon, Dec 11, 2017 at 05:36:47PM +0000, Will Deacon wrote:
> > On Wed, Nov 01, 2017 at 02:12:39PM +0000, Mark Rutland wrote:
> > > We can't request IRQs in atomic context, so for ACPI systems we'll have
> > > to request them up-front, and later associate them with CPUs.
> > > 
> > > This patch reorganises the arm_pmu code to do so. As we no longer have
> > > the arm_pmu strucutre at probe time, a number of prototypes need to be
> > > adjusted, requiring changes to the common arm_pmu code and arm_pmu
> > > platform code.
> 
> > > +void armpmu_bind_cpu(struct arm_pmu *armpmu, int cpu)
> > >  {
> > > -	struct arm_pmu_platdata *platdata = armpmu_get_platdata(armpmu);
> > > -	unsigned long irq_flags;
> > > -	struct pmu_hw_events __percpu *hw_events = armpmu->hw_events;
> > > -	int irq = per_cpu(hw_events->irq, cpu);
> > > -	if (!irq)
> > > -		return 0;
> > > -
> > > -	if (platdata && platdata->irq_flags) {
> > > -		irq_flags = platdata->irq_flags;
> > > -	} else {
> > > -		irq_flags = ARM_PMU_IRQ_FLAGS;
> > > -	}
> > > -
> > >  	per_cpu(cpu_armpmu, cpu) = armpmu;
> > 
> > Can we not make the binding implicit in armpmu_{request,free}_irq?
> 
> Unfortunately not.
> 
> As mentioned in the commit message (typo and all), in the ACPI case, we
> need to request/free IRQs before we know the PMU.

Urgh. This is hideous! Just try reading the imnplementation of
armpmu_bind_cpu out loud.

Could we use {enable,disable}_irq in the hotplug notifier and request the
interrupts with NOAUTOEN instead? That would mean we have a similar flow
for SPI and PPIs and could potentially hide some of the book-keeping behind
armpmu_{enable,disable}_irq functions.

Will



More information about the linux-arm-kernel mailing list