linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 14/16] drivers/perf: arm_pmu: add ACPI framework
Date: Fri, 7 Apr 2017 15:49:31 +0100	[thread overview]
Message-ID: <20170407144931.GA858@leverpostej> (raw)
In-Reply-To: <20170407142706.GN19342@arm.com>

On Fri, Apr 07, 2017 at 03:27:06PM +0100, Will Deacon wrote:
> Hi Mark,
> 
> Just a couple of minor comments below.
> 
> On Thu, Apr 06, 2017 at 07:29:21PM +0100, Mark Rutland wrote:

> > +static int arm_pmu_acpi_parse_irq(int cpu)

> > +static void arm_pmu_acpi_unparse_irq(int cpu)

> "unparse" is a bit weird. Can you rename this register/unregister please?

Sure thing; that's much better.

[...]

> > +static int arm_pmu_acpi_parse_irqs(void)
> > +{
> > +	int cpu, irq;
> > +
> > +	for_each_possible_cpu(cpu) {
> > +		int irq = arm_pmu_acpi_parse_irq(cpu);
> > +		if (irq < 0) {
> > +			pr_warn("Unable to parse ACPI PMU IRQ for CPU%d: %d\n",
> > +				cpu, irq);
> > +			goto out_err;
> > +		} else if (irq == 0) {
> > +			pr_warn("No ACPI PMU IRQ for CPU%d\n", cpu);
> > +		}
> > +
> > +		per_cpu(pmu_irqs, cpu) = irq;
> > +	}
> > +
> > +	return 0;
> > +
> > +out_err:
> > +	for_each_possible_cpu(cpu) {
> > +		arm_pmu_acpi_unparse_irq(cpu);
> > +		per_cpu(pmu_irqs, cpu) = 0;
> > +	}
> 
> It might work at the moment (I really can't tell), but I'd rather we didn't
> unregister GSIs that we didn't register.

Urgh, yes.

That gets really more fun if you consider PPIs (which could be
mismatched).

If we're happy with a hideous loop we can do:

	int irq, cpu, irq_cpu;

	for_each_possible_cpu(cpu) {
		irq = per_cpu(pmu_irqs, cpu);
		if (!irq)
			continue;

		arm_pmu_acpi_unparse_irq(cpu);

		/* blat all instances of the irq we just freed */
		for_each_possible_cpu(irq_cpu) {
			if (per_cpu(pmu_irqs, irq_cpu) != irq)
				continue;
			per_cpu(pmu_irqs, irq_cpu) = 0;
		}
	}

... which I'll spin for v3.

Thanks,
Mark.

  reply	other threads:[~2017-04-07 14:49 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-04-06 18:29 [PATCHv2 00/16] arm_pmu: ACPI support Mark Rutland
2017-04-06 18:29 ` [PATCHv2 01/16] drivers/perf: arm_pmu: remove pointless PMU disabling Mark Rutland
2017-04-06 18:29 ` [PATCHv2 02/16] drivers/perf: arm_pmu: define armpmu_init_fn Mark Rutland
2017-04-06 18:29 ` [PATCHv2 03/16] drivers/perf: arm_pmu: fold init into alloc Mark Rutland
2017-04-06 18:29 ` [PATCHv2 04/16] drivers/perf: arm_pmu: factor out pmu registration Mark Rutland
2017-04-06 18:29 ` [PATCHv2 05/16] drivers/perf: arm_pmu: simplify cpu_pmu_request_irqs() Mark Rutland
2017-04-06 18:29 ` [PATCHv2 06/16] drivers/perf: arm_pmu: handle no platform_device Mark Rutland
2017-04-06 18:29 ` [PATCHv2 07/16] drivers/perf: arm_pmu: rename irq request/free functions Mark Rutland
2017-04-06 18:29 ` [PATCHv2 08/16] drivers/perf: arm_pmu: split cpu-local irq request/free Mark Rutland
2017-04-06 18:29 ` [PATCHv2 09/16] drivers/perf: arm_pmu: move irq request/free into probe Mark Rutland
2017-04-06 18:29 ` [PATCHv2 10/16] drivers/perf: arm_pmu: split out platform device probe logic Mark Rutland
2017-04-06 18:29 ` [PATCHv2 11/16] arm64: add function to get a cpu's MADT GICC table Mark Rutland
2017-04-06 18:29 ` [PATCHv2 12/16] arm64: parking: kill acpi_set_mailbox_entry() Mark Rutland
2017-04-06 18:29 ` [PATCHv2 13/16] arm64: parking: fix type endianness Mark Rutland
2017-04-06 18:29 ` [PATCHv2 14/16] drivers/perf: arm_pmu: add ACPI framework Mark Rutland
2017-04-07 14:27   ` Will Deacon
2017-04-07 14:49     ` Mark Rutland [this message]
2017-04-06 18:29 ` [PATCHv2 15/16] arm64: pmuv3: handle !PMUv3 when probing Mark Rutland
2017-04-07 14:29   ` Will Deacon
2017-04-07 16:30     ` Mark Rutland
2017-04-07 18:05     ` Mark Rutland
2017-04-07 19:09       ` Jeremy Linton
2017-04-06 18:29 ` [PATCHv2 16/16] arm64: pmuv3: use arm_pmu ACPI framework Mark Rutland
2017-04-07 14:30 ` [PATCHv2 00/16] arm_pmu: ACPI support Will Deacon
2017-04-07 16:13   ` Mark Rutland

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=20170407144931.GA858@leverpostej \
    --to=mark.rutland@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).