linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Will Deacon <will.deacon@arm.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: He Kuang <hekuang@huawei.com>,
	"mingo@redhat.com" <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Jiri Olsa <jolsa@redhat.com>,
	rabin.vincent@axis.com, namhyung@kernel.org,
	Wang Nan <wangnan0@huawei.com>,
	linux-kernel@vger.kernel.org, mark.rutland@arm.com
Subject: Re: [bug] wrong result of android callchain
Date: Tue, 5 Jan 2016 11:13:52 +0000	[thread overview]
Message-ID: <20160105111351.GA10705@arm.com> (raw)
In-Reply-To: <20160105102055.GB6357@twins.programming.kicks-ass.net>

On Tue, Jan 05, 2016 at 11:20:55AM +0100, Peter Zijlstra wrote:
> On Tue, Jan 05, 2016 at 05:14:37PM +0800, He Kuang wrote:
> > I found a wrong result of aarch64 callchain when using perf script on
> > a android phone.
> 
> Might help to include the AARGH64 people then.. seeing I have no clue
> about all that. Cc's added, email preserved etc..

It looks like the issue is in the perf tool, where it fails to resolve
the address to a symbol correctly.

> > 
> > Here's the callchain record fragment from the output of perf script:
> > 
> >   init   369 [002]   339.970607: raw_syscalls:sys_enter: NR 22 (b, 7fd9e360a0, 10, ffffffff, 0, 8)
> >                      ...
> >                    230ac [unknown] (/system/lib64/libsurfaceflinger.so)
> >                     11a0 main (/system/bin/surfaceflinger)
> >                    1c3fc __libc_init (/system/lib64/libc.so)
> >                      fd0 _start (/system/bin/surfaceflinger)
> >                     29ec __dl__start (/system/bin/linker64)
> > 
> > The fault occured in the '[unknown]' line, from objdump result of
> > /system/bin/surfaceflinger, we can see the branch instruction before
> > 0x11a0:
> > 
> >  # objdump /system/bin/surfaceflinger
> >     1198:       f9400fe0        ldr     x0, [sp,#24]
> >     119c:       97ffff05        bl      db0 <_ZN7android14SurfaceFlinger3runEv@plt>
> >     11a0:       f9400be8        ldr     x8, [sp,#16]
> >     11a4:       b40000c8        cbz     x8, 11bc <main+0x150>
> > 
> > The function '_ZN7android14SurfaceFlinger3runEv' is located at 0x3a094
> > ~ 0x3a0ac in libsurfaceflinger.so, but perf misparsed that value to
> > 0x230ac:
> > 
> >  # objdump libsurfaceflinger.so
> >   000000000003a094 <_ZN7android14SurfaceFlinger3runEv>:
> >     3a094:       a9be4ff4        stp     x20, x19, [sp,#-32]!
> >     3a098:       a9017bfd        stp     x29, x30, [sp,#16]
> >     3a09c:       910043fd        add     x29, sp, #0x10
> >     3a0a0:       910c0013        add     x19, x0, #0x300
> >     3a0a4:       aa1303e0        mov     x0, x19
> >     3a0a8:       97fff12f        bl      36564 <_ZN7android12MessageQueue11waitMessageEv>
> >     3a0ac:       17fffffe        b       3a0a4 <_ZN7android14SurfaceFlinger3runEv+0x10>
> > 
> > There's a difference of 0x17000 between those two offsets, it seems
> > that this value is the VirtAddr of this dynamic library.
> > 
> >  # readelf -a libsurfaceflinger.so
> >   Program Headers:
> >     Type           Offset             VirtAddr           PhysAddr
> >                    FileSiz            MemSiz              Flags  Align
> >     LOAD           0x0000000000000000 0x0000000000017000 0x0000000000017000
> >                    0x0000000000057258 0x0000000000057258  R E    1000

This reminds me of:

  http://lkml.kernel.org/r/1435162623-20075-1-git-send-email-will.deacon@arm.com

but that was all vdso-specific. Can you look at what gets passed to objdump?

Will

  reply	other threads:[~2016-01-05 11:14 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05  9:14 [bug] wrong result of android callchain He Kuang
2016-01-05 10:20 ` Peter Zijlstra
2016-01-05 11:13   ` Will Deacon [this message]
2016-01-06  8:26     ` [PATCH] perf symbols: Fix wrong symbol offset according to p_addr He Kuang
2016-01-11 11:25       ` Ingo Molnar
2016-01-12  2:58         ` [PATCH v2] " He Kuang

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=20160105111351.GA10705@arm.com \
    --to=will.deacon@arm.com \
    --cc=acme@kernel.org \
    --cc=hekuang@huawei.com \
    --cc=jolsa@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=rabin.vincent@axis.com \
    --cc=wangnan0@huawei.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;
as well as URLs for NNTP newsgroup(s).