OpenCloudOS-Kernel/tools/perf/util
Ravi Bangoria 99e608b595 perf probe ppc64le: Fix probe location when using DWARF
Powerpc has Global Entry Point and Local Entry Point for functions.  LEP
catches call from both the GEP and the LEP. Symbol table of ELF contains
GEP and Offset from which we can calculate LEP, but debuginfo does not
have LEP info.

Currently, perf prioritize symbol table over dwarf to probe on LEP for
ppc64le. But when user tries to probe with function parameter, we fall
back to using dwarf(i.e. GEP) and when function called via LEP, probe
will never hit.

For example:

  $ objdump -d vmlinux
    ...
    do_sys_open():
    c0000000002eb4a0:       e8 00 4c 3c     addis   r2,r12,232
    c0000000002eb4a4:       60 00 42 38     addi    r2,r2,96
    c0000000002eb4a8:       a6 02 08 7c     mflr    r0
    c0000000002eb4ac:       d0 ff 41 fb     std     r26,-48(r1)

  $ sudo ./perf probe do_sys_open
  $ sudo cat /sys/kernel/debug/tracing/kprobe_events
    p:probe/do_sys_open _text+3060904

  $ sudo ./perf probe 'do_sys_open filename:string'
  $ sudo cat /sys/kernel/debug/tracing/kprobe_events
    p:probe/do_sys_open _text+3060896 filename_string=+0(%gpr4):string

For second case, perf probed on GEP. So when function will be called via
LEP, probe won't hit.

  $ sudo ./perf record -a -e probe:do_sys_open ls
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.195 MB perf.data ]

To resolve this issue, let's not prioritize symbol table, let perf
decide what it wants to use. Perf is already converting GEP to LEP when
it uses symbol table. When perf uses debuginfo, let it find LEP offset
form symbol table. This way we fall back to probe on LEP for all cases.

