1. 02 10月, 2014 1 次提交
    • W
      perf symbols: Improve DSO long names lookup speed with rbtree · 4598a0a6
      Waiman Long 提交于
      With workload that spawns and destroys many threads and processes, it
      was found that perf-mem could took a long time to post-process the perf
      data after the target workload had completed its operation.
      
      The performance bottleneck was found to be the lookup and insertion of
      the new DSO structures (thousands of them in this case).
      
      In a dual-socket Ivy-Bridge E7-4890 v2 machine (30-core, 60-thread), the
      perf profile below shows what perf was doing after the profiled AIM7
      shared workload completed:
      
      -     83.94%  perf  libc-2.11.3.so     [.] __strcmp_sse42
         - __strcmp_sse42
            - 99.82% map__new
                 machine__process_mmap_event
                 perf_session_deliver_event
                 perf_session__process_event
                 __perf_session__process_events
                 cmd_record
                 cmd_mem
                 run_builtin
                 main
                 __libc_start_main
      -     13.17%  perf  perf               [.] __dsos__findnew
           __dsos__findnew
           map__new
           machine__process_mmap_event
           perf_session_deliver_event
           perf_session__process_event
           __perf_session__process_events
           cmd_record
           cmd_mem
           run_builtin
           main
           __libc_start_main
      
      So about 97% of CPU times were spent in the map__new() function trying
      to insert new DSO entry into the DSO linked list. The whole
      post-processing step took about 9 minutes.
      
      The DSO structures are currently searched linearly. So the total
      processing time will be proportional to n^2.
      
      To overcome this performance problem, the DSO code is modified to also
      put the DSO structures in a RB tree sorted by its long name in
      additional to being in a simple linked list. With this change, the
      processing time will become proportional to n*log(n) which will be much
      quicker for large n. However, the short name will still be searched
      using the old linear searching method.  With that patch in place, the
      same perf-mem post-processing step took less than 30 seconds to
      complete.
      Signed-off-by: NWaiman Long <Waiman.Long@hp.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Douglas Hatch <doug.hatch@hp.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Scott J Norton <scott.norton@hp.com>
      Link: http://lkml.kernel.org/r/1412098575-27863-3-git-send-email-Waiman.Long@hp.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4598a0a6
  2. 30 9月, 2014 1 次提交
    • W
      perf symbols: Encapsulate dsos list head into struct dsos · 8fa7d87f
      Waiman Long 提交于
      This is a precursor patch to enable long name searching of DSOs using
      a rbtree.
      
      In this patch, a new dsos structure is created which contains only a
      list head structure for the moment.
      
      The new dsos structure is used, in turn, in the machine structure for
      the user_dsos and kernel_dsos fields.
      
      Only the following 3 dsos functions are modified to accept the new dsos
      structure parameter instead of list_head:
      
       - dsos__add()
       - dsos__find()
       - __dsos__findnew()
      Signed-off-by: NWaiman Long <Waiman.Long@hp.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Douglas Hatch <doug.hatch@hp.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Scott J Norton <scott.norton@hp.com>
      Link: http://lkml.kernel.org/r/1412021249-19201-2-git-send-email-Waiman.Long@hp.com
      [ Move struct dsos to dso.h to reduce the dso methods depends on machine.h ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8fa7d87f
  3. 15 8月, 2014 1 次提交
  4. 31 7月, 2014 1 次提交
  5. 24 7月, 2014 1 次提交
  6. 23 7月, 2014 3 次提交
  7. 22 7月, 2014 1 次提交
  8. 17 7月, 2014 1 次提交
  9. 12 6月, 2014 8 次提交
  10. 25 2月, 2014 1 次提交
  11. 28 12月, 2013 1 次提交
  12. 18 12月, 2013 1 次提交
    • A
      perf symbols: Use consistent name for the DSO binary type member · 5f70619d
      Arnaldo Carvalho de Melo 提交于
      It was called "data_type", but in this context "data" is way too vague,
      it could mean the "data" ELF segment, or something else.
      
      Since we have dso__read_binary_type_filename() and the values this field
      receives are all DSO__BINARY_TYPE_<FOO> we may as well call it
      "binary_type" for consistency sake.
      
      It also seems more appropriate since it determines if we can do
      operations like annotation and DWARF unwinding, that needs more than
      just the symtab, requiring access to ELF text segments, CFI ELF
      sections, etc.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-2lkbqrn23uc2uvnn9w9in379@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5f70619d
  13. 17 12月, 2013 2 次提交
  14. 11 12月, 2013 8 次提交
  15. 05 12月, 2013 3 次提交
  16. 10 10月, 2013 1 次提交
  17. 09 10月, 2013 1 次提交
  18. 08 8月, 2013 3 次提交
    • A
      perf symbols: Add support for reading from /proc/kcore · 8e0cf965
      Adrian Hunter 提交于
      In the absence of vmlinux, perf tools uses kallsyms for symbols.  If the
      user has access, now also map to /proc/kcore.
      
      The dso data_type is now set to either DSO_BINARY_TYPE__KCORE or
      DSO_BINARY_TYPE__GUEST_KCORE as approprite.
      
      This patch breaks the "vmlinux symtab matches kallsyms" test.  That is
      fixed in a following patch.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1375875537-4509-8-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8e0cf965
    • A
      perf tools: Make it possible to read object code from kernel modules · 0131c4ec
      Adrian Hunter 提交于
      The new "object code reading" test shows that it is not possible to read
      object code from kernel modules.  That is because the mappings do not
      map to the dsos.  This patch fixes that.
      
      This involves identifying and flagging relocatable (ELF type ET_REL)
      files (e.g. kernel modules) for symbol adjustment and updating
      map__rip_2objdump() accordingly.  The kmodule parameter of
      dso__load_sym() is taken into use and the module map altered to map to
      the dso.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1375875537-4509-7-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0131c4ec
    • A
      perf tools: Make it possible to read object code from vmlinux · 39b12f78
      Adrian Hunter 提交于
      The new "object code reading" test shows that it is not possible to read
      object code from vmlinux.  That is because the mappings do not map to
      the dso.  This patch fixes that.
      
      A side-effect of changing the kernel map is that the "reloc" offset must
      be taken into account.  As a result of that separate map functions for
      relocation are no longer needed.
      
      Also fixing up the maps to match the symbols no longer makes sense and
      so is not done.
      
      The vmlinux dso data_type is now set to either DSO_BINARY_TYPE__VMLINUX
      or DSO_BINARY_TYPE__GUEST_VMLINUX as approprite, which enables the
      correct file name to be determined by dso__binary_type_file().
      
      This patch breaks the "vmlinux symtab matches kallsyms" test.  That is
      fixed in a following patch.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1375875537-4509-4-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      39b12f78
  19. 09 7月, 2013 1 次提交
    • W
      perf symbols: Fix vdso list searching · f9ceffb6
      Waiman Long 提交于
      When "perf record" was used on a large machine with a lot of CPUs, the
      perf post-processing time (the time after the workload was done until
      the perf command itself exited) could take a lot of minutes and even
      hours depending on how large the resulting perf.data file was.
      
      While running AIM7 1500-user high_systime workload on a 80-core x86-64
      system with a 3.9 kernel (with only the -s -a options used), the
      workload itself took about 2 minutes to run and the perf.data file had a
      size of 1108.746 MB. However, the post-processing step took more than 10
      minutes.
      
      With a gprof-profiled perf binary, the time spent by perf was as
      follows:
      
        %   cumulative   self              self     total
       time   seconds   seconds    calls   s/call   s/call  name
       96.90    822.10   822.10   192156     0.00     0.00  dsos__find
        0.81    828.96     6.86 172089958     0.00     0.00  rb_next
        0.41    832.44     3.48 48539289     0.00     0.00  rb_erase
      
      So 97% (822 seconds) of the time was spent in a single dsos_find()
      function. After analyzing the call-graph data below:
      
       -----------------------------------------------
                       0.00  822.12  192156/192156      map__new [6]
       [7]     96.9    0.00  822.12  192156         vdso__dso_findnew [7]
                     822.10    0.00  192156/192156      dsos__find [8]
                       0.01    0.00  192156/192156      dsos__add [62]
                       0.01    0.00  192156/192366      dso__new [61]
                       0.00    0.00       1/45282525     memdup [31]
                       0.00    0.00  192156/192230      dso__set_long_name [91]
       -----------------------------------------------
                     822.10    0.00  192156/192156      vdso__dso_findnew [7]
       [8]     96.9  822.10    0.00  192156         dsos__find [8]
       -----------------------------------------------
      
      It was found that the vdso__dso_findnew() function failed to locate
      VDSO__MAP_NAME ("[vdso]") in the dso list and have to insert a new
      entry at the end for 192156 times. This problem is due to the fact that
      there are 2 types of name in the dso entry - short name and long name.
      The initial dso__new() adds "[vdso]" to both the short and long names.
      After that, vdso__dso_findnew() modifies the long name to something
      like /tmp/perf-vdso.so-NoXkDj. The dsos__find() function only compares
      the long name. As a result, the same vdso entry is duplicated many
      time in the dso list. This bug increases memory consumption as well
      as slows the symbol processing time to a crawl.
      
      To resolve this problem, the dsos__find() function interface was
      modified to enable searching either the long name or the short
      name. The vdso__dso_findnew() will now search only the short name
      while the other call sites search for the long name as before.
      
      With this change, the cpu time of perf was reduced from 848.38s to
      15.77s and dsos__find() only accounted for 0.06% of the total time.
      
        0.06     15.73     0.01   192151     0.00     0.00  dsos__find
      Signed-off-by: NWaiman Long <Waiman.Long@hp.com>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Cc: "Chandramouleeswaran, Aswin" <aswin@hp.com>
      Cc: "Norton, Scott J" <scott.norton@hp.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1368110568-64714-1-git-send-email-Waiman.Long@hp.com
      [ replaced TRUE/FALSE with stdbool.h equivalents, fixing builds where
        those macros are not present (NO_LIBPYTHON=1 NO_LIBPERL=1), fix from Jiri Olsa ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f9ceffb6