All of lore.kernel.org
 help / color / mirror / Atom feed
From: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: Ravi Bangoria <ravi.bangoria@linux.ibm.com>,
	linux-kernel@vger.kernel.org, namhyung@kernel.org,
	mark.rutland@arm.com, naveen.n.rao@linux.vnet.ibm.com
Subject: Re: [PATCH] perf dso: Fix dso comparison
Date: Tue, 24 Mar 2020 10:21:15 -0300	[thread overview]
Message-ID: <20200324132115.GC21569@kernel.org> (raw)
In-Reply-To: <20200324130052.GB21569@kernel.org>

Em Tue, Mar 24, 2020 at 10:00:52AM -0300, Arnaldo Carvalho de Melo escreveu:
> Em Tue, Mar 24, 2020 at 11:48:43AM +0100, Jiri Olsa escreveu:
> > On Tue, Mar 24, 2020 at 09:54:24AM +0530, Ravi Bangoria wrote:
> > > Perf gets dso details from two different sources. 1st, from builid
> > > headers in perf.data and 2nd from MMAP2 samples. Dso from buildid
> > > header does not have dso_id detail. And dso from MMAP2 samples does
> > > not have buildid information. If detail of the same dso is present
> > > at both the places, filename is common.
> > > 
> > > Previously, __dsos__findnew_link_by_longname_id() used to compare only
> > > long or short names, but Commit 0e3149f86b99 ("perf dso: Move dso_id
> > > from 'struct map' to 'struct dso'") also added a dso_id comparison.
> > > Because of that, now perf is creating two different dso objects of the
> > > same file, one from buildid header (with dso_id but without buildid)
> > > and second from MMAP2 sample (with buildid but without dso_id).
> > > 
> > > This is causing issues with archive, buildid-list etc subcommands. Fix
> > > this by comparing dso_id only when it's present. And incase dso is
> > > present in 'dsos' list without dso_id, inject dso_id detail as well.
> > > 
> > > Before:
> > > 
> > >   $ sudo ./perf buildid-list -H
> > >   0000000000000000000000000000000000000000 /usr/bin/ls
> > >   0000000000000000000000000000000000000000 /usr/lib64/ld-2.30.so
> > >   0000000000000000000000000000000000000000 /usr/lib64/libc-2.30.so
> > > 
> > >   $ ./perf archive
> > >   perf archive: no build-ids found
> > > 
> > > After:
> > > 
> > >   $ ./perf buildid-list -H
> > >   b6b1291d0cead046ed0fa5734037fa87a579adee /usr/bin/ls
> > >   641f0c90cfa15779352f12c0ec3c7a2b2b6f41e8 /usr/lib64/ld-2.30.so
> > >   675ace3ca07a0b863df01f461a7b0984c65c8b37 /usr/lib64/libc-2.30.so
> > > 
> > >   $ ./perf archive
> > >   Now please run:
> > > 
> > >   $ tar xvf perf.data.tar.bz2 -C ~/.debug
> > > 
> > >   wherever you need to run 'perf report' on.

This improves the situation, but something else is still amiss:

[root@five ~]# perf buildid-list -H | grep ^000000000000 | while read -a line ; do path=${line[1]} ; nlines=$(perf buildid-list -H -i perf.data | grep $path | tee /tmp/lines | wc -l) ;[ $nlines -eq 2 ] && cat /tmp/lines ; done
641f0c90cfa15779352f12c0ec3c7a2b2b6f41e8 /usr/lib64/ld-2.30.so
0000000000000000000000000000000000000000 /usr/lib64/ld-2.30.so
d40c8da7371d8adea464ae2b099590b2c4465574 /usr/lib64/libpthread-2.30.so
0000000000000000000000000000000000000000 /usr/lib64/libpthread-2.30.so
aec38b95c2b305c9f1943b2dd988aeb58c17a5d9 /usr/lib64/libm-2.30.so
0000000000000000000000000000000000000000 /usr/lib64/libm-2.30.so
675ace3ca07a0b863df01f461a7b0984c65c8b37 /usr/lib64/libc-2.30.so
0000000000000000000000000000000000000000 /usr/lib64/libc-2.30.so
8286f22591b0be26730eea306a22a0f30475590b /usr/bin/bash
0000000000000000000000000000000000000000 /usr/bin/bash
[root@five ~]#

I.e. DSOs that have not changed:

[root@five ~]# grep libpthread /proc/*/maps | cut -d' ' -f6- | sort  | uniq -c
    690                    /usr/lib64/libpthread-2.30.so
[root@five ~]#

[root@five ~]# file /usr/lib64/libpthread-2.30.so
/usr/lib64/libpthread-2.30.so: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, BuildID[sha1]=d40c8da7371d8adea464ae2b099590b2c4465574, for GNU/Linux 3.2.0, not stripped
[root@five ~]#
[root@five ~]# perf buildid-list -i /usr/lib64/libpthread-2.30.so
d40c8da7371d8adea464ae2b099590b2c4465574
[root@five ~]#

Appear with/without build-id in 'perf buildid-list'.

I'm checking a bit more to see if I figure this out, I'll keep your
patch in, maybe this is a diferent issue, will combine if needed.

- Arnaldo

  parent reply	other threads:[~2020-03-24 13:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-24  4:24 [PATCH] perf dso: Fix dso comparison Ravi Bangoria
2020-03-24 10:48 ` Jiri Olsa
2020-03-24 12:37   ` Ravi Bangoria
2020-03-24 13:22     ` Jiri Olsa
2020-03-24 13:42       ` Arnaldo Carvalho de Melo
2020-03-24 13:42       ` Ravi Bangoria
2020-03-24 13:00   ` Arnaldo Carvalho de Melo
2020-03-24 13:20     ` Jiri Olsa
2020-03-24 13:21     ` Arnaldo Carvalho de Melo [this message]
2020-03-24 13:44 ` Naveen N. Rao
2020-04-04  8:41 ` [tip: perf/urgent] " tip-bot2 for Ravi Bangoria

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=20200324132115.GC21569@kernel.org \
    --to=arnaldo.melo@gmail.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=namhyung@kernel.org \
    --cc=naveen.n.rao@linux.vnet.ibm.com \
    --cc=ravi.bangoria@linux.ibm.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 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.