After patch:

  $ sudo ./perf probe 'do_sys_open filename:string'
  $ sudo cat /sys/kernel/debug/tracing/kprobe_events
    p:probe/do_sys_open _text+3060904 filename_string=+0(%gpr4):string

  $ sudo ./perf record -a -e probe:do_sys_open ls
    [ perf record: Woken up 1 times to write data ]
    [ perf record: Captured and wrote 0.197 MB perf.data (11 samples) ]

Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
Cc: Balbir Singh <bsingharora@gmail.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/r/1470723805-5081-2-git-send-email-ravi.bangoria@linux.vnet.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2016-08-09 12:14:29 -03:00
..
include perf tools: Remove tools/perf/util/include/linux/const.h 2016-07-18 17:53:22 -03:00
intel-pt-decoder libnvdimm for 4.8 2016-07-28 17:38:16 -07:00
libunwind perf unwind: Fix wrongly used regs for aarch64 unwind 2016-06-23 10:30:31 -03:00
scripting-engines perf tools: Make is_printable_array global 2016-07-18 19:49:47 -03:00
Build tools lib api: Add str_error_c to libapi 2016-07-27 17:16:43 -03:00
PERF-VERSION-GEN
alias.c perf tools: Remove needless includes from cache.h 2016-07-12 15:19:58 -03:00
annotate.c perf annotate: Plug filename string leak 2016-08-01 18:49:13 -03:00
annotate.h perf annotate: Introduce strerror for handling symbol__disassemble() errors 2016-08-01 18:18:16 -03:00
auxtrace.c perf tools: Add support for skipping itrace instructions 2016-03-30 11:14:09 -03:00
auxtrace.h perf auxtrace: Add option to feed branches to the thread stack 2016-06-23 17:02:59 -03:00
bpf-loader.c perf bpf: Support BPF program attach to tracepoints 2016-07-13 23:09:04 -03:00
bpf-loader.h perf bpf: Rename bpf__foreach_tev() to bpf__foreach_event() 2016-07-13 23:09:03 -03:00
bpf-prologue.c perf bpf: Add prologue for BPF programs for fetching arguments 2015-11-18 17:51:04 -03:00
bpf-prologue.h perf bpf: Add prologue for BPF programs for fetching arguments 2015-11-18 17:51:04 -03:00
build-id.c perf probe: Support @BUILDID or @FILE suffix for SDT events 2016-07-13 23:09:08 -03:00
build-id.h perf probe: Support @BUILDID or @FILE suffix for SDT events 2016-07-13 23:09:08 -03:00
cache.h perf tools: Remove needless includes from cache.h 2016-07-12 15:19:58 -03:00
call-path.c perf tools: Refactor code to move call path handling out of thread-stack 2016-05-06 13:00:43 -03:00
call-path.h perf tools: Refactor code to move call path handling out of thread-stack 2016-05-06 13:00:43 -03:00
callchain.c perf hists: Move sort__has_parent into struct perf_hpp_list 2016-05-05 21:03:59 -03:00
callchain.h perf tests: Fix hist accumulation test 2016-07-04 19:39:01 -03:00
cgroup.c perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
cgroup.h perf tools: Remove needless 'extern' from function prototypes 2016-03-23 15:06:35 -03:00
cloexec.c perf tools: Introduce weak alternative to sched_getcpu() 2016-07-12 15:20:34 -03:00
cloexec.h perf tools: Remove needless 'extern' from function prototypes 2016-03-23 15:06:35 -03:00
color.c perf tools: Uninline scnprintf() and vscnprint() 2016-07-12 15:20:24 -03:00
color.h perf tools: Remove trail argument to color vsprintf 2015-08-05 16:44:02 -03:00
comm.c perf comm: Use atomic.h for refcounting 2015-05-27 12:21:43 -03:00
comm.h perf tools: Add facility to export data in database-friendly way 2014-10-29 10:32:49 -02:00
config.c perf config: Introduce new init() and exit() 2016-06-23 17:20:04 -03:00
config.h perf config: Introduce new init() and exit() 2016-06-23 17:20:04 -03:00
counts.c perf stat: Move perf_counts struct and functions into separate object 2015-08-08 14:16:49 -03:00
counts.h perf stat: Move perf_counts struct and functions into separate object 2015-08-08 14:16:49 -03:00
cpumap.c perf cpu_map: Add more helpers 2016-07-18 19:42:47 -03:00
cpumap.h perf cpu_map: Add more helpers 2016-07-18 19:42:47 -03:00
ctype.c perf ui/stdio: Align column header for hierarchy output 2016-02-24 20:21:12 -03:00
data-convert-bt.c perf data ctf: Generate fork and exit events to CTF output 2016-06-28 10:54:58 -03:00
data-convert-bt.h perf data ctf: Pass convert options through opts structure 2016-06-28 10:54:55 -03:00
data-convert.h perf data ctf: Add 'all' option 2016-06-28 10:54:56 -03:00
data.c tools: Introduce str_error_r() 2016-07-12 15:19:47 -03:00
data.h perf data: Add perf_data_file__switch() helper 2016-04-14 08:57:54 -03:00
db-export.c perf thread: Adopt get_main_thread from db-export.c 2016-05-30 12:41:43 -03:00
db-export.h perf script: Add call path id to exported sample in db export 2016-05-06 13:00:53 -03:00
debug.c perf tools: Make binary data printer code in trace_event public available 2016-02-24 11:38:01 -03:00
debug.h tools: Introduce str_error_r() 2016-07-12 15:19:47 -03:00
demangle-java.c perf symbols: add Java demangling support 2016-02-05 09:46:45 -03:00
demangle-java.h perf symbols: add Java demangling support 2016-02-05 09:46:45 -03:00
demangle-rust.c perf symbols: Add Rust demangling 2016-07-12 16:12:38 -03:00
demangle-rust.h perf symbols: Add Rust demangling 2016-07-12 16:12:38 -03:00
dso.c tools: Introduce str_error_r() 2016-07-12 15:19:47 -03:00
dso.h perf tools: Uninline scnprintf() and vscnprint() 2016-07-12 15:20:24 -03:00
dwarf-aux.c perf probe: Check if dwarf_getlocations() is available 2016-05-12 11:26:59 -03:00
dwarf-aux.h perf tools: Remove needless 'extern' from function prototypes 2016-03-23 15:06:35 -03:00
env.c perf header: Transform nodes string info to struct 2016-07-04 19:39:01 -03:00
env.h perf header: Transform nodes string info to struct 2016-07-04 19:39:01 -03:00
event.c perf tools: Change cpu_map__fprintf output 2016-06-30 18:27:45 -03:00
event.h Revert "perf tools: event.h needs asm/perf_regs.h" 2016-07-25 11:58:56 -03:00
evlist.c perf evsel: Introduce constructor for cycles event 2016-07-28 18:33:20 -03:00
evlist.h perf evlist: Make {pause,resume} internal helpers 2016-07-15 17:27:50 -03:00
evsel.c perf record: Add --sample-cpu option 2016-08-02 16:33:29 -03:00
evsel.h perf evsel: Introduce constructor for cycles event 2016-07-28 18:33:20 -03:00
evsel_fprintf.c perf evsel: Move fprintf methods to separate source file 2016-04-14 19:46:58 -03:00
find-vdso-map.c perf tools: Build programs to copy 32-bit compatibility 2014-10-29 10:32:48 -02:00
genelf.c perf jit: add source line info support 2016-02-05 12:33:09 -03:00
genelf.h perf jit: genelf makes assumptions about endian 2016-03-30 18:12:06 -03:00
genelf_debug.c perf jit: add source line info support 2016-02-05 12:33:09 -03:00
generate-cmdlist.sh perf tools: Do not show trace command if it's not compiled in 2016-01-08 12:46:17 -03:00
group.h perf stat: Basic support for TopDown in perf stat 2016-06-06 17:04:15 -03:00
header.c perf header: Transform nodes string info to struct 2016-07-04 19:39:01 -03:00
header.h perf tools: Remove misplaced __maybe_unused 2016-03-23 12:03:04 -03:00
help-unknown-cmd.c perf tools: Uninline scnprintf() and vscnprint() 2016-07-12 15:20:24 -03:00
help-unknown-cmd.h perf tools: Move help_unknown_cmd() to its own file 2015-12-14 12:30:37 -03:00
hist.c perf hists: Introduce output_resort_cb method 2016-08-02 16:33:28 -03:00
hist.h perf hists: Introduce output_resort_cb method 2016-08-02 16:33:28 -03:00
intel-bts.c perf auxtrace: Add option to feed branches to the thread stack 2016-06-23 17:02:59 -03:00
intel-bts.h perf tools: Add Intel BTS support 2015-08-21 11:34:10 -03:00
intel-pt.c perf auxtrace: Add option to feed branches to the thread stack 2016-06-23 17:02:59 -03:00
intel-pt.h perf tools: Pass Intel PT information for decoding MTC and CYC 2015-08-24 17:46:43 -03:00
intlist.c
intlist.h perf intlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:39:19 -03:00
jit.h perf tools: Remove needless 'extern' from function prototypes 2016-03-23 15:06:35 -03:00
jitdump.c perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
jitdump.h perf jit: Add support for using TSC as a timestamp 2016-04-01 18:42:55 -03:00
kvm-stat.h perf kvm/powerpc: Port perf kvm stat to powerpc 2016-01-29 17:49:54 -03:00
levenshtein.c perf tools: Remove needless includes from cache.h 2016-07-12 15:19:58 -03:00
levenshtein.h
llvm-utils.c perf tools: Remove needless includes from cache.h 2016-07-12 15:19:58 -03:00
llvm-utils.h perf llvm: Allow dump llvm output object file using llvm.dump-obj 2016-06-21 13:18:34 -03:00
lzma.c perf tools: Add lzma decompression support for kernel module 2015-03-21 14:53:40 -03:00
machine.c perf s390: Fix 'start' address of module's map 2016-07-26 16:46:12 -03:00
machine.h perf s390: Fix 'start' address of module's map 2016-07-26 16:46:12 -03:00
map.c perf probe: Warn unmatched function filter correctly 2016-07-18 19:46:34 -03:00
map.h perf unwind: Call unwind__prepare_access for forked thread 2016-07-04 20:27:25 -03:00
mem-events.c perf mem: Add --ldlat option 2016-06-15 10:35:27 -03:00
mem-events.h perf mem: Add --ldlat option 2016-06-15 10:35:27 -03:00
ordered-events.c perf ordered_events: Introduce reinit() 2016-04-14 08:57:54 -03:00
ordered-events.h perf ordered_events: Introduce reinit() 2016-04-14 08:57:54 -03:00
parse-branch-options.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
parse-branch-options.h perf tools: Move branch option parsing to own file 2015-05-27 21:02:17 -03:00
parse-events.c perf tools: Enable overwrite settings 2016-07-15 17:27:51 -03:00
parse-events.h perf tools: Enable overwrite settings 2016-07-15 17:27:51 -03:00
parse-events.l perf tools: Enable overwrite settings 2016-07-15 17:27:51 -03:00
parse-events.y perf tools: Explicitly declare inc_group_count as a void function 2016-03-08 10:11:16 +01:00
parse-regs-options.c perf subcmd: Create subcmd library 2015-12-17 14:27:14 -03:00
parse-regs-options.h perf record: Add ability to name registers to record 2015-08-31 18:01:33 -03:00
path.c perf tools: Remove needless includes from cache.h 2016-07-12 15:19:58 -03:00
perf_regs.c perf tools: Fix perf regs mask generation 2016-05-11 21:54:06 +10:00
perf_regs.h perf tools: Fix build break on powerpc due to sample_reg_masks 2015-09-30 18:34:27 -03:00
pmu.c perf pmu: Make pmu_formats_string to check return value of strbuf 2016-05-10 11:57:52 -03:00
pmu.h perf tools: Add perf_pmu__format_bits() 2015-08-06 16:49:01 -03:00
pmu.l
pmu.y
probe-event.c perf probe ppc64le: Fix probe location when using DWARF 2016-08-09 12:14:29 -03:00
probe-event.h perf probe ppc64le: Fix probe location when using DWARF 2016-08-09 12:14:29 -03:00
probe-file.c perf probe: Allow wildcard for cached events 2016-07-13 23:09:07 -03:00
probe-file.h perf list: Show SDT and pre-cached events 2016-07-13 23:09:07 -03:00
probe-finder.c perf probe: Support signedness casting 2016-08-09 10:52:22 -03:00
probe-finder.h perf tools: Remove needless 'extern' from function prototypes 2016-03-23 15:06:35 -03:00
pstack.c perf tools: Introduce pstack_peek() 2015-05-05 18:13:22 -03:00
pstack.h perf tools: Introduce pstack_peek() 2015-05-05 18:13:22 -03:00
python-ext-sources tools lib api: Add str_error_c to libapi 2016-07-27 17:16:43 -03:00
python.c perf tools: Make is_printable_array global 2016-07-18 19:49:47 -03:00
quote.c perf quote: Disentangle headers 2016-07-12 15:19:55 -03:00
quote.h perf quote: Disentangle headers 2016-07-12 15:19:55 -03:00
rb_resort.h perf rb_resort: Rename for_each() macros to for_each_entry() 2016-06-23 11:35:07 -03:00
rblist.c
rblist.h
record.c perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
session.c perf session: Don't warn about out of order event if write_backward is used 2016-07-15 17:27:51 -03:00
session.h perf evsel: Move some methods from session.[ch] to evsel.[ch] 2016-04-13 10:11:52 -03:00
setup.py perf tools: Fix python extension build 2016-02-29 11:18:25 -03:00
sort.c perf hists: Trim libtraceevent trace_seq buffers 2016-08-09 10:46:56 -03:00
sort.h perf hists: Introduce hist_entry_ops 2016-07-12 00:00:39 -03:00
srcline.c perf tools: Always use non inlined file name for 'srcfile' sort key 2015-09-02 16:30:46 -03:00
stat-shadow.c perf stat: Add computation of TopDown formulas 2016-06-06 17:04:16 -03:00
stat.c perf evlist: Rename for_each() macros to for_each_entry() 2016-06-23 11:26:15 -03:00
stat.h perf stat: Add computation of TopDown formulas 2016-06-06 17:04:16 -03:00
strbuf.c perf strbuf: Add missing headers 2016-07-12 15:19:55 -03:00
strbuf.h perf strbuf: Add missing headers 2016-07-12 15:19:55 -03:00
strfilter.c perf tools: Add strfilter__string to recover rules string 2015-05-04 12:43:54 -03:00
strfilter.h perf tools: Add strfilter__string to recover rules string 2015-05-04 12:43:54 -03:00
string.c tools: Adopt memdup() from tools/perf, moving it to tools/lib/string.c 2015-11-18 17:51:02 -03:00
strlist.c perf tools: Add file_only config option to strlist 2016-01-12 12:42:07 -03:00
strlist.h perf tools: Rename strlist_for_each() macros to for_each_entry() 2016-06-23 11:35:01 -03:00
svghelper.c perf tools: Add reference counting for cpu_map object 2015-06-25 15:15:50 -03:00
svghelper.h perf tools: Remove needless 'extern' from function prototypes 2016-03-23 15:06:35 -03:00
symbol-elf.c perf symbols: Add Rust demangling 2016-07-12 16:12:38 -03:00
symbol-minimal.c perf symbols: Fix type error when reading a build-id 2015-10-28 10:02:00 -03:00
symbol.c perf symbols: Use proper dso name for is_regular_file 2016-06-28 10:54:54 -03:00
symbol.h perf sdt: ELF support for SDT 2016-07-04 19:38:59 -03:00
symbol_fprintf.c perf symbols: Move fprintf routines to separate object file 2016-04-14 19:46:53 -03:00
syscalltbl.c perf tools: Build syscall table .c header from kernel's syscall_64.tbl 2016-04-08 09:58:14 -03:00
syscalltbl.h perf tools: Allow generating per-arch syscall table arrays 2016-04-08 09:58:14 -03:00
target.c perf target: str_error_r() always returns the buffer it receives 2016-07-29 11:54:35 -03:00
target.h
term.c perf tools: Move term functions out of util.c 2015-12-09 13:42:02 -03:00
term.h perf tools: Move term functions out of util.c 2015-12-09 13:42:02 -03:00
thread-stack.c perf script: Add callindent option 2016-06-23 17:04:26 -03:00
thread-stack.h perf script: Add callindent option 2016-06-23 17:04:26 -03:00
thread.c perf unwind: Call unwind__prepare_access for forked thread 2016-07-04 20:27:25 -03:00
thread.h perf unwind: Move unwind__prepare_access from thread_new into thread__insert_map 2016-06-07 12:08:52 -03:00
thread_map.c perf tools: Rename strlist_for_each() macros to for_each_entry() 2016-06-23 11:35:01 -03:00
thread_map.h perf thread_map: Make new_by_tid_str constructor public 2016-04-13 10:11:51 -03:00
tool.h perf tools: Add time conversion event 2016-03-31 10:52:24 -03:00
top.c
top.h perf top: Use machine->kptr_restrict_warned 2016-05-20 11:43:55 -03:00
trace-event-info.c tools lib api fs: Move tracing_path interface into api/fs/tracing_path.c 2015-09-04 12:00:45 -03:00
trace-event-parse.c irq_poll: make blk-iopoll available outside the block layer 2015-12-11 11:52:24 -08:00
trace-event-read.c perf tools: Stop reading the kallsyms data from perf.data 2015-07-23 22:51:11 -03:00
trace-event-scripting.c perf scripting: No need to pass thread twice to the scripting callbacks 2015-04-02 13:18:41 -03:00
trace-event.c perf tools: Introduce trace_event__tp_format_id() 2016-07-12 16:14:52 -03:00
trace-event.h perf tools: Introduce trace_event__tp_format_id() 2016-07-12 16:14:52 -03:00
trigger.h perf tools: Introduce trigger class 2016-04-28 09:58:58 -03:00
tsc.c perf tools: Use 64-bit shifts with (TSC) time conversion 2016-03-08 10:11:18 +01:00
tsc.h perf jit: Add support for using TSC as a timestamp 2016-04-01 18:42:55 -03:00
unwind-libdw.c perf libdw: Check for mmaps also in MAP__VARIABLE tree 2016-01-08 14:16:57 -03:00
unwind-libdw.h perf callchain: Add order support for libdw DWARF unwinder 2015-11-23 18:31:13 -03:00
unwind-libunwind-local.c perf unwind: Change macro names of perf register 2016-06-23 10:30:17 -03:00
unwind-libunwind.c perf unwind: Add initialized arg into unwind__prepare_access 2016-07-04 20:27:12 -03:00
unwind.h perf unwind: Add initialized arg into unwind__prepare_access 2016-07-04 20:27:12 -03:00
usage.c perf tools: Simplify die() mechanism 2016-03-23 12:32:31 -03:00
util.c perf tools: Make is_printable_array global 2016-07-18 19:49:47 -03:00
util.h perf tools: Make is_printable_array global 2016-07-18 19:49:47 -03:00
values.c
values.h tools: Consolidate types.h 2014-05-01 21:22:39 +02:00
vdso.c perf tools: Find right DSO taking into account if binary is 32 or 64-bit 2016-06-23 10:25:58 -03:00
vdso.h perf machine: Fix up vdso methods names 2015-05-29 12:43:44 -03:00
xyarray.c perf tools: Introduce xyarray__reset function 2015-06-16 10:34:39 -03:00
xyarray.h perf tools: Introduce xyarray__reset function 2015-06-16 10:34:39 -03:00
zlib.c perf tools: Add gzip decompression support for kernel module 2014-11-05 10:11:26 -03:00