[PATCH 1/1] powerpc/perf: Adjust callchain based on DWARF debug info

Maynard Johnson mpjohn at us.ibm.com
Wed May 14 02:15:20 EST 2014


Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com> wrote on 05/09/2014
09:46:38 PM:

> From: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
> To: Arnaldo Carvalho de Melo <acme at ghostprotocols.net>,
> Cc: linux-kernel at vger.kernel.org, Anton Blanchard
> <anton at au1.ibm.com>, Ulrich.Weigand at de.ibm.com, Michael Ellerman
> <michaele at au1.ibm.com>, Maynard Johnson/Rochester/IBM at IBMUS,
> linuxppc-dev at lists.ozlabs.org
> Date: 05/09/2014 09:46 PM
> Subject: [PATCH 1/1] powerpc/perf: Adjust callchain based on DWARF debug
info
>
> [PATCH 1/1] powerpc/perf: Adjust callchain based on DWARF debug info

Acked-by: Maynard Johnson <maynardj at us.ibm.com>

Reviewed and tested.  Thanks, Suka.

-Maynard

>
> When saving the callchain on Power, the kernel conservatively saves
excess
> entries in the callchain. A few of these entries are needed in some cases
> but not others.
>
> Eg: the value in the link register (LR) is needed only when it holds the
> return address of a function. At other times it must be ignored.
>
> If the unnecessary entries are not ignored, we end up with duplicate arcs
> in the call-graphs.
>
> Use DWARF debug information to ignore the unnecessary entries.
>
> Callgraph before the patch:
>
>     14.67%          2234  sprintft  libc-2.18.so       [.] __random
>             |
>             --- __random
>                |
>                |--61.12%-- __random
>                |          |
>                |          |--97.15%-- rand
>                |          |          do_my_sprintf
>                |          |          main
>                |          |          generic_start_main.isra.0
>                |          |          __libc_start_main
>                |          |          0x0
>                |          |
>                |           --2.85%-- do_my_sprintf
>                |                     main
>                |                     generic_start_main.isra.0
>                |                     __libc_start_main
>                |                     0x0
>                |
>                 --38.88%-- rand
>                           |
>                           |--94.01%-- rand
>                           |          do_my_sprintf
>                           |          main
>                           |          generic_start_main.isra.0
>                           |          __libc_start_main
>                           |          0x0
>                           |
>                            --5.99%-- do_my_sprintf
>                                      main
>                                      generic_start_main.isra.0
>                                      __libc_start_main
>                                      0x0
>
> Callgraph after the patch:
>
>     14.67%          2234  sprintft  libc-2.18.so       [.] __random
>             |
>             --- __random
>                |
>                |--95.93%-- rand
>                |          do_my_sprintf
>                |          main
>                |          generic_start_main.isra.0
>                |          __libc_start_main
>                |          0x0
>                |
>                 --4.07%-- do_my_sprintf
>                           main
>                           generic_start_main.isra.0
>                           __libc_start_main
>                           0x0
>
> TODO:   For split-debug info objects like glibc, we can only determine
>    the call-frame-address only when both .eh_frame and .debug_info
>    sections are available. We should be able to determin the CFA
>    even without the .eh_frame section.
>
> Thanks to Ulrich Weigand for help with DWARF debug information.
>
> Fix suggested by Anton Blanchard.
>
> Reported-by: Maynard Johnson <maynard at us.ibm.com>
> Signed-off-by: Sukadev Bhattiprolu <sukadev at linux.vnet.ibm.com>
> ---
>  tools/perf/arch/powerpc/Makefile                |   1 +
>  tools/perf/arch/powerpc/util/adjust-callchain.c | 278 +++++++++++++
> +++++++++++
>  tools/perf/config/Makefile                      |   5 +
>  tools/perf/util/callchain.h                     |  12 +
>  tools/perf/util/machine.c                       |  16 +-
>  5 files changed, 310 insertions(+), 2 deletions(-)
>  create mode 100644 tools/perf/arch/powerpc/util/adjust-callchain.c
>
[snip]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ozlabs.org/pipermail/linuxppc-dev/attachments/20140513/27185371/attachment.html>


More information about the Linuxppc-dev mailing list