[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120207142521.GA5840@mgebm.net>
Date: Tue, 7 Feb 2012 09:25:21 -0500
From: Eric B Munson <emunson@...bm.net>
To: Anton Blanchard <anton@...ba.org>
Cc: Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Paul Mackerras <paulus@...ba.org>, Ingo Molnar <mingo@...e.hu>,
Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
Frederic Weisbecker <fweisbec@...il.com>, imunsie@....ibm.com,
eranian@...gle.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] perf annotate: Numeric assembly labels cause incorrect
annotation
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@...ba.org>
Acked-by: Eric B Munson <emunson@...bm.net>
Download attachment "signature.asc" of type "application/pgp-signature" (837 bytes)
Powered by blists - more mailing lists