lkml.org 
[lkml]   [2015]   [Nov]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Subject[PATCH perf/core 08/13] perf: Fix to put new map after inserting to map_groups in dso__load_sym
    From
    Date
    Fix dso__load_sym to put the map object which is already
    insterted to kmaps.

    Refcnt debugger shows
    ==== [0] ====
    Unreclaimed map: 0x39113e0
    Refcount +1 => 1 at
    ./perf(map__new2+0xb5) [0x4be155]
    ./perf(dso__load_sym+0xee1) [0x503461]
    ./perf(dso__load_vmlinux+0xbf) [0x4aa6df]
    ./perf(dso__load_vmlinux_path+0x8c) [0x4aa83c]
    ./perf() [0x50528a]
    ./perf(convert_perf_probe_events+0xd79) [0x50ac29]
    ./perf() [0x45600f]
    ./perf(cmd_probe+0x6c) [0x4566bc]
    ./perf() [0x47abc5]
    ./perf(main+0x610) [0x421f90]
    /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f152368baf5]
    ./perf() [0x4220a9]
    Refcount +1 => 2 at
    ./perf(maps__insert+0x9a) [0x4bfffa]
    ./perf(dso__load_sym+0xf89) [0x503509]
    ./perf(dso__load_vmlinux+0xbf) [0x4aa6df]
    ./perf(dso__load_vmlinux_path+0x8c) [0x4aa83c]
    ./perf() [0x50528a]
    ./perf(convert_perf_probe_events+0xd79) [0x50ac29]
    ./perf() [0x45600f]
    ./perf(cmd_probe+0x6c) [0x4566bc]
    ./perf() [0x47abc5]
    ./perf(main+0x610) [0x421f90]
    /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f152368baf5]
    ./perf() [0x4220a9]
    Refcount -1 => 1 at
    ./perf(map_groups__exit+0x94) [0x4bed04]
    ./perf(machine__delete+0xb0) [0x4b9300]
    ./perf(exit_probe_symbol_maps+0x28) [0x506608]
    ./perf() [0x45628a]
    ./perf(cmd_probe+0x6c) [0x4566bc]
    ./perf() [0x47abc5]
    ./perf(main+0x610) [0x421f90]
    /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f152368baf5]
    ./perf() [0x4220a9]

    This means that the dso__load_sym calls map__new2 and maps_insert,
    both of them get the map, but the map will be put at map_groups__exit
    just once.
    Thus, dso__load_sym has to put the map right after inserting it to
    kmaps.

    Signed-off-by: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    ---
    tools/perf/util/symbol-elf.c | 2 ++
    1 file changed, 2 insertions(+)

    diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
    index 475d88d..53f1996 100644
    --- a/tools/perf/util/symbol-elf.c
    +++ b/tools/perf/util/symbol-elf.c
    @@ -1042,6 +1042,8 @@ int dso__load_sym(struct dso *dso, struct map *map,
    }
    curr_dso->symtab_type = dso->symtab_type;
    map_groups__insert(kmaps, curr_map);
    + /* kmaps already got it */
    + map__put(curr_map);
    dsos__add(&map->groups->machine->dsos, curr_dso);
    dso__set_loaded(curr_dso, map->type);
    } else


    \
     
     \ /
      Last update: 2015-11-18 08:01    [W:6.804 / U:0.012 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site