public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Cyrill Gorcunov <gorcunov@gmail.com>
Cc: Ingo Molnar <mingo@elte.hu>,
	Stephane Eranian <eranian@google.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Don Zickus <dzickus@redhat.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC perf,x86] P4 PMU early draft
Date: Wed, 10 Feb 2010 11:12:12 +0100	[thread overview]
Message-ID: <1265796732.11509.260.camel@laptop> (raw)
In-Reply-To: <20100209223909.GE5068@lenovo>

On Wed, 2010-02-10 at 01:39 +0300, Cyrill Gorcunov wrote:


> Index: linux-2.6.git/arch/x86/kernel/cpu/perf_event.c
> =====================================================================
> --- linux-2.6.git.orig/arch/x86/kernel/cpu/perf_event.c
> +++ linux-2.6.git/arch/x86/kernel/cpu/perf_event.c
> @@ -26,6 +26,7 @@
>  #include <linux/bitops.h>
>  
>  #include <asm/apic.h>
> +#include <asm/perf_p4.h>
>  #include <asm/stacktrace.h>
>  #include <asm/nmi.h>
>  
> @@ -140,6 +141,7 @@ struct x86_pmu {
>  	u64		max_period;
>  	u64		intel_ctrl;
>  	int		(*hw_config)(struct perf_event_attr *attr, struct hw_perf_event *hwc);
> +	int		(*schedule_events)(struct cpu_hw_events *cpuc, int n, int *assign, int cpu);
>  	void		(*enable_bts)(u64 config);
>  	void		(*disable_bts)(void);
>  

> +/*
> + * This is the most important routine of Netburst PMU actually
> + * and need a huge speedup!
> + */
> +static int p4_pmu_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign, int cpu)
> +{

> +}


> -static int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign)
> +/* we don't use cpu argument here at all */
> +static int x86_schedule_events(struct cpu_hw_events *cpuc, int n, int *assign, int cpu)
>  {
>  	struct event_constraint *c, *constraints[X86_PMC_IDX_MAX];
>  	unsigned long used_mask[BITS_TO_LONGS(X86_PMC_IDX_MAX)];


> @@ -1796,7 +2305,7 @@ static int x86_pmu_enable(struct perf_ev
>  	if (n < 0)
>  		return n;
>  
> -	ret = x86_schedule_events(cpuc, n, assign);
> +	ret = x86_pmu.schedule_events(cpuc, n, assign, 0);
>  	if (ret)
>  		return ret;
>  	/*

This look like a bug, surely we can run on !cpu0.

> @@ -2313,7 +2822,7 @@ int hw_perf_group_sched_in(struct perf_e
>  	if (n0 < 0)
>  		return n0;
>  
> -	ret = x86_schedule_events(cpuc, n0, assign);
> +	ret = x86_pmu.schedule_events(cpuc, n0, assign, cpu);
>  	if (ret)
>  		return ret;
>  

I'd try BUG_ON(cpu != smp_processor_id()) and scrap passing that cpu
thing around.

> @@ -2700,6 +3232,7 @@ static int validate_group(struct perf_ev
>  {
>  	struct perf_event *leader = event->group_leader;
>  	struct cpu_hw_events *fake_cpuc;
> +	int cpu = smp_processor_id();
>  	int ret, n;
>  
>  	ret = -ENOMEM;
> @@ -2725,7 +3258,7 @@ static int validate_group(struct perf_ev
>  
>  	fake_cpuc->n_events = n;
>  
> -	ret = x86_schedule_events(fake_cpuc, n, NULL);
> +	ret = x86_pmu.schedule_events(fake_cpuc, n, NULL, cpu);
>  
>  out_free:
>  	kfree(fake_cpuc);



  reply	other threads:[~2010-02-10 10:12 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-08 18:45 [RFC perf,x86] P4 PMU early draft Cyrill Gorcunov
2010-02-08 21:56 ` Cyrill Gorcunov
2010-02-09  4:17 ` Ingo Molnar
2010-02-09  6:54   ` Cyrill Gorcunov
2010-02-09 22:39   ` Cyrill Gorcunov
2010-02-10 10:12     ` Peter Zijlstra [this message]
2010-02-10 10:38       ` Cyrill Gorcunov
2010-02-10 10:52         ` Peter Zijlstra
2010-02-10 11:23           ` Cyrill Gorcunov
2010-02-11 12:21           ` Peter Zijlstra
2010-02-11 15:22             ` Cyrill Gorcunov
2010-02-26 10:25             ` [tip:perf/core] perf_events: Simplify code by removing cpu argument to hw_perf_group_sched_in() tip-bot for Peter Zijlstra
2010-02-09  4:23 ` [RFC perf,x86] P4 PMU early draft Paul Mackerras
2010-02-09  6:57   ` Cyrill Gorcunov
2010-02-09  8:54   ` Peter Zijlstra
2010-02-09 21:13 ` Stephane Eranian
2010-02-09 21:35   ` Cyrill Gorcunov
2010-02-15 20:11 ` Robert Richter
2010-02-15 20:32   ` Cyrill Gorcunov
2010-02-17 22:14   ` Cyrill Gorcunov

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=1265796732.11509.260.camel@laptop \
    --to=peterz@infradead.org \
    --cc=dzickus@redhat.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=gorcunov@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    /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