From: mark.rutland@arm.com (Mark Rutland)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCHv2 9/9] arm: perf: fold hotplug notifier into arm_pmu
Date: Tue, 28 Oct 2014 14:46:34 +0000 [thread overview]
Message-ID: <20141028144634.GJ9796@leverpostej> (raw)
In-Reply-To: <544EAD04.8040703@codeaurora.org>
On Mon, Oct 27, 2014 at 08:37:24PM +0000, Stephen Boyd wrote:
> On 10/27/2014 05:06 AM, Mark Rutland wrote:
> > Handling multiple PMUs using a single hotplug notifier requires a list
> > of PMUs to be maintained, with synchronisation in the probe, remove, and
> > notify paths. This is error-prone and makes the code much harder to
> > maintain.
> >
> > Instead of using a single notifier, we can dynamically allocate a
> > notifier block per-PMU. The end result is the same, but the list of PMUs
> > is implicit in the hotplug notifier list rather than within a perf-local
> > data structure, which makes the code far easier to handle.
> >
> > Signed-off-by: Mark Rutland <mark.rutland@arm.com>
>
> Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
>
> One nit below.
>
> > @@ -169,6 +192,11 @@ static int cpu_pmu_init(struct arm_pmu *cpu_pmu)
> > if (!cpu_hw_events)
> > return -ENOMEM;
> >
> > + cpu_pmu->hotplug_nb.notifier_call = cpu_pmu_notify;
> > + err = register_cpu_notifier(&cpu_pmu->hotplug_nb);
> > + if (err)
> > + goto out_hw_events;
> > +
> > for_each_possible_cpu(cpu) {
> > struct pmu_hw_events *events = per_cpu_ptr(cpu_hw_events, cpu);
> > raw_spin_lock_init(&events->pmu_lock);
> > @@ -188,38 +216,19 @@ static int cpu_pmu_init(struct arm_pmu *cpu_pmu)
> > cpu_pmu->pmu.capabilities |= PERF_PMU_CAP_NO_INTERRUPT;
> >
> > return 0;
> > +
> > +out_hw_events:
> > + free_percpu(cpu_hw_events);
> > + return err;
> > }
> >
> > static void cpu_pmu_destroy(struct arm_pmu *cpu_pmu)
> > {
> > free_percpu(cpu_pmu->hw_events);
> > + unregister_cpu_notifier(&cpu_pmu->hotplug_nb);
> > }
> >
>
> I would expect the order to be the other way, but it probably doesn't
> matter all that much on the registration error path.
I've flipped this around locally, I agree it's nicer the other way
around.
Thanks for the review, it's much appreciated.
Thanks,
Mark.
prev parent reply other threads:[~2014-10-28 14:46 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-27 12:06 [PATCHv2 0/9] Prepatory rework for multi-PMU support Mark Rutland
2014-10-27 12:06 ` [PATCHv2 1/9] arm: perf: factor out callchain code Mark Rutland
2014-10-27 12:06 ` [PATCHv2 2/9] arm: perf: add missing pr_info newlines Mark Rutland
2014-10-27 20:37 ` Stephen Boyd
2014-10-27 12:06 ` [PATCHv2 3/9] arm: perf: make PMU probing data-driven Mark Rutland
2014-10-27 20:37 ` Stephen Boyd
2014-10-27 12:06 ` [PATCHv2 4/9] arm: perf: use IDR types for CPU PMUs Mark Rutland
2014-10-27 12:06 ` [PATCHv2 5/9] arm: perf: limit size of accounting data Mark Rutland
2014-10-27 21:13 ` Stephen Boyd
2014-10-27 12:06 ` [PATCHv2 6/9] arm: perf: kill get_hw_events() Mark Rutland
2014-10-27 20:37 ` Stephen Boyd
2014-10-27 12:06 ` [PATCHv2 7/9] arm: perf: fold percpu_pmu into pmu_hw_events Mark Rutland
2014-10-27 12:06 ` [PATCHv2 8/9] arm: perf: dynamically allocate cpu hardware data Mark Rutland
2014-10-27 20:37 ` Stephen Boyd
2014-10-27 12:06 ` [PATCHv2 9/9] arm: perf: fold hotplug notifier into arm_pmu Mark Rutland
2014-10-27 20:37 ` Stephen Boyd
2014-10-28 14:46 ` Mark Rutland [this message]
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=20141028144634.GJ9796@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