linux/tools/perf/util
Thomas Richter b9c0a64901 perf annotate: Fix s390 gap between kernel end and module start
During execution of command 'perf top' the error message:

   Not enough memory for annotating '__irf_end' symbol!)

is emitted from this call sequence:
  __cmd_top
    perf_top__mmap_read
      perf_top__mmap_read_idx
        perf_event__process_sample
          hist_entry_iter__add
            hist_iter__top_callback
              perf_top__record_precise_ip
                hist_entry__inc_addr_samples
                  symbol__inc_addr_samples
                    symbol__get_annotation
                      symbol__alloc_hist

In this function the size of symbol __irf_end is calculated. The size of
a symbol is the difference between its start and end address.

When the symbol was read the first time, its start and end was set to:

   symbol__new: __irf_end 0xe954d0-0xe954d0

which is correct and maps with /proc/kallsyms:

   root@s8360046:~/linux-4.15.0/tools/perf# fgrep _irf_end /proc/kallsyms
   0000000000e954d0 t __irf_end
   root@s8360046:~/linux-4.15.0/tools/perf#

In function symbol__alloc_hist() the end of symbol __irf_end is

  symbol__alloc_hist sym:__irf_end start:0xe954d0 end:0x3ff80045a8

which is identical with the first module entry in /proc/kallsyms

This results in a symbol size of __irf_req for histogram analyses of
70334140059072 bytes and a malloc() for this requested size fails.

The root cause of this is function
  __dso__load_kallsyms()
  +-> symbols__fixup_end()

Function symbols__fixup_end() enlarges the last symbol in the kallsyms
map:

   # fgrep __irf_end /proc/kallsyms
   0000000000e954d0 t __irf_end
   #

to the start address of the first module:
   # cat /proc/kallsyms | sort  | egrep ' [tT] '
   ....
   0000000000e952d0 T __security_initcall_end
   0000000000e954d0 T __initramfs_size
   0000000000e954d0 t __irf_end
   000003ff800045a8 T fc_get_event_number       [scsi_transport_fc]
   000003ff800045d0 t store_fc_vport_disable    [scsi_transport_fc]
   000003ff800046a8 T scsi_is_fc_rport  [scsi_transport_fc]
   000003ff800046d0 t fc_target_setup   [scsi_transport_fc]

On s390 the kernel is located around memory address 0x200, 0x10000 or
0x100000, depending on linux version. Modules however start some- where
around 0x3ff xxxx xxxx.

This is different than x86 and produces a large gap for which histogram
allocation fails.

Fix this by detecting the kernel's last symbol and do no adjustment for
it. Introduce a weak function and handle s390 specifics.

