1. 31 5月, 2016 3 次提交
  2. 27 5月, 2016 1 次提交
  3. 20 5月, 2016 1 次提交
  4. 17 5月, 2016 1 次提交
  5. 12 5月, 2016 2 次提交
  6. 11 5月, 2016 1 次提交
    • C
      perf symbols: Add dso__insert_symbol function · ae93a6c7
      Chris Phlipot 提交于
      The current method for inserting symbols is to use the symbols__insert()
      function. However symbols__insert() does not update the dso symbol
      cache.  This causes problems in the following scenario:
      
      1. symbol not found at addr using dso__find_symbol
      
      2. symbol inserted at addr using the existing symbols__insert function
      
      3. symbol still not found at addr using dso__find_symbol() because cache isn't
         updated. This is undesired behavior.
      
      The undesired behavior in (3) is addressed by creating a new function,
      dso__insert_symbol() to both insert the symbol and update the symbol
      cache if necessary.
      
      If dso__insert_symbol() is used in (2) instead of symbols__insert(),
      then the undesired behavior in (3) is avoided.
      Signed-off-by: NChris Phlipot <cphlipot0@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1462937209-6032-2-git-send-email-cphlipot0@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ae93a6c7
  7. 10 5月, 2016 1 次提交
    • C
      perf symbols: Fix handling of zero-length symbols. · 9c7b37cd
      Chris Phlipot 提交于
      This change introduces a fix to symbols__find, so that it is able to
      find symbols of length zero (where start == end).
      
      The current code has the following problem:
      
      - The current implementation of symbols__find is unable to find any symbols
        of length zero.
      
      - The db-export framework explicitly creates zero length symbols at
        locations where no symbol currently exists.
      
      The combination of the two above behaviors results in behavior similar
      to the example below.
      
      1. addr_location is created for a sample, but symbol is unable to be
         resolved.
      
      2. db export creates an "unknown" symbol of length zero at that address
         and inserts it into the dso.
      
      3. A new sample comes in at the same address, but symbol__find is unable
         to find the zero length symbol, so it is still unresolved.
      
      4. db export sees the symbol is unresolved, and allocated a duplicate
         symbol, even though it already did this in step 2.
      
      This behavior continues every time an address without symbol information
      is seen, which causes a very large number of these symbols to be
      allocated.
      
      The effect of this fix can be observed by looking at the contents of an
      exported database before/after the fix (generated with
      scripts/python/export-to-postgresql.py)
      
      Ex.
      BEFORE THE CHANGE:
      
        example_db=# select count(*) from symbols;
         count
        --------
         900213
        (1 row)
      
        example_db=# select count(*) from symbols where symbols.name='unknown';
         count
        --------
         897355
        (1 row)
      
        example_db=# select count(*) from symbols where symbols.name!='unknown';
         count
        -------
          2858
        (1 row)
      
      AFTER THE CHANGE:
      
        example_db=# select count(*) from symbols;
         count
        -------
         25217
        (1 row)
      
        example_db=# select count(*) from symbols where name='unknown';
         count
        -------
         22359
        (1 row)
      
        example_db=# select count(*) from symbols where name!='unknown';
         count
        -------
          2858
        (1 row)
      Signed-off-by: NChris Phlipot <cphlipot0@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1462612620-25008-1-git-send-email-cphlipot0@gmail.com
      [ Moved the test to later in the rb_tree tests, as this not the likely case ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9c7b37cd
  8. 19 4月, 2016 1 次提交
  9. 15 4月, 2016 1 次提交
  10. 12 4月, 2016 1 次提交
    • A
      perf evsel: Allow unresolved symbol names to be printed as addresses · fd4be130
      Arnaldo Carvalho de Melo 提交于
      The fprintf_sym() and fprintf_callchain() methods now allow users to
      change the existing behaviour of showing "[unknown]" as the name of
      unresolved symbols to instead show "[0x123456]", i.e. its address.
      
      The current patch doesn't change tools to use this facility, the results
      from 'perf trace' and 'perf script' cotinue like:
      
      70.109 ( 0.001 ms): qemu-system-x8/10153 poll(ufds: 0x7f2d93ffe870, nfds: 1) = 0 Timeout
                                         [unknown] (/usr/lib64/libc-2.22.so)
                                         [unknown] (/usr/lib64/libspice-server.so.1.10.0)
                                         [unknown] (/usr/lib64/libspice-server.so.1.10.0)
                                         [unknown] (/usr/lib64/libspice-server.so.1.10.0)
                                         start_thread+0xca (/usr/lib64/libpthread-2.22.so)
                                         __clone+0x6d (/usr/lib64/libc-2.22.so)
      
      The next patch will make 'perf trace' use the new formatting.
      Suggested-by: NMilian Wolff <milian.wolff@kdab.com>
      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>
      Link: http://lkml.kernel.org/n/tip-fja1ods5vqpg42mdz09xcz3r@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      fd4be130
  11. 12 2月, 2016 1 次提交
    • W
      perf symbols: Fix symbols searching for module in buildid-cache · e7ee4047
      Wang Nan 提交于
      Before this patch, if a sample is triggered inside a module not in
      /lib/modules/`uname -r`/, even if the module is in buildid-cache, 'perf
      report' will still be unable to find the correct symbol.  For example:
      
        # rm -rf ~/.debug/
        # perf buildid-cache -a ./mymodule.ko
        # perf probe -m ./mymodule.ko -a get_mymodule_val
        Added new event:
          probe:get_mymodule_val (on get_mymodule_val in mymodule)
      
        You can now use it in all perf tools, such as:
      
       	perf record -e probe:get_mymodule_val -aR sleep 1
      
        # perf record -e probe:get_mymodule_val cat /proc/mymodule
        mymodule:3
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.011 MB perf.data (1 samples) ]
      
        # perf report --stdio
        [SNIP]
        #
        # Overhead  Command  Shared Object     Symbol
        # ........  .......  ................  ......................
        #
          100.00%  cat      [mymodule]        [k] 0x0000000000000001
      
        # perf report -vvvv --stdio
        dso__load_sym: adjusting symbol: st_value: 0 sh_addr: 0 sh_offset: 0x70
        symbol__new: get_mymodule_val 0x70-0x8a
        [SNIP]
      
      This is caused by dso__load() -> dso__load_sym(). In dso__load(), kmod
      is true only when its file is found in some well know directories. All
      files loaded from buildid-cache are treated as user programs. Following
      dso__load_sym() set map->pgoff incorrectly.
      
      This patch gives kernel modules in buildid-cache a chance to adjust
      value of kmod. After dso__load() get the type of symbols, if it is
      buildid, check the last 3 chars of original filename against '.ko', and
      adjust the value of kmod if the file is a kernel module.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Cody P Schafer <dev@codyps.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jeremie Galarneau <jeremie.galarneau@efficios.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: Peter Zijlstra <peterz@infradead.org>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1454680939-24963-3-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e7ee4047
  12. 26 1月, 2016 1 次提交
  13. 16 1月, 2016 1 次提交
  14. 08 1月, 2016 1 次提交
    • N
      perf report: Change default to use event group view · 1e9abf8b
      Namhyung Kim 提交于
      The event group view feature is to see related events together.  To use
      the group view, events should be recorded as a group with a dedicated
      syntax of surrounding events by braces (-e '{ evt1, evt2, ... }').
      
      Also 'perf report' also requires the --group option to enable it.
      However it's almost always beneficial to use the group view to see the
      group events as it's more expressive.  And I think it's more natural to
      see events together if they are recorded as a group.
      
      Thus this patch changes the default value to enable it.  If users don't
      want to see like it and keep the original behavior, they can set the
      report.group config variable to false and/or use --no-group option in
      the 'perf report' command line.
      Requested-by: NIngo Molnar <mingo@kernel.org>
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Taeung Song <treeze.taeung@gmail.com>
      Link: http://lkml.kernel.org/r/1448807057-3506-1-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1e9abf8b
  15. 27 11月, 2015 2 次提交
  16. 13 11月, 2015 2 次提交
  17. 28 10月, 2015 2 次提交
  18. 13 10月, 2015 1 次提交
    • A
      perf symbols: Try the .debug/ DSO cache as a last resort · dc38218e
      Arnaldo Carvalho de Melo 提交于
      Not as the first attempt at finding a vmlinux for the running kernel,
      this way we get a more informative filename to present in tools, it will
      check that the build-id is the same as the one previously loaded in the
      DSO in dso->build_id, reading from /sys/kernel/notes, for instance.
      
      E.g. in the annotation TUI, going from 'perf top', for the scsi_sg_alloc
      kernel function, in the first line:
      
      Before:
      
      scsi_sg_alloc  /root/.debug/.build-id/28/2777c262e6b3c0451375163c9a81c893218ab1
      
      After:
      
      scsi_sg_alloc  /lib/modules/4.3.0-rc1+/build/vmlinux
      
      And:
      
        # ls -la /root/.debug/.build-id/28/2777c262e6b3c0451375163c9a81c893218ab1
      lrwxrwxrwx. 1 root root 81 Sep 22 16:11 /root/.debug/.build-id/28/2777c262e6b3c0451375163c9a81c893218ab1 -> ../../home/git/build/v4.3.0-rc1+/vmlinux/282777c262e6b3c0451375163c9a81c893218ab1
        # file ~/.debug/home/git/build/v4.3.0-rc1+/vmlinux/282777c262e6b3c0451375163c9a81c893218ab1
      /root/.debug/home/git/build/v4.3.0-rc1+/vmlinux/282777c262e6b3c0451375163c9a81c893218ab1: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=282777c262e6b3c0451375163c9a81c893218ab1, not stripped
        #
      
      The same as:
      
        # file /lib/modules/4.3.0-rc1+/build/vmlinux
      /lib/modules/4.3.0-rc1+/build/vmlinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, BuildID[sha1]=282777c262e6b3c0451375163c9a81c893218ab1, not stripped
      
      Furthermore:
      
        # sha256sum /lib/modules/4.3.0-rc1+/build/vmlinux
        e7a789bbdc61029ec09140c228e1dd651271f38ef0b8416c0b7d5ff727b98be2  /lib/modules/4.3.0-rc1+/build/vmlinux
        # sha256sum ~/.debug/home/git/build/v4.3.0-rc1+/vmlinux/282777c262e6b3c0451375163c9a81c893218ab1
        e7a789bbdc61029ec09140c228e1dd651271f38ef0b8416c0b7d5ff727b98be2  /root/.debug/home/git/build/v4.3.0-rc1+/vmlinux/282777c262e6b3c0451375163c9a81c893218ab1
        [root@zoo new]#
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-9y42ikzq3jisiddoi6f07n8z@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      dc38218e
  19. 01 10月, 2015 1 次提交
  20. 29 8月, 2015 1 次提交
  21. 25 8月, 2015 1 次提交
    • A
      perf annotate: Reset the dso find_symbol cache when removing symbols · c0b4dffb
      Arnaldo Carvalho de Melo 提交于
      The 'annotate' tool does some filtering in the entries in a DSO but
      forgot to reset the cache done in dso__find_symbol(), cauxing a SEGV:
      
        [root@zoo ~]# perf annotate netlink_poll
        perf: Segmentation fault
        -------- backtrace --------
        perf[0x526ceb]
        /lib64/libc.so.6(+0x34960)[0x7faedfbe0960]
        perf(rb_erase+0x223)[0x499d63]
        perf[0x4213e9]
        perf[0x4bc123]
        perf[0x4bc621]
        perf[0x4bf26b]
        perf[0x4bc855]
        perf(perf_session__process_events+0x340)[0x4bddc0]
        perf(cmd_annotate+0x6bb)[0x421b5b]
        perf[0x479063]
        perf(main+0x60a)[0x42098a]
        /lib64/libc.so.6(__libc_start_main+0xf0)[0x7faedfbcbfe0]
        perf[0x420aa9]
        [0x0]
        [root@zoo ~]#
      
      Fix it by reseting the find cache when removing symbols.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Fixes: b685ac22 ("perf symbols: Add front end cache for DSO symbol lookup")
      Link: http://lkml.kernel.org/n/tip-b2y9x46y0t8yem1ive41zqyp@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c0b4dffb
  22. 21 8月, 2015 1 次提交
  23. 23 7月, 2015 1 次提交
  24. 20 7月, 2015 1 次提交
  25. 13 7月, 2015 1 次提交
    • A
      perf symbols: Store if there is a filter in place · 0bc2f2f7
      Arnaldo Carvalho de Melo 提交于
      When setting yup the symbols library we setup several filter lists,
      for dsos, comms, symbols, etc, and there is code that, if there are
      filters, do certain operations, like recalculate the number of non
      filtered histogram entries in the top/report TUI.
      
      But they were considering just the "Zoom" filters, when they need to
      take into account as well the above mentioned filters (perf top --comms,
      --dsos, etc).
      
      So store in symbol_conf.has_filter true if any of those filters is in
      place.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-f5edfmhq69vfvs1kmikq1wep@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0bc2f2f7
  26. 26 6月, 2015 1 次提交
    • L
      perf symbols: Check access permission when reading symbol files · 36c8bb56
      Li Zhang 提交于
      There 2 problems when reading symbols files:
      
      *  It doesn't report any errors even if when users specify symbol
         files which don't exist with --kallsyms or --vmlinux. The result
         just shows the address without symbols, which is not what is expected.
         So it's better to report errors and exit the program.
      
      *  When using command perf report --kallsyms=/proc/kallsyms with a
         non-root user, symbols are resolved. Then select one symbol and
         annotate it, it reports the error as the following:
         Can't annotate __clear_user: No vmlinux file with build id xxx was
         found.
      
         The problem is caused by reading /proc/kcore without access permission.
         /proc/kcore requires CAP_SYS_RAWIO capability to access, so it needs to
         change access permission to allow a specific user to read /proc/kcore or
         use root to execute the perf command.
      
      This patch is to report errors when symbol files specified by users
      don't exist. And check access permission of /proc/kcore when reading it.
      Signed-off-by: NLi Zhang <zhlcindy@linux.vnet.ibm.com>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1434704253-2632-1-git-send-email-zhlcindy@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      36c8bb56
  27. 08 6月, 2015 2 次提交
    • 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
    • A
      perf machine: Fix up some more method names · 9f2de315
      Arnaldo Carvalho de Melo 提交于
      Calling the function 'machine__new_module' implies a new 'module' will
      be allocated, when in fact what is returned is a 'struct map' instance,
      that not necessarily will be instantiated, as if one already exists with
      the given module name, it will be returned instead.
      
      So be consistent with other "find and if not there, create" like
      functions, like machine__findnew_thread, machine__findnew_dso, etc, and
      rename it to machine__findnew_module_map(), that in turn will call
      machine__findnew_module_dso().
      
      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-acv830vd3hwww2ih5vjtbmu3@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9f2de315
  28. 28 5月, 2015 4 次提交
  29. 27 5月, 2015 2 次提交