All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <acme@kernel.org>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Namhyung Kim <namhyung@kernel.org>,
	Ingo Molnar <mingo@kernel.org>,
	Stephane Eranian <eranian@google.com>,
	LKML <linux-kernel@vger.kernel.org>, Jiri Olsa <jolsa@kernel.org>,
	Adrian Hunter <adrian.hunter@intel.com>,
	"ak@linux.intel.com" <ak@linux.intel.com>
Subject: Re: [RFC] perf record: missing buildid for callstack modules
Date: Tue, 19 Jan 2016 12:48:37 -0300	[thread overview]
Message-ID: <20160119154837.GA27085@kernel.org> (raw)
In-Reply-To: <20160119152742.GI6356@twins.programming.kicks-ass.net>

Em Tue, Jan 19, 2016 at 04:27:42PM +0100, Peter Zijlstra escreveu:
> On Tue, Jan 19, 2016 at 11:56:40PM +0900, Namhyung Kim wrote:
> 
> > > But but ... why is #2 a problem with mtime? If we have an out of date record in 
> > > the perf.data, then the perf.data is uninteresting in 99% of the usecases! It's 
> > > out of date, most likely because the binary the developer is working on got 
> > > rebuilt, or the system got upgraded - in both cases the developer does not care 
> > > about the old records anymore...

> > We have 'perf diff' command which compares old and new performance
> > results of a same program.  People can use it to see how much improved
> > in the new version than the baseline.  In this case, the old binary
> > should be found from the old perf.data.

> Just means they'll have to use perf-archive or whatnot before that
> works. Making the regular perf-record dead slow just so that a few more
> complex workloads work doesn't make sense.

And perf-diff will be able to find the right binaries in most cases, as
we'll end up using that mtime to pick the right binary for the baseline
and the other perf.data files used.

So, if both files are reachable via the usual path (/usr/lib/debug,
/bin/, /lib64, ~/.debug/, etc) it'll work.

For users wanting the convenience of auto-saving binaries + its sources,
then they will have to incur the cost of postprocessing the just
generated perf.data file to do that, and make sure debuginfo is enabled,
for having the sources embedded into those fat binaries.

With the current situation, without any disambiguation mechanism, we
_need_ to traverse the perf.data file to find that disambiguation bit,
the build-id (we could'be been using the mtime, but having to traverse
it all we may as well use something better, the build-id), and while
doing that we could as well do a hardlink into ~/.debug/ for the DSOs
found in PERF_RECORD_MMAP(2) meta events (a copy if that hardlink isn't
possible, more overhead).

Now we'll use that mtime, which should be good enough for both figuring
out if a file can be used to even choose among various entries for a
same pathname. And we'll cover the case where a DSO is replaced during
a record session, as newer PERF_RECORD_MMAP3 emitted after the update
will have a different mtime, yay!

The extra, content based verification to double check that is the real
DSO used, which we're not using anyway right now (but could) will not be
possible, i.e. regenerate the build-id from the DSO contents to check
that it is really what was present at the record phase.

But for those super stringent needs, the door is open to add the
content-based cookie at the end of the PERF_RECORD_MMAP3, as we have in
it the filename-len, etc.

So now, with PERF_RECORD_MMAP3 the onus of using this all is back at
where it belongs, away from kernel developers and into tools/perf/
developers, tooling should use build-ids if available and if not,
fallback to mtime, if even that is not available (older kernels) then
warn the user and hope the pathname is enough.

- Arnaldo

  reply	other threads:[~2016-01-19 15:48 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-07 21:56 [RFC] perf record: missing buildid for callstack modules Stephane Eranian
2016-01-07 21:57 ` Andi Kleen
2016-01-07 22:00   ` Stephane Eranian
2016-01-07 21:59 ` Arnaldo Carvalho de Melo
2016-01-07 22:00   ` Stephane Eranian
2016-01-07 22:47     ` Namhyung Kim
2016-01-07 23:47       ` Arnaldo Carvalho de Melo
2016-01-08 18:01         ` Stephane Eranian
2016-01-08 18:19           ` Arnaldo Carvalho de Melo
2016-01-11 17:30             ` Peter Zijlstra
2016-01-11 18:22               ` Arnaldo Carvalho de Melo
2016-01-11 20:06                 ` Stephane Eranian
2016-01-12 10:39               ` Ingo Molnar
2016-01-12 11:35                 ` Peter Zijlstra
2016-01-12 12:18                   ` Ingo Molnar
2016-01-12 13:40                     ` Peter Zijlstra
2016-01-12 14:38                       ` Arnaldo Carvalho de Melo
2016-01-12 15:34                         ` Peter Zijlstra
2016-01-12 15:48                           ` Arnaldo Carvalho de Melo
2016-01-12 16:10                             ` Peter Zijlstra
2016-01-12 16:27                               ` Peter Zijlstra
2016-01-12 17:15                                 ` Arnaldo Carvalho de Melo
2016-01-13 10:21                                   ` Ingo Molnar
2016-01-13 12:40                                     ` Peter Zijlstra
2016-01-14 11:27                                       ` Ingo Molnar
2016-01-14 11:36                                         ` Peter Zijlstra
2016-01-15  1:59                                           ` Stephane Eranian
2016-01-15  9:34                                             ` Peter Zijlstra
2016-01-15 18:58                                               ` Stephane Eranian
2016-01-15 19:49                                                 ` Arnaldo Carvalho de Melo
2016-01-15 21:49                                                   ` Stephane Eranian
2016-01-15 21:36                                                 ` Peter Zijlstra
2016-01-12 21:02                             ` Stephane Eranian
2016-01-12 13:08                   ` One Thousand Gnomes
2016-01-12 14:34                   ` Arnaldo Carvalho de Melo
2016-01-12 15:37                     ` Peter Zijlstra
2016-01-13 10:25                       ` Ingo Molnar
2016-01-12 14:23                 ` Arnaldo Carvalho de Melo
2016-01-13  9:57                   ` Ingo Molnar
2016-01-13 15:27                     ` Arnaldo Carvalho de Melo
2016-01-19 14:56                     ` Namhyung Kim
2016-01-19 15:27                       ` Peter Zijlstra
2016-01-19 15:48                         ` Arnaldo Carvalho de Melo [this message]
2016-01-09 10:31           ` Namhyung Kim
2016-01-11  9:27             ` Adrian Hunter
2016-01-11 11:02               ` Namhyung Kim
2016-01-11 11:54                 ` Adrian Hunter

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=20160119154837.GA27085@kernel.org \
    --to=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=ak@linux.intel.com \
    --cc=eranian@google.com \
    --cc=jolsa@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=namhyung@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.