From: Stephane Eranian <eranian@google.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Ingo Molnar <mingo@elte.hu>, Paul Mackerras <paulus@samba.org>,
"Metzger, Markus T" <markus.t.metzger@intel.com>,
lkml <linux-kernel@vger.kernel.org>,
Robert Richter <robert.richter@amd.com>,
"David S. Miller" <davem@davemloft.net>,
Jamie Iles <jamie.iles@picochip.com>,
Paul Mundt <lethal@linux-sh.org>,
Arjan van de Ven <arjan@infradead.org>,
"H. Peter Anvin" <hpa@zytor.com>,
perfmon2-devel@lists.sf.net
Subject: Re: [RFC][PATCH] perf_events, x86: PEBS support
Date: Wed, 3 Feb 2010 14:22:11 +0100 [thread overview]
Message-ID: <bd4cb8901002030522s6306fdf4qbf4eb48c0674d980@mail.gmail.com> (raw)
In-Reply-To: <1265135588.24455.350.camel@laptop>
In general, there are some problems with the PEBS buffer when
used in system-wide mode. If the depth is > 1, then you have a
problem attributing samples to pid,tid.
Looks like this patch hardcodes the depth and threshold of the buffer.
I believe you need to add some flexibility in there.
You are currently only extracting IP. You need a way to extract the rest
of the recorded state. There are some useful measurements you can do
with it. I believe something like PERF_SAMPLE_REGS would work.
Part of the pt_regs are already exported by signals (sigcontext).
It should be noted that providing PERF_SAMPLE_REGS in non-PEBS
situations is also a requirement. But it needs to be clear this is the
interrupted state and not the at-overflow state.
I do not believe substituting PEBS whenever you detect it is available AND
event supports it is a good idea. PEBS is not more precise than regular
sampling, in fact, it is statistically of poorer quality. This is due to the way
it works and it cannot be mitigated by randomization (at least with depth > 1).
The only improvement that PEBS provides is that you get an IP and the
machine state at retirement of an instruction that caused the event to
increment. Thus, the IP points to the next dynamic instruction. The instruction
is not the one that cause the P-th occurence of the event, if you set the
period to P. It is at P+N, where N cannot be predicted and varies depending
on the event and executed code. This introduces some bias in the samples.
Given the behavior of PEBS, it would not be possible to correlate samples
obtained from two events with only one of them supporting PEBS. For instance,
if you sample on INST_RETIRED and UNHALTED_CORE_CYCLES. You
would get a PEBS profile for INST_RETIRED and a regular profile for CYCLES.
Given the skid differences, you would not be able to make fair comparisons.
The user needs to understand what is being measured.
On Tue, Feb 2, 2010 at 7:33 PM, Peter Zijlstra <peterz@infradead.org> wrote:
> On Tue, 2010-02-02 at 19:26 +0100, Ingo Molnar wrote:
>> * Peter Zijlstra <peterz@infradead.org> wrote:
>
>> > @@ -203,8 +203,9 @@ struct perf_event_attr {
>> > enable_on_exec : 1, /* next exec enables */
>> > task : 1, /* trace fork/exit */
>> > watermark : 1, /* wakeup_watermark */
>> > + precise : 1,
>>
>> I think we want to default to precise events even if not specifically
>> requested by user-space, in the cases where that's possible on the CPU
>> without additional limitations.
>>
>> That way people will default to better (and possibly cheaper) PEBS profiling
>> on modern Intel CPUs.
>
> Sure, I'll look at that once it starts working :-)
>
>
--
Stephane Eranian | EMEA Software Engineering
Google France | 38 avenue de l'Opéra | 75002 Paris
Tel : +33 (0) 1 42 68 53 00
This email may be confidential or privileged. If you received this
communication by mistake, please
don't forward it to anyone else, please erase all copies and
attachments, and please let me know that
it went to the wrong person. Thanks
next prev parent reply other threads:[~2010-02-03 13:22 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-02 16:56 Peter Zijlstra
2010-02-02 18:26 ` Ingo Molnar
2010-02-02 18:33 ` Peter Zijlstra
2010-02-03 13:22 ` Stephane Eranian [this message]
2010-02-03 13:56 ` Peter Zijlstra
2010-02-03 14:07 ` Stephane Eranian
2010-02-03 14:19 ` Peter Zijlstra
2010-02-03 14:30 ` Stephane Eranian
2010-02-03 14:40 ` Peter Zijlstra
2010-02-03 14:54 ` Stephane Eranian
2010-02-03 15:12 ` Peter Zijlstra
2010-02-03 23:50 ` Peter Zijlstra
2010-02-03 23:51 ` Stephane Eranian
2010-02-04 0:03 ` Peter Zijlstra
2010-02-04 0:22 ` 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=bd4cb8901002030522s6306fdf4qbf4eb48c0674d980@mail.gmail.com \
--to=eranian@google.com \
--cc=arjan@infradead.org \
--cc=davem@davemloft.net \
--cc=hpa@zytor.com \
--cc=jamie.iles@picochip.com \
--cc=lethal@linux-sh.org \
--cc=linux-kernel@vger.kernel.org \
--cc=markus.t.metzger@intel.com \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=perfmon2-devel@lists.sf.net \
--cc=peterz@infradead.org \
--cc=robert.richter@amd.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
all inboxes | Powered by JetHome®