[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1273485637.15998.67.camel@minggr.sh.intel.com>
Date: Mon, 10 May 2010 18:00:37 +0800
From: Lin Ming <ming.m.lin@...el.com>
To: Peter Zijlstra <peterz@...radead.org>,
Will Deacon <will.deacon@....com>
Cc: Ingo Molnar <mingo@...e.hu>,
Frederic Weisbecker <fweisbec@...il.com>,
"eranian@...il.com" <eranian@...il.com>,
"Gary.Mohr@...l.com" <Gary.Mohr@...l.com>,
Corey Ashford <cjashfor@...ux.vnet.ibm.com>,
"arjan@...ux.intel.com" <arjan@...ux.intel.com>,
"Zhang, Yanmin" <yanmin_zhang@...ux.intel.com>,
Paul Mackerras <paulus@...ba.org>,
"David S. Miller" <davem@...emloft.net>,
Russell King <rmk+kernel@....linux.org.uk>,
Paul Mundt <lethal@...ux-sh.org>,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: [RFC][PATCH 5/9] perf: arm, convert to new API pmu->init_event
On Mon, 2010-05-10 at 17:38 +0800, Russell King wrote:
> Unfortunately, this seems to clash with a rework of the ARM PMU/oprofile
> code. You also really need to copy the guys doing this work, eg the
> authors of arch/arm/kernel/perf_event.c - Will Deacon.
(Add Will Deacon)
I'll check the rework of the ARM PMU/oprofile code.
Thanks.
On Mon, 2010-05-10 at 17:27 +0800, Lin Ming wrote:
> perf: arm, convert to new API pmu->init_event
>
> Signed-off-by: Lin Ming <ming.m.lin@...el.com>
> ---
> arch/arm/kernel/perf_event.c | 28 +++++++++++++++-------------
> 1 files changed, 15 insertions(+), 13 deletions(-)
>
> diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c
> index 8400ddf..565f13a 100644
> --- a/arch/arm/kernel/perf_event.c
> +++ b/arch/arm/kernel/perf_event.c
> @@ -270,13 +270,6 @@ out:
> return err;
> }
>
> -static struct pmu pmu = {
> - .enable = armpmu_enable,
> - .disable = armpmu_disable,
> - .unthrottle = armpmu_unthrottle,
> - .read = armpmu_read,
> -};
> -
> static int
> validate_event(struct cpu_hw_events *cpuc,
> struct perf_event *event)
> @@ -446,20 +439,19 @@ __hw_perf_event_init(struct perf_event *event)
> return err;
> }
>
> -struct pmu *
> -hw_perf_event_init(struct perf_event *event)
> +static int armpmu_init_event(struct perf_event *event)
> {
> int err = 0;
>
> if (!armpmu)
> - return ERR_PTR(-ENODEV);
> + return -ENODEV;
>
> event->destroy = hw_perf_event_destroy;
>
> if (!atomic_inc_not_zero(&active_events)) {
> if (atomic_read(&active_events) > perf_max_events) {
> atomic_dec(&active_events);
> - return ERR_PTR(-ENOSPC);
> + return -ENOSPC;
> }
>
> mutex_lock(&pmu_reserve_mutex);
> @@ -473,15 +465,23 @@ hw_perf_event_init(struct perf_event *event)
> }
>
> if (err)
> - return ERR_PTR(err);
> + return err;
>
> err = __hw_perf_event_init(event);
> if (err)
> hw_perf_event_destroy(event);
>
> - return err ? ERR_PTR(err) : &pmu;
> + return err;
> }
>
> +static struct pmu pmu = {
> + .enable = armpmu_enable,
> + .disable = armpmu_disable,
> + .unthrottle = armpmu_unthrottle,
> + .read = armpmu_read,
> + .init_event = armpmu_init_event,
> +};
> +
> void
> hw_perf_enable(void)
> {
> @@ -2138,6 +2138,8 @@ init_hw_perf_events(void)
> pr_info("enabled with %s PMU driver, %d counters available\n",
> armpmu->name, armpmu->num_events);
>
> + perf_event_register_pmu(&pmu);
> +
> return 0;
> }
> arch_initcall(init_hw_perf_events);
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists