powerpc/perf_events: Fix call-graph recording, add perf_arch_fetch_caller_regs
authorPaul Mackerras <paulus@samba.org>
Thu, 18 Mar 2010 05:05:13 +0000 (16:05 +1100)
committerIngo Molnar <mingo@elte.hu>
Thu, 18 Mar 2010 05:48:29 +0000 (06:48 +0100)
commit9eff26ea48bfbe2885b158742a7512a097ec911b
treea914f959b78bdf4ee9eca897a743d727c27faf4f
parent00909e955125e90a6ebb34671c56c4c851e62951
powerpc/perf_events: Fix call-graph recording, add perf_arch_fetch_caller_regs

This implements a powerpc version of perf_arch_fetch_caller_regs
to get correct call-graphs.

It's implemented in assembly because that way we can be sure there isn't
a stack frame for perf_arch_fetch_caller_regs.  If it was in C, gcc might
or might not create a stack frame for it, which would affect the number
of levels we have to skip.

With this, we see results from perf record -e lock:lock_acquire like
this:

 # Samples: 24878
 #
 # Overhead         Command      Shared Object  Symbol
 # ........  ..............  .................  ......
 #
    14.99%            perf  [kernel.kallsyms]  [k] ._raw_spin_lock
                      |
                      --- ._raw_spin_lock
                         |
                         |--25.00%-- .alloc_fd
                         |          (nil)
                         |          |
                         |          |--50.00%-- .anon_inode_getfd
                         |          |          .sys_perf_event_open
                         |          |          syscall_exit
                         |          |          syscall
                         |          |          create_counter
                         |          |          __cmd_record
                         |          |          run_builtin
                         |          |          main
                         |          |          0xfd2e704
                         |          |          0xfd2e8c0
                         |          |          (nil)

... etc.

Signed-off-by: Paul Mackerras <paulus@samba.org>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: anton@samba.org
Cc: linuxppc-dev@ozlabs.org
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
LKML-Reference: <20100318050513.GA6575@drongo>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/powerpc/include/asm/asm-compat.h
arch/powerpc/kernel/misc.S