mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Lin Ming <ming.m.lin@intel.com>
To: Peter Zijlstra <peterz@infradead.org>, Will Deacon <will.deacon@arm.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	"eranian@gmail.com" <eranian@gmail.com>,
	"Gary.Mohr@Bull.com" <Gary.Mohr@bull.com>,
	Corey Ashford <cjashfor@linux.vnet.ibm.com>,
	"arjan@linux.intel.com" <arjan@linux.intel.com>,
	"Zhang, Yanmin" <yanmin_zhang@linux.intel.com>,
	Paul Mackerras <paulus@samba.org>,
	"David S. Miller" <davem@davemloft.net>,
	Russell King <rmk+kernel@arm.linux.org.uk>,
	Paul Mundt <lethal@linux-sh.org>,
	lkml <linux-kernel@vger.kernel.org>
Subject: Re: [RFC][PATCH 5/9] perf: arm, convert to new API pmu->init_event
Date: Mon, 10 May 2010 18:00:37 +0800	[thread overview]
Message-ID: <1273485637.15998.67.camel@minggr.sh.intel.com> (raw)
In-Reply-To: <1273483672.15998.59.camel@minggr.sh.intel.com>

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@intel.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);
> 


  parent reply	other threads:[~2010-05-10 10:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-10  9:27 Lin Ming
2010-05-10  9:38 ` Russell King
2010-05-10 10:00 ` Lin Ming [this message]
2010-05-10 20:01   ` 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=1273485637.15998.67.camel@minggr.sh.intel.com \
    --to=ming.m.lin@intel.com \
    --cc=Gary.Mohr@bull.com \
    --cc=arjan@linux.intel.com \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=davem@davemloft.net \
    --cc=eranian@gmail.com \
    --cc=fweisbec@gmail.com \
    --cc=lethal@linux-sh.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.org \
    --cc=peterz@infradead.org \
    --cc=rmk+kernel@arm.linux.org.uk \
    --cc=will.deacon@arm.com \
    --cc=yanmin_zhang@linux.intel.com \
    /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

all inboxes | Powered by JetHome®