All of lore.kernel.org
 help / color / mirror / Atom feed
From: Eric B Munson <emunson@mgebm.net>
To: Anton Blanchard <anton@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
	Arnaldo Carvalho de Melo <acme@ghostprotocols.net>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	imunsie@au1.ibm.com, eranian@google.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] perf annotate: Numeric assembly labels cause incorrect annotation
Date: Tue, 7 Feb 2012 09:25:21 -0500	[thread overview]
Message-ID: <20120207142521.GA5840@mgebm.net> (raw)
In-Reply-To: <20120207145535.71b9f22d@kryten>

[-- Attachment #1: Type: text/plain, Size: 2133 bytes --]

On Tue, 07 Feb 2012, Anton Blanchard wrote:

> 
> A perf annotate of a kernel function written in assembly shows
> very strange percentages:
> 
>          :      _GLOBAL(__copy_tofrom_user_base)
> 
> ...
> 
>          :              addi    r3,r3,1
>    99.67 :      c00000000004d78c:       addi    r3,r3,1
>          :
>     0.00 :      1:      bf      cr7*4+2,2f
>     0.07 :      c00000000004d790:       bne-    cr7,c00000000004d7a4
>          :      err1;   lhz     r0,0(r4)
>     0.00 :      c00000000004d794:       lhz     r0,0(r4)
>          :              addi    r4,r4,2
>     0.00 :      c00000000004d798:       addi    r4,r4,2
>          :      err1;   sth     r0,0(r3)
>     0.00 :      c00000000004d79c:       sth     r0,0(r3)
>          :              addi    r3,r3,2
>    99.60 :      c00000000004d7a0:       addi    r3,r3,2
>          :
>     0.00 :      2:      bf      cr7*4+1,3f
>     0.12 :      c00000000004d7a4:       ble-    cr7,c00000000004d7b8
>          :      err1;   lwz     r0,0(r4)
>     0.00 :      c00000000004d7a8:       lwz     r0,0(r4)
>          :              addi    r4,r4,4
>     0.00 :      c00000000004d7ac:       addi    r4,r4,4
>          :      err1;   stw     r0,0(r3)
>     0.00 :      c00000000004d7b0:       stw     r0,0(r3)
>          :              addi    r3,r3,4
>    99.48 :      c00000000004d7b4:       addi    r3,r3,4
> 
> ~300% in one function. Urgh.
> 
> This is caused by the way we parse objdump -S output, eg:
> 
>         addi    r3,r3,1
> c00000000004d78c:       addi    r3,r3,1
> 
> 1:      bf      cr7*4+2,2f
> c00000000004d790:       bne-    cr7,c00000000004d7a4 
> 
> We assume the asm label (1:) is an address, compute a bogus offset
> into the function and then screw up the matching of samples to lines.
> I notice this also fails with c inline assembly in a similar
> manner.
> 
> We already have a sanity check that the address is not beyond the end
> of the function, so add a check against the start too.
> 
> Signed-off-by: Anton Blanchard <anton@samba.org>

Acked-by: Eric B Munson <emunson@mgebm.net>

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

  reply	other threads:[~2012-02-07 14:25 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-07  3:55 [PATCH] perf annotate: Numeric assembly labels cause incorrect annotation Anton Blanchard
2012-02-07 14:25 ` Eric B Munson [this message]
2012-02-07 14:40 ` Arnaldo Carvalho de Melo
2012-02-09 10:10   ` Mike Galbraith
2012-02-09 13:31     ` Ingo Molnar
2012-02-09 14:50       ` Mike Galbraith
2012-02-09 15:50       ` Mike Galbraith

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=20120207142521.GA5840@mgebm.net \
    --to=emunson@mgebm.net \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@ghostprotocols.net \
    --cc=anton@samba.org \
    --cc=eranian@google.com \
    --cc=fweisbec@gmail.com \
    --cc=imunsie@au1.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulus@samba.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.