Reported-by: Klaus Theurich <klaus.theurich@de.ibm.com>
Signed-off-by: Thomas Richter <tmricht@linux.ibm.com>
Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Cc: Hendrik Brueckner <brueckner@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: stable@vger.kernel.org
Link: http://lkml.kernel.org/r/20190724122703.3996-2-tmricht@linux.ibm.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
2019-08-08 15:41:25 -03:00
..
c++
cs-etm-decoder tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
include perf tools: Remove old baggage that is util/include/linux/ctype.h 2019-06-25 18:31:12 -03:00
intel-pt-decoder tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
libunwind
scripting-engines perf db-export: Export switch events 2019-07-10 12:35:38 -03:00
Build perf tools: Introduce rlimit__bump_memlock() helper 2019-07-09 14:59:11 -03:00
PERF-VERSION-GEN perf version: Append 12 git SHA chars to the version string 2019-05-28 18:37:44 -03:00
annotate.c perf annotate: Fix printing of unaugmented disassembled instructions from BPF 2019-08-08 15:40:56 -03:00
annotate.h perf annotate: Enable annotation of BPF programs 2019-03-20 16:43:15 -03:00
archinsn.h
arm-spe-pkt-decoder.c
arm-spe-pkt-decoder.h
arm-spe.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
arm-spe.h
auxtrace.c perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
auxtrace.h perf/core improvements and fixes: 2019-06-17 20:48:14 +02:00
block-range.c
block-range.h
bpf-event.c perf bpf: Show more BPF program info in print_bpf_prog_info() 2019-03-21 11:27:04 -03:00
bpf-event.h perf bpf: Show more BPF program info in print_bpf_prog_info() 2019-03-21 11:27:04 -03:00
bpf-loader.c perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
bpf-loader.h
bpf-prologue.c
bpf-prologue.h
bpf_map.c
bpf_map.h
branch.c
branch.h
build-id.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
build-id.h
cache.h
call-path.c perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
call-path.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
callchain.c perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
callchain.h
cgroup.c perf tools: Use zfree() where applicable 2019-07-09 10:13:27 -03:00
cgroup.h
cloexec.c perf tools: Remove needless asm/unistd.h include fixing build in some places 2019-05-02 16:00:20 -04:00
cloexec.h
color.c
color.h
color_config.c
comm.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
comm.h
compress.h perf report: Implement perf.data record decompression 2019-05-15 16:36:49 -03:00
config.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
config.h
counts.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
counts.h
cpu-set-sched.h
cpumap.c perf cpumap: Fix writing to illegal memory in handling cpumap mask 2019-08-08 15:41:10 -03:00
cpumap.h perf stat: Support per-die aggregation 2019-06-10 16:19:59 -03:00
cputopo.c perf tools: Use zfree() where applicable 2019-07-09 10:13:27 -03:00
cputopo.h perf header: Add die information in CPU topology 2019-06-10 15:50:02 -03:00
cs-etm.c perf cs-etm: Return errcode in cs_etm__process_auxtrace_info() 2019-07-11 12:45:02 -03:00
cs-etm.h perf cs-etm: Remove duplicate GENMASK() define, use linux/bits.h instead 2019-06-10 16:20:11 -03:00
data-convert-bt.c perf tools: Use zfree() where applicable 2019-07-09 10:13:27 -03:00
data-convert-bt.h
data-convert.h
data.c perf tools: Use zfree() where applicable 2019-07-09 10:13:27 -03:00
data.h perf record: Allow to limit number of reported perf.data files 2019-03-19 11:56:20 -03:00
db-export.c perf db-export: Export switch events 2019-07-10 12:35:38 -03:00
db-export.h perf db-export: Export switch events 2019-07-10 12:35:38 -03:00
debug.c perf tools: Add missing headers, mostly stdlib.h 2019-07-09 10:13:22 -03:00
debug.h
demangle-java.c perf tools: Add missing headers, mostly stdlib.h 2019-07-09 10:13:22 -03:00
demangle-java.h
demangle-rust.c
demangle-rust.h
dso.c perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
dso.h perf symbols: Introduce DSO_BINARY_TYPE__BPF_PROG_INFO 2019-03-19 16:52:07 -03:00
dump-insn.c
dump-insn.h
dwarf-aux.c perf tools: Add missing headers, mostly stdlib.h 2019-07-09 10:13:22 -03:00
dwarf-aux.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 156 2019-05-30 11:26:35 -07:00
dwarf-regs.c
env.c perf tools: Use zfree() where applicable 2019-07-09 10:13:27 -03:00
env.h perf header: Add die information in CPU topology 2019-06-10 15:50:02 -03:00
event.c perf tools: Use zfree() where applicable 2019-07-09 10:13:27 -03:00
event.h perf tools: Add IPC information to perf_sample 2019-06-05 09:47:55 -03:00
evlist.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
evlist.h perf mmap: Implement dedicated memory buffer for data compression 2019-05-15 16:36:49 -03:00
evsel.c perf stat: Fix segfault for event group in repeat mode 2019-07-23 09:00:05 -03:00
evsel.h perf tools: Add a 'percore' event qualifier 2019-05-16 14:17:24 -03:00
evsel_fprintf.c
expr.h
expr.y
find-map.c
genelf.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 251 2019-06-05 17:30:26 +02:00
genelf.h
genelf_debug.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 479 2019-06-19 17:09:51 +02:00
generate-cmdlist.sh
get_current_dir_name.c perf tools: Move get_current_dir_name() cond prototype out of util.h 2019-07-09 10:13:26 -03:00
get_current_dir_name.h perf tools: Move get_current_dir_name() cond prototype out of util.h 2019-07-09 10:13:26 -03:00
group.h
header.c perf header: Fix use of unitialized value warning 2019-07-29 09:03:43 -03:00
header.h perf record: Implement COMPRESSED event record and its attributes 2019-05-15 16:36:49 -03:00
help-unknown-cmd.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
help-unknown-cmd.h
hist.c perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
hist.h perf diff: Print the basic block cycles diff 2019-07-02 13:20:51 -03:00
intel-bts.c perf intel-bts: Fix potential NULL pointer dereference found by the smatch tool 2019-07-09 10:13:28 -03:00
intel-bts.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
intel-pt.c perf intel-pt: Fix potential NULL pointer dereference found by the smatch tool 2019-07-09 10:13:28 -03:00
intel-pt.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 288 2019-06-05 17:36:37 +02:00
intlist.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 305 2019-06-05 17:37:04 +02:00
intlist.h
jit.h
jitdump.c perf tools: Use zfree() where applicable 2019-07-09 10:13:27 -03:00
jitdump.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 480 2019-06-19 17:09:51 +02:00
kvm-stat.h
levenshtein.c
levenshtein.h
llvm-utils.c perf tools: Use zfree() where applicable 2019-07-09 10:13:27 -03:00
llvm-utils.h
lzma.c
machine.c perf record: Fix module size on s390 2019-08-08 15:41:11 -03:00
machine.h perf record: Fix module size on s390 2019-08-08 15:41:11 -03:00
map.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
map.h perf tools: Check maps for bpf programs 2019-04-17 14:30:11 -03:00
map_groups.h perf tests: Add map_groups__merge_in test 2019-05-28 18:37:44 -03:00
map_symbol.h
mem-events.c
mem-events.h
mem2node.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
mem2node.h
memswap.c
memswap.h
metricgroup.c perf metricgroup: Add missing list_del_init() when flushing egroups list 2019-07-09 10:13:27 -03:00
metricgroup.h
mmap.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
mmap.h perf record: Implement compression for AIO trace streaming 2019-05-15 16:36:49 -03:00
namespaces.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
namespaces.h perf namespaces: Move the conditional setns() prototype to namespaces.h 2019-07-09 10:13:26 -03:00
ordered-events.c perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
ordered-events.h
parse-branch-options.c perf tools: Add missing headers, mostly stdlib.h 2019-07-09 10:13:22 -03:00
parse-branch-options.h
parse-events.c perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
parse-events.h perf tools: Add a 'percore' event qualifier 2019-05-16 14:17:24 -03:00
parse-events.l perf tools: Add a 'percore' event qualifier 2019-05-16 14:17:24 -03:00
parse-events.y perf parse-events: Remove unused variable: error 2019-07-09 10:13:27 -03:00
parse-regs-options.c perf tools: Add missing headers, mostly stdlib.h 2019-07-09 10:13:22 -03:00
parse-regs-options.h perf parse-regs: Split parse_regs 2019-05-15 16:36:49 -03:00
path.c
path.h
perf-hooks-list.h
perf-hooks.c
perf-hooks.h
perf_regs.c perf parse-regs: Add generic support for arch__intr/user_reg_mask() 2019-05-16 14:17:12 -03:00
perf_regs.h perf record: Allow mixing --user-regs with --call-graph=dwarf 2019-06-05 09:47:54 -03:00
pmu.c perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
pmu.h
pmu.l
pmu.y
print_binary.c tools perf: Move from sane_ctype.h obtained from git to the Linux's original 2019-06-25 21:02:47 -03:00
print_binary.h
probe-event.c perf/urgent fixes: 2019-07-23 23:41:33 +02:00
probe-event.h perf-probe: Add user memory access attribute support 2019-05-25 23:04:42 -04:00
probe-file.c The main changes in this release include: 2019-07-18 11:51:00 -07:00
probe-file.h perf-probe: Add user memory access attribute support 2019-05-25 23:04:42 -04:00
probe-finder.c The main changes in this release include: 2019-07-18 11:51:00 -07:00
probe-finder.h tools perf: Move from sane_ctype.h obtained from git to the Linux's original 2019-06-25 21:02:47 -03:00
pstack.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
pstack.h
python-ext-sources tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
python.c perf tools: Add missing util.h to pick up 'page_size' variable 2019-06-25 18:35:34 -03:00
rb_resort.h
rblist.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 305 2019-06-05 17:37:04 +02:00
rblist.h
record.c
rlimit.c perf tools: Introduce rlimit__bump_memlock() helper 2019-07-09 14:59:11 -03:00
rlimit.h perf tools: Introduce rlimit__bump_memlock() helper 2019-07-09 14:59:11 -03:00
rwsem.c
rwsem.h
s390-cpumcf-kernel.h
s390-cpumsf-kernel.h
s390-cpumsf.c perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
s390-cpumsf.h
s390-sample-raw.c
sample-raw.c
sample-raw.h
session.c perf session: Fix loading of compressed data split across adjacent records 2019-07-23 09:04:03 -03:00
session.h perf session: Fix loading of compressed data split across adjacent records 2019-07-23 09:04:03 -03:00
setns.c perf namespaces: Move the conditional setns() prototype to namespaces.h 2019-07-09 10:13:26 -03:00
setup.py perf python: Remove -fstack-protector-strong if clang doesn't have it 2019-07-07 12:32:46 -03:00
smt.c perf tools: Apply new CPU topology sysfs attributes 2019-06-10 16:20:11 -03:00
smt.h
sort.c perf report: Show all sort keys in help output 2019-03-19 16:15:42 -03:00
sort.h perf diff: Use hists to manage basic blocks per symbol 2019-07-02 12:47:07 -03:00
srccode.c perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
srccode.h
srcline.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
srcline.h
stat-display.c perf stat: Don't merge events in the same PMU 2019-07-01 22:50:41 -03:00
stat-shadow.c perf stat: Always separate stalled cycles per insn 2019-07-23 09:03:46 -03:00
stat.c perf tools: Use zfree() where applicable 2019-07-09 10:13:27 -03:00
stat.h perf stat: Support per-die aggregation 2019-06-10 16:19:59 -03:00
strbuf.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
strbuf.h
strfilter.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
strfilter.h
string.c tools lib: Move argv_{split,free} from tools/perf/util/ 2019-07-01 22:50:40 -03:00
string2.h tools lib: Move argv_{split,free} from tools/perf/util/ 2019-07-01 22:50:40 -03:00
strlist.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
strlist.h
svghelper.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
svghelper.h
symbol-elf.c perf tools: Use list_del_init() more thorougly 2019-07-09 10:13:27 -03:00
symbol-minimal.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
symbol.c perf annotate: Fix s390 gap between kernel end and module start 2019-08-08 15:41:25 -03:00
symbol.h perf annotate: Fix s390 gap between kernel end and module start 2019-08-08 15:41:25 -03:00
symbol_conf.h perf diff: Print the basic block cycles diff 2019-07-02 13:20:51 -03:00
symbol_fprintf.c
syscalltbl.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
syscalltbl.h
target.c perf tools: Add missing headers, mostly stdlib.h 2019-07-09 10:13:22 -03:00
target.h
term.c
term.h
thread-stack.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
thread-stack.h perf/core improvements and fixes: 2019-06-17 20:48:14 +02:00
thread.c perf db-export: Fix thread__exec_comm() 2019-08-08 15:41:10 -03:00
thread.h perf tools: Remove const from thread read accessors 2019-05-28 18:37:43 -03:00
thread_map.c perf tools: Use zfree() where applicable 2019-07-09 10:13:27 -03:00
thread_map.h
time-utils.c perf time-utils: Use skip_spaces() 2019-06-25 21:39:18 -03:00
time-utils.h perf time-utils: Add utility function to print time stamps in nanoseconds 2019-03-11 11:56:02 -03:00
tool.h perf report: Add stub processing of compressed events for -D 2019-05-15 16:36:49 -03:00
top.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 251 2019-06-05 17:30:26 +02:00
top.h
trace-event-info.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
trace-event-parse.c tools perf: Move from sane_ctype.h obtained from git to the Linux's original 2019-06-25 21:02:47 -03:00
trace-event-read.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 393 2019-06-05 17:37:11 +02:00
trace-event-scripting.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
trace-event.c tools tools, tools lib traceevent: Make traceevent APIs more consistent 2019-04-01 15:18:09 -03:00
trace-event.h perf script: Add scripting operation process_switch() 2019-07-10 12:34:09 -03:00
trigger.h
tsc.c
tsc.h
units.c
units.h
unwind-libdw.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
unwind-libdw.h
unwind-libunwind-local.c perf tools: Use zfree() where applicable 2019-07-09 10:13:27 -03:00
unwind-libunwind.c perf tools: Speed up report for perf compiled with linwunwind 2019-05-15 16:36:46 -03:00
unwind.h
usage.c perf tools: Add missing headers, mostly stdlib.h 2019-07-09 10:13:22 -03:00
util-cxx.h
util.c perf kallsyms: Adopt hex2u64 from tools/perf/util/util.h 2019-06-25 18:13:17 -03:00
util.h tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
values.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
values.h
vdso.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
vdso.h
xyarray.c tools lib: Adopt zalloc()/zfree() from tools/perf 2019-07-09 10:13:26 -03:00
xyarray.h
zlib.c
zstd.c perf session: Fix loading of compressed data split across adjacent records 2019-07-23 09:04:03 -03:00