linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ingo Molnar <mingo@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Jiri Olsa <jolsa@redhat.com>,
	linux-kernel@vger.kernel.org,
	Corey Ashford <cjashfor@linux.vnet.ibm.com>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@elte.hu>, Namhyung Kim <namhyung@kernel.org>,
	Paul Mackerras <paulus@samba.org>,
	Arnaldo Carvalho de Melo <acme@redhat.com>,
	Andi Kleen <ak@linux.intel.com>, David Ahern <dsahern@gmail.com>,
	Stephane Eranian <eranian@google.com>
Subject: Re: [PATCH 0/9] perf: Adding better precise_ip field handling
Date: Sat, 11 May 2013 09:50:08 +0200	[thread overview]
Message-ID: <20130511075008.GC24435@gmail.com> (raw)
In-Reply-To: <20130510112756.GH31235@dyad.programming.kicks-ass.net>


* Peter Zijlstra <peterz@infradead.org> wrote:

> On Fri, May 10, 2013 at 12:55:36PM +0200, Ingo Molnar wrote:
> > Look at the tools/perf/ patches, they don't actually need or use that 
> > information to adjust for skid!
> > 
> > If user-space wants _that_ level of control because it wants to correct 
> > for skid (if there's skid), or if it wants to display to the user how 
> > precise the profiling is, then they can do the (much) more complex probing 
> > dance.
> > 
> > What is absolutely indefensible is to not give a good shortcut for the 
> > most common case of 'give me the most precise cycles event you got'...
> 
> That's not what I'm saying... the user (not userspace, but you and me) 
> when staring at perf output need to interpret the result.
> 
> If you don't know WTF the thing actually measured, how are you going to 
> do that?

That's really a red herring: there's absolutely no reason why the 
kernel could not pass back the level of precision it provided.

You are also over-rating the importance of such details - most developers 
will assume when looking at profiler output that it's a statistical result 
- and being happy when it happens to be "absolutely accurate" instead of 
just "very accurate"...

> > > I see such a feature only causing confusion; I told it to be 
> > > precise, therefore this register op after the memory load really is 
> > > the more expensive thing.
> > 
> > You are creating confusion where there's none: "give me the best 
> > profiling you've got" is a pretty reasonable thing to ask.
> 
> Only if it then tells you what you got. It doesn't do that.

I'm not against the kernel telling what precision it gave us, at all. That 
could be solved by the kernel setting the precision field in the 
PERF_COUNT_CYCLES_PRECISE case or so.

I'm against you apparently recommending a complex probing method to get 
something the kernel ought to get us straight away via much simpler 
ways...

Complexity does not primarily result in people doing things 'smarter'. It 
primarily results in people _not using the feature at all_.

> > The thing is, there's variations in the quality of profiling between 
> > CPUs, sometimes even between CPU models. 99.999% of the people don't 
> > care about that, because 99.9% of the time the profile is unambiguous: 
> > functions are typically big enough, with the overhead somewhere in the 
> > middle, so skid just doesn't matter.
> 
> Sure at function level it doesn't matter, but once you found your most 
> expensive function very often the next question is _why_ is it 
> expensive.
> 
> At that point you're going to stare at asm output. The moment you do 
> that you need to know the type of output you're staring at.

FYI, very few developers are actually looking at the assembly output 
because very few developers _know_ assembly to begin with.

They are looking at things like sysprof or perf report output, maybe at 
the annotated _source_ code and that's it.

The mapping to source code is fuzzy to begin with, with inlining, loop 
unrolling and other compiler optimizations being a far bigger effect than 
skid.

So the fuzz created by skid is relatively small - but it's nice when it's 
gone and obviously it's helpful when you are looking at assembly output.

> Also, if you think function level output is the most relevant one, you 
> shouldn't use PEBS at all. PEBS has an issue with REP prefixes, it 
> severely under accounts the cycles spend on them. And since exact 
> placement doesn't matter (as you just argued) the little skid you have 
> is irrelevant.
> 
> So either skid matters and you need to know what type of output you've 
> got, or it doesn't and the whole precise thing is irrelevant at best.

That's just another plain silly argument: having more precise results is 
obviously useful even if you don't use a magnifying lense. Sometimes 
functions are small and skid results in the wrong function being credited 
with overhead.

It's also immaterial: there's no reason why the kernel couldn't feed back 
the level of precision it offers, to user-space, via a small, simple 
variation to the existing syscall interface.

Thanks,

	Ingo

  reply	other threads:[~2013-05-11  7:50 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-09 13:32 [PATCH 0/9] perf: Adding better precise_ip field handling Jiri Olsa
2013-05-09 13:32 ` [PATCH 1/9] perf x86: Add precise sysfs cpu pmu attribute Jiri Olsa
2013-05-09 13:32 ` [PATCH 2/9] perf tools: Add precise object to interface sysfs precise Jiri Olsa
2013-05-10  1:34   ` Namhyung Kim
2013-05-10  9:06     ` Jiri Olsa
2013-05-09 13:32 ` [PATCH 3/9] perf tests: Add precise event automated test Jiri Olsa
2013-05-09 13:32 ` [PATCH 4/9] perf tools: Add a precise event qualifier Jiri Olsa
2013-05-10  1:43   ` Namhyung Kim
2013-05-10  9:10     ` Jiri Olsa
2013-05-09 13:32 ` [PATCH 5/9] perf tools: Set maximum precise value for event 'p' modifier Jiri Olsa
2013-05-09 19:43   ` David Ahern
2013-05-10  9:12     ` Jiri Olsa
2013-05-10  1:53   ` Namhyung Kim
2013-05-10  9:16     ` Jiri Olsa
2013-05-09 13:32 ` [PATCH 6/9] perf tools: Set maximum precise value for 'precise' term Jiri Olsa
2013-05-09 13:32 ` [PATCH 7/9] perf tests: Add automated precise term test Jiri Olsa
2013-05-09 13:32 ` [PATCH 8/9] perf: Document the ABI for 'precise' sysfs attribute Jiri Olsa
2013-05-10  1:57   ` Namhyung Kim
2013-05-09 13:32 ` [PATCH 9/9] perf: Document the ABI for 'rdpmc' " Jiri Olsa
2013-05-09 15:07 ` [PATCH 0/9] perf: Adding better precise_ip field handling Peter Zijlstra
2013-05-09 15:20   ` Jiri Olsa
2013-05-10  9:27     ` Peter Zijlstra
2013-05-10  9:40       ` Jiri Olsa
2013-05-10  9:53         ` Peter Zijlstra
2013-05-10 10:18           ` Ingo Molnar
2013-05-10 10:22             ` Peter Zijlstra
2013-05-10 10:31               ` Ingo Molnar
2013-05-10 10:34                 ` Peter Zijlstra
2013-05-10 10:55                   ` Ingo Molnar
2013-05-10 11:27                     ` Peter Zijlstra
2013-05-11  7:50                       ` Ingo Molnar [this message]
2013-05-13  9:36                         ` Peter Zijlstra
2013-05-13 19:43                           ` Ingo Molnar
2013-05-14  7:22                             ` Peter Zijlstra
2013-05-14  8:37                               ` Ingo Molnar
2013-05-14  8:36                             ` Gleb Natapov
2013-05-15 13:27                             ` Stephane Eranian
2013-05-28  9:54                               ` Ingo Molnar
2013-05-10  9:29     ` Peter Zijlstra
2013-05-10  9:43       ` Jiri Olsa
  -- strict thread matches above, loose matches on Subject: below --
2013-01-26 17:27 Jiri Olsa
2013-01-26 18:53 ` Jiri Olsa
2013-01-27 12:41 ` Ingo Molnar
2013-01-27 12:57   ` Jiri Olsa
2013-01-27 13:02     ` Ingo Molnar

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=20130511075008.GC24435@gmail.com \
    --to=mingo@kernel.org \
    --cc=acme@redhat.com \
    --cc=ak@linux.intel.com \
    --cc=cjashfor@linux.vnet.ibm.com \
    --cc=dsahern@gmail.com \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=namhyung@kernel.org \
    --cc=paulus@samba.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;
as well as URLs for NNTP newsgroup(s).