public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: eranian@gmail.com, linux-kernel@vger.kernel.org, mingo@elte.hu,
	perfmon2-devel@lists.sf.net,
	"David S. Miller" <davem@davemloft.net>,
	eranian@google.com
Subject: Re: [PATCH] perf_events: improve Intel event scheduling
Date: Tue, 22 Dec 2009 12:02:38 +1100	[thread overview]
Message-ID: <20091222010238.GB31264@drongo> (raw)
In-Reply-To: <1261410040.4314.178.camel@laptop>

On Mon, Dec 21, 2009 at 04:40:40PM +0100, Peter Zijlstra wrote:

> I'm not really seeing the problem here...
> 
> 
>  perf_disable() <-- shut down the full pmu
> 
>  pmu->disable() <-- hey someone got removed (easy free the reg)
>  pmu->enable()  <-- hey someone got added (harder, check constraints)
> 
>  hw_perf_group_sched_in() <-- hey a full group got added 
>                               (better than multiple ->enable)
> 
>  perf_enable() <-- re-enable pmu
> 
> 
> So ->disable() is used to track freeing, ->enable is used to add
> individual counters, check constraints etc..
> 
> hw_perf_group_sched_in() is used to optimize the full group enable.
> 
> Afaict that is what power does (Paul?) and that should I think be
> sufficient to track x86 as well.

That sounds right to me.

> Since sched_in() is balanced with sched_out(), the ->disable() calls
> should provide the required information as to the occupation of the pmu.
> I don't see the need for more hooks.
> 
> Paul, could you comment, since you did all this for power?

On powerpc we maintain a list of currently enabled events in the arch
code.  Does x86 do that as well?

If you have the list (or array) of events easily accessible, it's
relatively easy to check whether the whole set is feasible at any
point, without worrying about which events were recently added.  The
perf_event structure has a spot where the arch code can store which
PMU register is used for that event, so you can easily optimize the
case where the event doesn't move.

Like you, I'm not seeing where the difficulty lies.  Perhaps Stephane
could give us a detailed example if he still thinks there's a
difficulty.

Paul.

  parent reply	other threads:[~2009-12-22  1:10 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-19 15:03 [PATCH] perf_events: improve Intel event scheduling Stephane Eranian
2009-11-18 16:32 ` Peter Zijlstra
2009-12-11 11:00   ` stephane eranian
2009-12-11 11:59     ` stephane eranian
2009-12-21 15:40       ` Peter Zijlstra
2009-12-21 19:00         ` Stephane Eranian
2009-12-21 19:31           ` Peter Zijlstra
2009-12-21 20:59             ` Stephane Eranian
2009-12-21 21:18               ` Peter Zijlstra
2009-12-22  1:09               ` Paul Mackerras
2009-12-22  1:02         ` Paul Mackerras [this message]
2009-12-29 14:47           ` Stephane Eranian
2010-01-07  4:13             ` Paul Mackerras
2010-01-07  8:54               ` Peter Zijlstra
2010-01-07  9:00               ` Peter Zijlstra
2010-01-07  9:54                 ` Stephane Eranian
2010-01-07 10:01                   ` Peter Zijlstra
2009-12-22  0:57       ` Paul Mackerras
2009-12-11 14:38     ` Stephane Eranian

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=20091222010238.GB31264@drongo \
    --to=paulus@samba.org \
    --cc=davem@davemloft.net \
    --cc=eranian@gmail.com \
    --cc=eranian@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=perfmon2-devel@lists.sf.net \
    --cc=peterz@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