public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: will.deacon@arm•com (Will Deacon)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH 3/5] arm_pmu: acpi: check for mismatched PPIs
Date: Mon, 11 Dec 2017 18:43:37 +0000	[thread overview]
Message-ID: <20171211184337.GF3275@arm.com> (raw)
In-Reply-To: <20171211180830.firkcy3jptw3bou3@lakrids.cambridge.arm.com>

On Mon, Dec 11, 2017 at 06:08:31PM +0000, Mark Rutland wrote:
> On Mon, Dec 11, 2017 at 05:37:07PM +0000, Will Deacon wrote:
> > On Wed, Nov 01, 2017 at 02:12:37PM +0000, Mark Rutland wrote:
> > > The arm_pmu platform code explicitly checks for mismatched PPIs at probe
> > > time, while the ACPI code leaves this to the core code. Future
> > > refactoring will make this difficult for the core code to check, so
> > > let's have the ACPI code check this explicitly.
> > > 
> > > As before, upon a failure we'll continue on without an interrupt. Ho
> > > hum.
> > > 
> > > Signed-off-by: Mark Rutland <mark.rutland@arm•com>
> > > Cc: Will Deacon <will.deacon@arm•com>
> > > ---
> > >  drivers/perf/arm_pmu.c      | 16 ++++------------
> > >  drivers/perf/arm_pmu_acpi.c | 42 ++++++++++++++++++++++++++++++++++++++----
> > >  2 files changed, 42 insertions(+), 16 deletions(-)
> > > 
> > > diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c
> > > index 3d6d4c5f2356..e0242103d904 100644
> > > --- a/drivers/perf/arm_pmu.c
> > > +++ b/drivers/perf/arm_pmu.c
> > > @@ -557,18 +557,10 @@ int armpmu_request_irq(struct arm_pmu *armpmu, int cpu)
> > >  	if (!irq)
> > >  		return 0;
> > >  
> > > -	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_devid(irq)) {
> > > -		int other_cpu = cpumask_first(&armpmu->active_irqs);
> > > -		int other_irq = per_cpu(hw_events->irq, other_cpu);
> > > -
> > > -		if (irq != other_irq) {
> > > -			pr_warn("mismatched PPIs detected.\n");
> > > -			err = -EINVAL;
> > > -			goto err_out;
> > > -		}
> > > +	if (irq_is_percpu_devid(irq)) {
> > > +		if (cpumask_empty(&armpmu->active_irqs))
> > 
> > Why not leave this as before, with a '&&' operator?
> 
> Because then we'd fall into the else case (for SPIs), were the
> active_irqs mask empty.
> 
> Previously, that would have been caught by the irq_is_percpu_devid(irq)
> case that got removed.
> 
> I can instead make this:
> 
> 	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_devid(irq)) {
> 		/* nothing to do */
> 	} else  { 
> 		< SPI case >
> 	}
> 
> ... but that seemed more painful to read.

Yeah, that's crazy :)

How about:

  if (!irq_is_percpu_devid(irq)) {
	/* SPI case */
  } else if (cpumask_empty(&armpmu->active_irqs)) {
	/* PPI case */
  }

?

Will

  reply	other threads:[~2017-12-11 18:43 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 [this message]
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
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=20171211184337.GF3275@arm.com \
    --to=will.deacon@arm$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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