Re: [PATCH 0/4] perf tools: Fix kmap handling

From: Kim Phillips
Date: Mon Feb 10 2020 - 11:47:17 EST


On 2/10/20 8:32 AM, Jiri Olsa wrote:
> hi,
> Ravi Bangoria reported crash in perf top due to wrong kmap
> objects management, this patchset should fix that.
>
> thanks,
> jirka
>
>
> ---
> Jiri Olsa (4):
> perf tools: Mark modules dsos with kernel type
> perf tools: Mark ksymbol dsos with kernel type
> perf tools: Fix map__clone for struct kmap
> perf tools: Move kmap::kmaps setup to maps__insert
>
> tools/perf/util/machine.c | 24 ++++++++++--------------
> tools/perf/util/map.c | 17 ++++++++++++++++-
> 2 files changed, 26 insertions(+), 15 deletions(-)
>

This series fixes a segmentation fault I was seeing on a
couple of AMD systems, so:

Tested-by: Kim Phillips <kim.phillips@xxxxxxx>

Thanks,

Kim

Thread 259 "perf" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff3b7b6700 (LWP 13241)]
__map__is_kernel (map=0x7fffd80098d0) at util/map.c:244
244 return machine__kernel_map(map__kmaps((struct map *)map)->machine) == map;
(gdb) bt
#0 __map__is_kernel (map=0x7fffd80098d0) at util/map.c:244
#1 0x000055555575d756 in perf_event__process_sample (machine=<optimized out>, sample=0x7fff3b7b5710,
evsel=0x555555ef9dd0, event=<optimized out>, tool=0x7fffffff8660) at builtin-top.c:799
#2 deliver_event (qe=<optimized out>, qevent=<optimized out>) at builtin-top.c:1192
#3 0x0000555555831f81 in do_flush (show_progress=false, oe=0x7fffffff8960) at util/ordered-events.c:244
#4 __ordered_events__flush (oe=oe@entry=0x7fffffff8960, how=how@entry=OE_FLUSH__TOP, timestamp=timestamp@entry=0)
at util/ordered-events.c:323
#5 0x00005555558328df in __ordered_events__flush (timestamp=<optimized out>, how=<optimized out>, oe=<optimized out>)
at util/ordered-events.c:342
#6 ordered_events__flush (oe=oe@entry=0x7fffffff8960, how=how@entry=OE_FLUSH__TOP) at util/ordered-events.c:341
#7 0x000055555575d0f1 in process_thread (arg=0x7fffffff8660) at builtin-top.c:1104
#8 0x00007ffff7bbd6db in start_thread (arg=0x7fff3b7b6700) at pthread_create.c:463
#9 0x00007ffff5d9788f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
(gdb) p map
$1 = (const struct map *) 0x7fffd80098d0