1. 19 7月, 2017 2 次提交
  2. 03 5月, 2017 1 次提交
    • P
      perf symbols: Allow user probes on versioned symbols · d8040645
      Paul Clarke 提交于
      Symbol versioning, as in glibc, results in symbols being defined as:
      
        <real symbol>@[@]<version>
      
      (Note that "@@" identifies a default symbol, if the symbol name is
      repeated.)
      
      perf is currently unable to deal with this, and is unable to create user
      probes at such symbols:
      
        --
        $ nm /lib/powerpc64le-linux-gnu/libpthread.so.0 | grep pthread_create
        0000000000008d30 t __pthread_create_2_1
        0000000000008d30 T pthread_create@@GLIBC_2.17
        $ /usr/bin/sudo perf probe -v -x /lib/powerpc64le-linux-gnu/libpthread.so.0 pthread_create
        probe-definition(0): pthread_create
        symbol:pthread_create file:(null) line:0 offset:0 return:0 lazy:(null)
        0 arguments
        Open Debuginfo file: /usr/lib/debug/lib/powerpc64le-linux-gnu/libpthread-2.19.so
        Try to find probe point from debuginfo.
        Probe point 'pthread_create' not found.
           Error: Failed to add events. Reason: No such file or directory (Code: -2)
        --
      
      One is not able to specify the fully versioned symbol, either, due to
      syntactic conflicts with other uses of "@" by perf:
      
        --
        $ /usr/bin/sudo perf probe -v -x /lib/powerpc64le-linux-gnu/libpthread.so.0 pthread_create@@GLIBC_2.17
        probe-definition(0): pthread_create@@GLIBC_2.17
        Semantic error :SRC@SRC is not allowed.
        0 arguments
           Error: Command Parse Error. Reason: Invalid argument (Code: -22)
        --
      
      This patch ignores versioning for default symbols, thus allowing probes to be
      created for these symbols:
      
        --
        $ /usr/bin/sudo ./perf probe -x /lib/powerpc64le-linux-gnu/libpthread.so.0 pthread_create
        Added new event:
           probe_libpthread:pthread_create (on pthread_create in /lib/powerpc64le-linux-gnu/libpthread-2.19.so)
      
        You can now use it in all perf tools, such as:
      
                 perf record -e probe_libpthread:pthread_create -aR sleep 1
      
        $ /usr/bin/sudo ./perf record -e probe_libpthread:pthread_create -aR ./test 2
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.052 MB perf.data (2 samples) ]
        $ /usr/bin/sudo ./perf script
                     test  2915 [000] 19124.260729: probe_libpthread:pthread_create: (3fff99248d38)
                     test  2916 [000] 19124.260962: probe_libpthread:pthread_create: (3fff99248d38)
        $ /usr/bin/sudo ./perf probe --del=probe_libpthread:pthread_create
        Removed event: probe_libpthread:pthread_create
        --
      
      Committer note:
      
      Change the variable storing the result of strlen() to 'int', to fix the build
      on debian:experimental-x-mipsel, fedora:24-x-ARC-uClibc, ubuntu:16.04-x-arm,
      etc:
      
        util/symbol.c: In function 'symbol__match_symbol_name':
        util/symbol.c:422:11: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
           if (len < versioning - name)
                   ^
      Signed-off-by: NPaul A. Clarke <pc@us.ibm.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NMasami Hiramatsu <mhiramat@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Link: http://lkml.kernel.org/r/c2b18d9c-17f8-9285-4868-f58b6359ccac@us.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d8040645
  3. 20 4月, 2017 2 次提交
  4. 27 3月, 2017 1 次提交
    • M
      perf report: Enable sorting by srcline as key · 5dfa210e
      Milian Wolff 提交于
      Often it is interesting to know how costly a given source line is in
      total. Previously, one had to build these sums manually based on all
      addresses that pointed to the same source line. This patch introduces
      srcline as a sort key, which will do the aggregation for us.
      
      Paired with the recent addition of showing inline frames, this makes
      perf report much more useful for many C++ work loads.
      
      The following shows the new feature in action. First, let's show the
      status quo output when we sort by address. The result contains many hist
      entries that generate the same output:
      
        ~~~~~~~~~~~~~~~~
        $ perf report --stdio --inline -g address
        # Children      Self  Command       Shared Object        Symbol
        # ........  ........  ............  ...................  .........................................
        #
            99.89%    35.34%  cpp-inlining  cpp-inlining         [.] main
                  |
                  |--64.55%--main complex:655
                  |          /home/milian/projects/kdab/rnd/hotspot/tests/test-clients/cpp-inlining/main.cpp:39 (inline)
                  |          /usr/include/c++/6.3.1/complex:664 (inline)
                  |          |
                  |          |--60.31%--hypot +20
                  |          |          |
                  |          |          |--8.52%--__hypot_finite +273
                  |          |          |
                  |          |          |--7.32%--__hypot_finite +411
      ...
                   --35.34%--_start +4194346
                             __libc_start_main +241
                             |
                             |--6.65%--main random.tcc:3326
                             |          /home/milian/projects/kdab/rnd/hotspot/tests/test-clients/cpp-inlining/main.cpp:39 (inline)
                             |          /usr/include/c++/6.3.1/bits/random.h:1809 (inline)
                             |          /usr/include/c++/6.3.1/bits/random.h:1818 (inline)
                             |          /usr/include/c++/6.3.1/bits/random.h:185 (inline)
                             |
                             |--2.70%--main random.tcc:3326
                             |          /home/milian/projects/kdab/rnd/hotspot/tests/test-clients/cpp-inlining/main.cpp:39 (inline)
                             |          /usr/include/c++/6.3.1/bits/random.h:1809 (inline)
                             |          /usr/include/c++/6.3.1/bits/random.h:1818 (inline)
                             |          /usr/include/c++/6.3.1/bits/random.h:185 (inline)
                             |
                             |--1.69%--main random.tcc:3326
                             |          /home/milian/projects/kdab/rnd/hotspot/tests/test-clients/cpp-inlining/main.cpp:39 (inline)
                             |          /usr/include/c++/6.3.1/bits/random.h:1809 (inline)
                             |          /usr/include/c++/6.3.1/bits/random.h:1818 (inline)
                             |          /usr/include/c++/6.3.1/bits/random.h:185 (inline)
        ...
        ~~~~~~~~~~~~~~~~
      
      With this patch and `-g srcline` we instead get the following output:
      
        ~~~~~~~~~~~~~~~~
        $ perf report --stdio --inline -g srcline
        # Children      Self  Command       Shared Object        Symbol
        # ........  ........  ............  ...................  .........................................
        #
            99.89%    35.34%  cpp-inlining  cpp-inlining         [.] main
                  |
                  |--64.55%--main complex:655
                  |          /home/milian/projects/kdab/rnd/hotspot/tests/test-clients/cpp-inlining/main.cpp:39 (inline)
                  |          /usr/include/c++/6.3.1/complex:664 (inline)
                  |          |
                  |          |--64.02%--hypot
                  |          |          |
                  |          |           --59.81%--__hypot_finite
                  |          |
                  |           --0.53%--cabs
                  |
                   --35.34%--_start
                             __libc_start_main
                             |
                             |--12.48%--main random.tcc:3326
                             |          /home/milian/projects/kdab/rnd/hotspot/tests/test-clients/cpp-inlining/main.cpp:39 (inline)
                             |          /usr/include/c++/6.3.1/bits/random.h:1809 (inline)
                             |          /usr/include/c++/6.3.1/bits/random.h:1818 (inline)
                             |          /usr/include/c++/6.3.1/bits/random.h:185 (inline)
        ...
        ~~~~~~~~~~~~~~~~
      Signed-off-by: NMilian Wolff <milian.wolff@kdab.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Yao Jin <yao.jin@linux.intel.com>
      Link: http://lkml.kernel.org/r/20170318214928.9047-1-milian.wolff@kdab.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5dfa210e
  5. 04 3月, 2017 2 次提交
  6. 14 2月, 2017 1 次提交
  7. 24 10月, 2016 1 次提交
  8. 14 9月, 2016 1 次提交
    • A
      perf tools: Do hugetlb handling in more systems · fbef103f
      Arnaldo Carvalho de Melo 提交于
      The csets:
      
        0ac3348e ("perf tools: Recognize hugetlb mapping as anon mapping")
        d7e404af ("perf record: Mark MAP_HUGETLB when synthesizing mmap events")
      
      Added code conditional on MAP_HUGETLB, to make it build in older systems
      where that define wasn't available. Now that we grabbed copies of
      uapi/linux/mmap.h to have all those definitions in tools/, use it so
      that we can support building the tools for older systems (without the
      MAP_HUGETLB define in its libc headers) using new kernels that support
      such maps.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Link: http://lkml.kernel.org/n/tip-wv6oqbfkpxbix4umj2kcfmaz@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fbef103f
  9. 08 9月, 2016 1 次提交
  10. 05 9月, 2016 1 次提交
  11. 19 7月, 2016 1 次提交
  12. 05 7月, 2016 1 次提交
  13. 12 5月, 2016 1 次提交
  14. 08 4月, 2016 1 次提交
    • W
      perf symbols: Record text offset in dso to calculate objdump address · a58f7033
      Wang Nan 提交于
      In this patch, the offset of '.text' section is stored into dso
      and used here to re-calculate address to objdump.
      
      In most of the cases, executable code is in '.text' section, so the
      adjustment made to a symbol in dso__load_sym (using
      sym.st_value -= shdr.sh_addr - shdr.sh_offset) should equal to
      'sym.st_value -= dso->text_offset'. Therefore, adding text_offset back
      get objdump address from symbol address (rip). However, it is not true
      for kernel and kernel module since there could be multiple executable
      sections with different offset. Exclude kernel for this reason.
      
      After this patch, even dso->adjust_symbols is set to true for shared
      objects, map__rip_2objdump() and map__objdump_2mem() would return
      correct result, so perf behavior of annotate won't be changed.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Cody P Schafer <dev@codyps.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kirill Smelkov <kirr@nexedi.com>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1460024671-64774-2-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a58f7033
  15. 10 12月, 2015 2 次提交
    • M
      perf tools: Fix maps__fixup_overlappings to put used maps · d91130e9
      Masami Hiramatsu 提交于
      Since the __map_groups__insert got the given map, we don't need to keep
      it. So put the maps.
      
      Refcnt debugger shows that map_groups__fixup_overlappings() got a map
      twice but the group released it just once. This pattern usually
      indicates the leak happens in caller site.
      
        ----
        ==== [0] ====
        Unreclaimed map@0x39d3ae0
        Refcount +1 => 1 at
          ./perf(map_groups__fixup_overlappings+0x335) [0x4c1865]
          ./perf(thread__insert_map+0x30) [0x4c8e00]
          ./perf(machine__process_mmap2_event+0x106) [0x4bd876]
          ./perf() [0x4c378e]
          ./perf() [0x4c4393]
          ./perf(perf_session__process_events+0x38a) [0x4c654a]
          ./perf(cmd_record+0xe24) [0x42fc94]
          ./perf() [0x47b745]
          ./perf(main+0x617) [0x422547]
          /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f2eca2deaf5]
          ./perf() [0x4226bd]
        Refcount +1 => 2 at
          ./perf(map_groups__fixup_overlappings+0x3c5) [0x4c18f5]
          ./perf(thread__insert_map+0x30) [0x4c8e00]
          ./perf(machine__process_mmap2_event+0x106) [0x4bd876]
          ./perf() [0x4c378e]
          ./perf() [0x4c4393]
          ./perf(perf_session__process_events+0x38a) [0x4c654a]
          ./perf(cmd_record+0xe24) [0x42fc94]
          ./perf() [0x47b745]
          ./perf(main+0x617) [0x422547]
          /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f2eca2deaf5]
          ./perf() [0x4226bd]
        Refcount -1 => 1 at
          ./perf(map_groups__exit+0x92) [0x4c0962]
          ./perf(map_groups__put+0x60) [0x4c0bc0]
          ./perf(thread__put+0x90) [0x4c8a40]
          ./perf(machine__delete_threads+0x7e) [0x4bad9e]
          ./perf(perf_session__delete+0x4f) [0x4c499f]
          ./perf(cmd_record+0xb6d) [0x42f9dd]
          ./perf() [0x47b745]
          ./perf(main+0x617) [0x422547]
          /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f2eca2deaf5]
          ./perf() [0x4226bd]
        ----
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20151209021131.10245.41485.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d91130e9
    • M
      perf tools: Fix map_groups__clone to put cloned map · bae32b50
      Masami Hiramatsu 提交于
      Fix map_groups__clone to put cloned map after inserting it to the
      map_groups.
      
      Refcnt debugger shows:
        ----
        ==== [0] ====
        Unreclaimed map: 0x2a27ee0
        Refcount +1 => 1 at
          ./perf(map_groups__clone+0x8d) [0x4bb7ed]
          ./perf(thread__fork+0xbe) [0x4c1f9e]
          ./perf(machine__process_fork_event+0x216) [0x4b79a6]
          ./perf(perf_event__synthesize_threads+0x38b) [0x48135b]
          ./perf(cmd_top+0xdc6) [0x43cb76]
          ./perf() [0x477223]
          ./perf(main+0x617) [0x422077]
          /lib64/libc.so.6(__libc_start_main+0xf0) [0x7ff806af8fe0]
          ./perf() [0x4221ed]
        Refcount +1 => 2 at
          ./perf(map_groups__clone+0x128) [0x4bb888]
          ./perf(thread__fork+0xbe) [0x4c1f9e]
          ./perf(machine__process_fork_event+0x216) [0x4b79a6]
          ./perf(perf_event__synthesize_threads+0x38b) [0x48135b]
          ./perf(cmd_top+0xdc6) [0x43cb76]
          ./perf() [0x477223]
          ./perf(main+0x617) [0x422077]
          /lib64/libc.so.6(__libc_start_main+0xf0) [0x7ff806af8fe0]
          ./perf() [0x4221ed]
        Refcount -1 => 1 at
          ./perf(map_groups__exit+0x87) [0x4ba757]
          ./perf(map_groups__put+0x68) [0x4ba9a8]
          ./perf(thread__put+0x8b) [0x4c1aeb]
          ./perf(machine__delete_threads+0x81) [0x4b48f1]
          ./perf(perf_session__delete+0x4f) [0x4be63f]
          ./perf(cmd_top+0x1094) [0x43ce44]
          ./perf() [0x477223]
          ./perf(main+0x617) [0x422077]
          /lib64/libc.so.6(__libc_start_main+0xf0) [0x7ff806af8fe0]
          ./perf() [0x4221ed]
        ----
      
      This shows map_groups__clone get the map twice and put it when
      map_groups__exit.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20151209021120.10245.95388.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bae32b50
  16. 27 11月, 2015 1 次提交
  17. 05 11月, 2015 1 次提交
    • J
      perf tools: Insert split maps correctly into origin group · cb8382e0
      Jiri Olsa 提交于
      When new maps are cloned out of split map they are added into origin
      map's group, but their groups pointer is not updated.
      
      This could lead to a segfault, because map->groups is expected to be
      always set as reported by Markus:
      
        __map__is_kernel (map=map@entry=0x1abb7a0) at util/map.c:238
        238             return __machine__kernel_map(map->groups->machine, map->type) =
        (gdb) bt
        #0  __map__is_kernel (map=map@entry=0x1abb7a0) at util/map.c:238
        #1  0x00000000004393e4 in symbol_filter (map=map@entry=0x1abb7a0, sym=sym@entry
        #2  0x00000000004fcd4d in dso__load_sym (dso=dso@entry=0x166dae0, map=map@entry
        #3  0x00000000004a64e0 in dso__load (dso=0x166dae0, map=map@entry=0x1abb7a0, fi
        #4  0x00000000004b941f in map__load (filter=0x4393c0 <symbol_filter>, map=<opti
        #5  map__find_symbol (map=0x1abb7a0, addr=40188, filter=0x4393c0 <symbol_filter
        ...
      
      Adding __map_groups__insert function to add map into groups together
      with map->groups pointer update. It takes no lock as opposed to existing
      map_groups__insert, as maps__fixup_overlappings(), where it is being
      called, already has the necessary lock held.
      
      Using __map_groups__insert to add new maps after map split.
      Reported-by: NMarkus Trippelsdorf <markus@trippelsdorf.de>
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NMarkus Trippelsdorf <markus@trippelsdorf.de>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20151104140811.GA32664@krava.brq.redhat.com
      Fixes: cfc5acd4 ("perf top: Filter symbols based on __map__is_kernel(map)")
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cb8382e0
  18. 01 10月, 2015 3 次提交
  19. 21 8月, 2015 1 次提交
  20. 23 7月, 2015 1 次提交
  21. 16 6月, 2015 1 次提交
  22. 08 6月, 2015 1 次提交
    • A
      perf tools: Reference count struct dso · d3a7c489
      Arnaldo Carvalho de Melo 提交于
      This has a different model than the 'thread' and 'map' struct lifetimes:
      there is not a definitive "don't use this DSO anymore" event, i.e. we may
      get many 'struct map' holding references to the '/usr/lib64/libc-2.20.so'
      DSO but then at some point some DSO may have no references but we still
      don't want to straight away release its resources, because "soon" we may
      get a new 'struct map' that needs it and we want to reuse its symtab or
      other resources.
      
      So we need some way to garbage collect it when crossing some memory
      usage threshold, which is left for anoter patch, for now it is
      sufficient to release it when calling dsos__exit(), i.e. when deleting
      the whole list as part of deleting the 'struct machine' containing it,
      which will leave only referenced objects being used.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/n/tip-majzgz07cm90t2tejrjy4clf@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d3a7c489
  23. 29 5月, 2015 3 次提交
  24. 28 5月, 2015 4 次提交
  25. 27 5月, 2015 3 次提交
  26. 16 5月, 2015 1 次提交
  27. 04 5月, 2015 1 次提交