linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: will.deacon@arm.com (Will Deacon)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 5/5] arm_pmu: acpi: request IRQs up-front
Date: Mon, 11 Dec 2017 18:45:54 +0000	[thread overview]
Message-ID: <20171211184554.GG3275@arm.com> (raw)
In-Reply-To: <20171211175539.jqjxyoa4vtwrakl3@lakrids.cambridge.arm.com>

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

  reply	other threads:[~2017-12-11 18:45 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-01 14:12 [PATCH 0/5] arm_pmu: fix lockdep issues with ACPI systems Mark Rutland
2017-11-01 14:12 ` [PATCH 1/5] arm_pmu: fold platform helpers into platform code Mark Rutland
2017-11-01 14:12 ` [PATCH 2/5] arm_pmu: have armpmu_alloc() take GFP flags Mark Rutland
2017-12-06  6:54   ` Zhangshaokun
2017-12-11 17:37   ` Will Deacon
2017-12-11 18:02     ` Mark Rutland
2017-11-01 14:12 ` [PATCH 3/5] arm_pmu: acpi: check for mismatched PPIs Mark Rutland
2017-12-11 17:37   ` Will Deacon
2017-12-11 18:08     ` Mark Rutland
2017-12-11 18:43       ` Will Deacon
2017-11-01 14:12 ` [PATCH 4/5] arm_pmu: note IRQs/PMUs per-cpu Mark Rutland
2017-12-11 17:36   ` Will Deacon
2017-12-11 18:15     ` Mark Rutland
2017-11-01 14:12 ` [PATCH 5/5] arm_pmu: acpi: request IRQs up-front Mark Rutland
2017-12-11 17:36   ` Will Deacon
2017-12-11 17:55     ` Mark Rutland
2017-12-11 18:45       ` Will Deacon [this message]
2017-11-01 17:02 ` [PATCH 0/5] arm_pmu: fix lockdep issues with ACPI systems Tyler Baicar
2017-12-11 17:38 ` Will Deacon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171211184554.GG3275@arm.com \
    --to=will.deacon@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).