public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Cyrill Gorcunov <gorcunov@gmail.com>
To: Robert Richter <robert.richter@amd.com>
Cc: Ingo Molnar <mingo@elte.hu>, Lin Ming <ming.m.lin@intel.com>,
	"H. Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Stephane Eranian <eranian@google.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC] x86,perf: Implement minimal P4 PMU driver v14
Date: Wed, 10 Mar 2010 22:43:44 +0300	[thread overview]
Message-ID: <20100310194344.GD8070@lenovo> (raw)
In-Reply-To: <20100310192928.GD7219@erda.amd.com>

On Wed, Mar 10, 2010 at 08:29:28PM +0100, Robert Richter wrote:
> On 10.03.10 21:31:02, Cyrill Gorcunov wrote:
> >  arch/x86/include/asm/perf_event.h      |    2 
> >  arch/x86/include/asm/perf_p4.h         |  707 +++++++++++++++++++++++++++++++++
> 
> If so, it should be perf_event_p4.h.
> 

Accepted, thanks!

> >  arch/x86/kernel/cpu/perf_event.c       |   46 +-
> >  arch/x86/kernel/cpu/perf_event_amd.c   |    2 
> >  arch/x86/kernel/cpu/perf_event_intel.c |   15 
> >  arch/x86/kernel/cpu/perf_event_p4.c    |  612 ++++++++++++++++++++++++++++
> >  arch/x86/kernel/cpu/perf_event_p6.c    |    2 
> >  7 files changed, 1363 insertions(+), 23 deletions(-)
> 
> > 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
> > @@ -190,6 +190,8 @@ struct x86_pmu {
> >  	void		(*enable_all)(void);
> >  	void		(*enable)(struct perf_event *);
> >  	void		(*disable)(struct perf_event *);
> > +	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);
> 
> I don't like this extension since it widened the interface without
> additional use.
> 
> (*hw_config) could be instead implemented in (*event_map).

Well, I fear I don't see how exactly. event_map has the event number
without any-kind of attributes, or you mean to extend event_map up that
way to pass attribs there as well?

> (*schedule_events) could be implemented by a special p4 handler for
> (*enable) in struct pmu. Maybe there are other solutions for both
> cases, but it should be possible by adoption of existing functions.
> 

Assignment scheme is completely different from those which are in
use for architectural events.

> The current implementation of model specific functions is
> sufficient. We have already the following:
> 
> * event initialization: x86_pmu.raw_event(), x86_pmu.event_map()
> * event enable:   event->pmu->enable(), x86_pmu.enable()
> * event disable:  event->pmu->disable(), x86_pmu.disable()
> 
> Maybe I miss something in the list above. The introduction of more
> function pointers should be reduced to a minimum.
> 
> If the pmu differs heavily you even could return a different pmu for
> such an event.
> 

This would require much more code and will lead to a code duplication
as well.

> -Robert
> 

All in one, Robert, I would like to make this code less intrusive into
the former perf sources. But at moment I don't see an easy way for this.

Which means -- I would like to collect comments/complains and so on
to improve it.

> >  	unsigned	eventsel;
> >  	unsigned	perfctr;
> >  	u64		(*event_map)(int);
> > @@ -415,6 +417,25 @@ set_ext_hw_attr(struct hw_perf_event *hw
> >  	return 0;
> >  }
> 
> -- 
> Advanced Micro Devices, Inc.
> Operating System Research Center
> email: robert.richter@amd.com
> 
	-- Cyrill

  reply	other threads:[~2010-03-10 19:43 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-10 18:31 [RFC] x86,perf: Implement minimal P4 PMU driver v14 Cyrill Gorcunov
2010-03-10 19:29 ` Robert Richter
2010-03-10 19:43   ` Cyrill Gorcunov [this message]
2010-03-11  2:32 ` Lin Ming
2010-03-11  4:12   ` Cyrill Gorcunov
2010-03-11 16:54   ` Cyrill Gorcunov
2010-03-11 18:16     ` Ingo Molnar
2010-03-11 18:29       ` Cyrill Gorcunov
2010-03-11 18:39       ` Ingo Molnar
2010-03-11 21:15         ` Cyrill Gorcunov
2010-03-11 21:24           ` Peter Zijlstra
2010-03-11 21:31             ` Cyrill Gorcunov
2010-03-11 21:38               ` Peter Zijlstra
2010-03-11 21:41                 ` Cyrill Gorcunov
2010-03-11 21:50                 ` Cyrill Gorcunov
2010-03-12  9:54                   ` [tip:perf/x86] x86, perf: Fix NULL deref on not assigned x86_pmu tip-bot for Cyrill Gorcunov
2010-03-11 18:33     ` [tip:perf/x86] perf, x86: Implement initial P4 PMU driver tip-bot for Cyrill Gorcunov
2010-03-16 16:07       ` Robert Richter
2010-03-16 16:23         ` Cyrill Gorcunov
2010-03-17  1:05           ` Lin Ming
2010-03-17  9:48         ` [tip:perf/core] perf, x86: Report error code that returned from x86_pmu.hw_config() tip-bot for Robert Richter

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=20100310194344.GD8070@lenovo \
    --to=gorcunov@gmail.com \
    --cc=acme@redhat.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ming.m.lin@intel.com \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=robert.richter@amd.com \
    --cc=tglx@linutronix.de \
    /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