mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Vince Weaver <vweaver1@eecs.utk.edu>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Mike Hommey <mh@glandium.org>, <linux-kernel@vger.kernel.org>
Subject: Re: Problem with perf hardware counters grouping
Date: Thu, 1 Sep 2011 13:16:10 -0400	[thread overview]
Message-ID: <alpine.DEB.2.00.1109011308430.9976@cl320.eecs.utk.edu> (raw)
In-Reply-To: <1314895312.1485.2.camel@twins>

On Thu, 1 Sep 2011, Peter Zijlstra wrote:
> > Is there any good workaround, or do we have to fall back to trying to 
> > start/read/stop every proposed event set to make sure it's valid?
> 
> I guess my first question is going to be, how do you know what the
> maximum number of counters is in the first place?

The use case where this comes up the easiest is where you are adding
events to an eventset one at a time until failure.  Then you assume
failure - 1 is the number available.  So this would boil down
to doing that many sys_perf_open()/close() calls.  This obviously fails
in the current watchdog timer case.

The other way to know is the query libpfm4 which "knows" the number of 
counters available on each CPU.  PAPI uses this as a hueristic not as a 
hard limit, but it can also lead to the problem occurring if the test 
tries the limit, the sys_perf_open() succcedes... and then fails upon 
read.

Does the perf tool work around this in some way?  

> > This is going to seriously impact performance, and perf_event performance 
> > is pretty bad to begin with.  The whole reason I was writing the tests to 
> > trigger this is because PAPI users are complaining that perf_event 
> > overhead is roughly twice that of perfctr or perfmon2, which I've verified 
> > experimentally.
> 
> Yeah, you keep saying this, where does it come from? Only the lack of
> userspace rdpmc?

that's part of it.  I've been working on isolating this, but for a fair 
comparison it involves writing low-level code that accesses perf_event, 
perfctr, and perfmon2 directly at the syscall level and as you can imagine 
that's not easy or fun.  It's also tricky as you can imagine to try to 
profile the perf_event code using perf_events.

Vince
vweaver1@eecs.utk.edu


  reply	other threads:[~2011-09-01 17:16 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-31  8:57 Mike Hommey
2011-09-01 11:53 ` Peter Zijlstra
2011-09-01 11:59   ` Mike Hommey
2011-09-01 12:40     ` Peter Zijlstra
2011-09-01 15:21   ` Vince Weaver
2011-09-01 16:41     ` Peter Zijlstra
2011-09-01 17:16       ` Vince Weaver [this message]
2011-09-01 17:24         ` Vince Weaver
2011-09-06 19:43   ` Vince Weaver
2011-09-06 20:22     ` Don Zickus

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=alpine.DEB.2.00.1109011308430.9976@cl320.eecs.utk.edu \
    --to=vweaver1@eecs.utk.edu \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mh@glandium.org \
    --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

all inboxes | Powered by JetHome®