public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Lin Ming <ming.m.lin@intel.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>,
	Matt Fleming <matt@console-pimps.org>,
	"Zhang, Rui" <rui.zhang@intel.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	lkml <linux-kernel@vger.kernel.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>
Subject: Re: [RFC PATCH 2/2] perf stat: Use event group to simulate PMI on PMI-less hardware counter
Date: Wed, 10 Nov 2010 23:06:37 +0800	[thread overview]
Message-ID: <1289401597.2479.48.camel@localhost> (raw)
In-Reply-To: <1289400784.2191.134.camel@laptop>

On Wed, 2010-11-10 at 22:53 +0800, Peter Zijlstra wrote:
> On Wed, 2010-11-10 at 22:45 +0800, Lin Ming wrote:
> > On Wed, 2010-11-10 at 20:21 +0800, Peter Zijlstra wrote:
> > > On Wed, 2010-11-10 at 14:15 +0800, Lin Ming wrote:
> > > > Some hardware counters(for example, Intel RAPL) can't generate interrupt
> > > > when overflow. So we need to simulate the interrupt to periodically
> > > > record the counter values. Otherwise, the counter may overflow and the
> > > > wrong value is read.
> > > > 
> > > > This patch uses event group to simulate PMI as suggested by Peter
> > > > Zijlstra, http://marc.info/?l=linux-kernel&m=128220854801819&w=2
> > > > 
> > > > create_group_counters() will create a group with 2 events, one hrtimer
> > > > based event as the group leader, and the other event to count. The
> > > > hrtimer is fired periodically, so the sibling event can record its
> > > > counter value periodically as well.
> > > 
> > > I'm terribly confused here....
> > > 
> > >  - you introduce perf_event_attr:pmi_simulate, but then you never
> > > implement it -- nor do we need it afaict.
> > 
> > Someone need to simluate pmi will use it in future.
> 
> Maybe, but simply adding an ABI just in case doesn't seem like a good
> idea. The proposed idea was to group with a software hrtimer-based event
> and use the hrtimer's sample to read the hardware group sibling using
> PERF_SAMPLE_READ.

So this is usefull in perf top/record on PMI-less counter?

> 
> That should be possible using today's interface.
> 
> > > 
> > > 
> > >  - you use grouped counters for perf-stat, perf-stat doesn't use
> > > sampling so I don't see a need to group events to simulate the PMI.
> > > 
> > 
> > Aha, sorry, actually, I mean to periodically read the PMI-less counter
> > and reset it to zero each time to avoid overflow.
> > 
> > Well, seems I have done this in the wrong way.
> > Let me re-think about it.
> 
> Right, so you're wanting to avoid overflowing the hardware counter? This

Yes.

> is only a problem for short hardware counters without a pmi, SH and the
> like currently cascade 2 32bit counters to create 64bit hardware
> counters and avoid the overflow case that way.
> 
> Another thing they can do is simply use the system tick to fold the
> 32bit counters into a the 64bit counter.
> 
> Again, this doesn't need any changes to the ABI and generic code.

Thanks for the explanation.





  reply	other threads:[~2010-11-10 15:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-10  6:15 [RFC PATCH 2/2] perf stat: Use event group to simulate PMI on PMI-less hardware counter Lin Ming
2010-11-10 12:21 ` Peter Zijlstra
2010-11-10 14:45   ` Lin Ming
2010-11-10 14:53     ` Peter Zijlstra
2010-11-10 15:06       ` Lin Ming [this message]
2010-11-10 15:08         ` Peter Zijlstra
2010-11-10 15:17           ` Matt Fleming
2010-11-11  2:00       ` Zhang Rui
2010-11-11 12:46         ` Peter Zijlstra
2010-11-12  0:32           ` Zhang Rui

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=1289401597.2479.48.camel@localhost \
    --to=ming.m.lin@intel.com \
    --cc=acme@redhat.com \
    --cc=fweisbec@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matt@console-pimps.org \
    --cc=mingo@elte.hu \
    --cc=peterz@infradead.org \
    --cc=rui.zhang@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