1. 08 6月, 2015 3 次提交
  2. 07 6月, 2015 1 次提交
    • K
      perf tools: handle PERF_RECORD_LOST_SAMPLES · c4937a91
      Kan Liang 提交于
      This patch modifies the perf tool to handle the new RECORD type,
      PERF_RECORD_LOST_SAMPLES.
      
      The number of lost-sample events is stored in
      .nr_events[PERF_RECORD_LOST_SAMPLES]. The exact number of samples
      which the kernel dropped is stored in total_lost_samples.
      
      When the percentage of dropped samples is greater than 5%, a warning
      is printed.
      
      Here are some examples:
      
      Eg 1, Recording different frequently-occurring events is safe with the
            patch. Only a very low drop rate is associated with such actions.
      
      $ perf record -e '{cycles:p,instructions:p}' -c 20003 --no-time ~/tchain ~/tchain
      
      $ perf report -D | tail
                SAMPLE events:     120243
                 MMAP2 events:          5
          LOST_SAMPLES events:         24
        FINISHED_ROUND events:         15
      cycles:p stats:
                 TOTAL events:      59348
                SAMPLE events:      59348
      instructions:p stats:
                 TOTAL events:      60895
                SAMPLE events:      60895
      
      $ perf report --stdio --group
       # To display the perf.data header info, please use --header/--header-only options.
       #
       #
       # Total Lost Samples: 24
       #
       # Samples: 120K of event 'anon group { cycles:p, instructions:p }'
       # Event count (approx.): 24048600000
       #
       #         Overhead  Command      Shared Object     Symbol
       # ................  ...........  ................
       ..................................
       #
          99.74%  99.86%  tchain_edit  tchain_edit       [.] f3
           0.09%   0.02%  tchain_edit  tchain_edit       [.] f2
           0.04%   0.00%  tchain_edit  [kernel.vmlinux]  [k] ixgbe_read_reg
      
      Eg 2, Recording the same thing multiple times can lead to high drop
            rate, but it is not a useful configuration.
      
      $ perf record -e '{cycles:p,cycles:p}' -c 20003 --no-time ~/tchain
      Warning: Processed 600592 samples and lost 99.73% samples!
      [perf record: Woken up 148 times to write data]
      [perf record: Captured and wrote 36.922 MB perf.data (1206322 samples)]
      [perf record: Woken up 1 times to write data]
      [perf record: Captured and wrote 0.121 MB perf.data (1629 samples)]
      Signed-off-by: NKan Liang <kan.liang@intel.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Andrew Morton <akpm@linux-foundation.org>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: acme@infradead.org
      Cc: eranian@google.com
      Link: http://lkml.kernel.org/r/1431285195-14269-9-git-send-email-kan.liang@intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      c4937a91
  3. 03 6月, 2015 2 次提交
    • W
      perf tools: Deal with kernel module names in '[]' correctly · 1f121b03
      Wang Nan 提交于
      Before patch ba92732e ('perf kmaps: Check kmaps to make code more
      robust'), 'perf report' and 'perf annotate' will segfault if trace data
      contains kernel module information like this:
      
       # perf report -D -i ./perf.data
       ...
       0 0 0x188 [0x50]: PERF_RECORD_MMAP -1/0: [0xffffffbff1018000(0xf068000) @ 0]: x [test_module]
       ...
      
       # perf report -i ./perf.data --objdump=/path/to/objdump --kallsyms=/path/to/kallsyms
      
       perf: Segmentation fault
       -------- backtrace --------
       /path/to/perf[0x503478]
       /lib64/libc.so.6(+0x3545f)[0x7fb201f3745f]
       /path/to/perf[0x499b56]
       /path/to/perf(dso__load_kallsyms+0x13c)[0x49b56c]
       /path/to/perf(dso__load+0x72e)[0x49c21e]
       /path/to/perf(map__load+0x6e)[0x4ae9ee]
       /path/to/perf(thread__find_addr_map+0x24c)[0x47deec]
       /path/to/perf(perf_event__preprocess_sample+0x88)[0x47e238]
       /path/to/perf[0x43ad02]
       /path/to/perf[0x4b55bc]
       /path/to/perf(ordered_events__flush+0xca)[0x4b57ea]
       /path/to/perf[0x4b1a01]
       /path/to/perf(perf_session__process_events+0x3be)[0x4b428e]
       /path/to/perf(cmd_report+0xf11)[0x43bfc1]
       /path/to/perf[0x474702]
       /path/to/perf(main+0x5f5)[0x42de95]
       /lib64/libc.so.6(__libc_start_main+0xf4)[0x7fb201f23bd4]
       /path/to/perf[0x42dfc4]
      
      This is because __kmod_path__parse treats '[' leading names as kernel
      name instead of names of kernel module.
      
      If perf.data contains build information and the buildid of such modules
      can be found, the dso->kernel of it will be set to DSO_TYPE_KERNEL by
      __event_process_build_id(), not kernel module.
      
      It will then be passed to dso__load() -> dso__load_kernel_sym() ->
      dso__load_kcore() if --kallsyms is provided.
      
      The refered patch adds NULL pointer checker to avoid segfault. However,
      such kernel modules are still processed incorrectly.
      
      This patch fixes __kmod_path__parse, makes it treat names like
      '[test_module]' as kernel modules.
      
      kmod-path.c is also update to reflect the above changes.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Zefan Li <lizefan@huawei.com>
      Link: http://lkml.kernel.org/r/1433321541-170245-1-git-send-email-wangnan0@huawei.com
      [ Fixed the merged with 0443f36b ("perf machine: Fix the search
        for the kernel DSO on the unified list" ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1f121b03
    • A
      perf machine: Fix the search for the kernel DSO on the unified list · 0443f36b
      Arnaldo Carvalho de Melo 提交于
      When unifying the user_dsos and kernel_dsos a bug was introduced by
      inverting the check for dso->kernel, fix it.
      
      Fixes: 3d39ac53 ("perf machine: No need to have two DSOs lists")
      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-xnrnq0kams3s2z9ek1wjb506@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0443f36b
  4. 29 5月, 2015 4 次提交
  5. 28 5月, 2015 1 次提交
    • A
      perf tools: Reference count struct map · 84c2cafa
      Arnaldo Carvalho de Melo 提交于
      We have pointers to struct map instances in several places, like in the
      hist_entry instances, so we need a way to know when we can destroy them,
      otherwise we may either keep leaking them or end up referencing deleted
      instances.
      
      Start fixing it by reference counting them.
      
      This patch puts the reference count for struct map in place, replacing
      direct map__delete() calls with map__put() ones and then grabbing a
      reference count when adding it to the maps struct where maps for a
      struct thread are kept.
      
      Next we'll grab reference counts when setting pointers to struct map
      instances, in places like in the hist_entry code.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.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-wi19xczk0t2a41r1i2chuio5@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      84c2cafa
  6. 27 5月, 2015 2 次提交
  7. 16 5月, 2015 1 次提交
  8. 12 5月, 2015 1 次提交
  9. 09 5月, 2015 1 次提交
    • A
      perf machine: Protect the machine->threads with a rwlock · b91fc39f
      Arnaldo Carvalho de Melo 提交于
      In addition to using refcounts for the struct thread lifetime
      management, we need to protect access to machine->threads from
      concurrent access.
      
      That happens in 'perf top', where a thread processes events, inserting
      and deleting entries from that rb_tree while another thread decays
      hist_entries, that end up dropping references and ultimately deleting
      threads from the rb_tree and releasing its resources when no further
      hist_entry (or other data structures, like in 'perf sched') references
      it.
      
      So the rule is the same for refcounts + protected trees in the kernel,
      get the tree lock, find object, bump the refcount, drop the tree lock,
      return, use object, drop the refcount if no more use of it is needed,
      keep it if storing it in some other data structure, drop when releasing
      that data structure.
      
      I.e. pair "t = machine__find(new)_thread()" with a "thread__put(t)", and
      "perf_event__preprocess_sample(&al)" with "addr_location__put(&al)".
      
      The addr_location__put() one is because as we return references to
      several data structures, we may end up adding more reference counting
      for the other data structures and then we'll drop it at
      addr_location__put() time.
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Don Zickus <dzickus@redhat.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-bs9rt4n0jw3hi9f3zxyy3xln@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b91fc39f
  10. 06 5月, 2015 2 次提交
  11. 10 4月, 2015 1 次提交
    • H
      perf buildid-list: Fix segfault when show DSOs with hits · 5e78c69b
      He Kuang 提交于
      commit: f3b623b8 ("perf tools: Reference count struct thread")
      appends every thread->node to dead_threads in machine__remove_thread()
      and list_del_init() this node in thread__put().
      
      perf_event__exit_del_thread() releases thread wihout using
      machine__remove_thread(), and causes a NULL pointer crash when
      list_del_init(&thread->node) is called. Fix this by using
      machine_remove_thread() instead of using thread__put() directly.
      
      This problem can be reproduced as following:
      
        $ perf record ls
        $ perf buildid-list --with-hits
        [ 3874.195070] perf[1018]: segfault at 0 ip 00000000004b0b15 sp
        00007ffc35b44780 error 6 in perf[400000+166000]
        Segmentation fault
      
      After this patch:
        $ perf record ls
        $ perf buildid-list --with-hits
        bc23e7c3281e542650ba4324421d6acf78f4c23e /proc/kcore
        643324cb0e969f30c56d660f167f84a150845511 [vdso]
        0000000000000000000000000000000000000000 /bin/busybox
        ...
      Signed-off-by: NHe Kuang <hekuang@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1428658500-6483-1-git-send-email-hekuang@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5e78c69b
  12. 08 4月, 2015 1 次提交
  13. 01 4月, 2015 1 次提交
  14. 23 3月, 2015 3 次提交
  15. 22 3月, 2015 2 次提交
  16. 03 3月, 2015 1 次提交
    • A
      perf tools: Reference count struct thread · f3b623b8
      Arnaldo Carvalho de Melo 提交于
      We need to do that to stop accumulating entries in the dead_threads
      linked list, i.e. we were keeping references to threads in struct hists
      that continue to exist even after a thread exited and was removed from
      the machine threads rbtree.
      
      We still keep the dead_threads list, but just for debugging, allowing us
      to iterate at any given point over the threads that still are referenced
      by things like struct hist_entry.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.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-3ejvfyed0r7ue61dkurzjux4@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f3b623b8
  17. 19 2月, 2015 1 次提交
    • K
      perf tools: Construct LBR call chain · 384b6055
      Kan Liang 提交于
      LBR call stack only has user-space callchains. It is output in the
      PERF_SAMPLE_BRANCH_STACK data format. For kernel callchains, it's
      still in the form of PERF_SAMPLE_CALLCHAIN.
      
      The perf tool has to handle both data sources to construct a
      complete callstack.
      
      For the "perf report -D" option, both lbr and fp information will be
      displayed.
      
      A new call chain recording option "lbr" is introduced into the perf
      tool for LBR call stack. The user can use --call-graph lbr to get
      the call stack information from hardware.
      
      Here are some examples.
      
      When profiling bc(1) on Fedora 19:
      
        echo 'scale=2000; 4*a(1)' > cmd; perf record --call-graph lbr bc -l < cmd
      
      If enabling LBR, perf report output looks like:
      
          50.36%       bc  bc                 [.] bc_divide
                       |
                       --- bc_divide
                           execute
                           run_code
                           yyparse
                           main
                           __libc_start_main
                           _start
          33.66%       bc  bc                 [.] _one_mult
                       |
                       --- _one_mult
                           bc_divide
                           execute
                           run_code
                           yyparse
                           main
                           __libc_start_main
                           _start
           7.62%       bc  bc                 [.] _bc_do_add
                       |
                       --- _bc_do_add
                          |
                          |--99.89%-- 0x2000186a8
                           --0.11%-- [...]
           6.83%       bc  bc                 [.] _bc_do_sub
                       |
                       --- _bc_do_sub
                          |
                          |--99.94%-- bc_add
                          |          execute
                          |          run_code
                          |          yyparse
                          |          main
                          |          __libc_start_main
                          |          _start
                           --0.06%-- [...]
           0.46%       bc  libc-2.17.so       [.] __memset_sse2
                       |
                       --- __memset_sse2
                          |
                          |--54.13%-- bc_new_num
                          |          |
                          |          |--51.00%-- bc_divide
                          |          |          execute
                          |          |          run_code
                          |          |          yyparse
                          |          |          main
                          |          |          __libc_start_main
                          |          |          _start
                          |          |
                          |          |--30.46%-- _bc_do_sub
                          |          |          bc_add
                          |          |          execute
                          |          |          run_code
                          |          |          yyparse
                          |          |          main
                          |          |          __libc_start_main
                          |          |          _start
                          |          |
                          |           --18.55%-- _bc_do_add
                          |                     bc_add
                          |                     execute
                          |                     run_code
                          |                     yyparse
                          |                     main
                          |                     __libc_start_main
                          |                     _start
                          |
                           --45.87%-- bc_divide
                                     execute
                                     run_code
                                     yyparse
                                     main
                                     __libc_start_main
                                     _start
      
      If using FP, perf report output looks like:
      
        echo 'scale=2000; 4*a(1)' > cmd; perf record --call-graph fp bc -l < cmd
      
          50.49%       bc  bc                 [.] bc_divide
                       |
                       --- bc_divide
          33.57%       bc  bc                 [.] _one_mult
                       |
                       --- _one_mult
           7.61%       bc  bc                 [.] _bc_do_add
                       |
                       --- _bc_do_add
                           0x2000186a8
           6.88%       bc  bc                 [.] _bc_do_sub
                       |
                       --- _bc_do_sub
           0.42%       bc  libc-2.17.so       [.] __memcpy_ssse3_back
                       |
                       --- __memcpy_ssse3_back
      
      If using LBR, perf report -D output looks like:
      
      3458145275743 0x2fd750 [0xd8]: PERF_RECORD_SAMPLE(IP, 0x2): 9748/9748: 0x408ea8 period: 609644 addr: 0
      ... LBR call chain: nr:8
      .....  0: fffffffffffffe00
      .....  1: 0000000000408e50
      .....  2: 000000000040a458
      .....  3: 000000000040562e
      .....  4: 0000000000408590
      .....  5: 00000000004022c0
      .....  6: 00000000004015dd
      .....  7: 0000003d1cc21b43
      ... FP chain: nr:2
      .....  0: fffffffffffffe00
      .....  1: 0000000000408ea8
       ... thread: bc:9748
       ...... dso: /usr/bin/bc
      
      The LBR call stack has the following known limitations:
      
       - Zero length calls are not filtered out by the hardware
      
       - Exception handing such as setjmp/longjmp will have calls/returns not
         match
      
       - Pushing different return address onto the stack will have
         calls/returns not match
      
       - If callstack is deeper than the LBR, only the last entries are
         captured
      Tested-by: NJiri Olsa <jolsa@kernel.org>
      Signed-off-by: NKan Liang <kan.liang@intel.com>
      Signed-off-by: NPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Simon Que <sque@chromium.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1420482185-29830-3-git-send-email-kan.liang@intel.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      384b6055
  18. 17 1月, 2015 1 次提交
  19. 09 12月, 2014 1 次提交
  20. 02 12月, 2014 1 次提交
    • A
      perf callchain: Support handling complete branch stacks as histograms · 8b7bad58
      Andi Kleen 提交于
      Currently branch stacks can be only shown as edge histograms for
      individual branches. I never found this display particularly useful.
      
      This implements an alternative mode that creates histograms over
      complete branch traces, instead of individual branches, similar to how
      normal callgraphs are handled. This is done by putting it in front of
      the normal callgraph and then using the normal callgraph histogram
      infrastructure to unify them.
      
      This way in complex functions we can understand the control flow that
      lead to a particular sample, and may even see some control flow in the
      caller for short functions.
      
      Example (simplified, of course for such simple code this is usually not
      needed), please run this after the whole patchkit is in, as at this
      point in the patch order there is no --branch-history, that will be
      added in a patch after this one:
      
      tcall.c:
      
      volatile a = 10000, b = 100000, c;
      
      __attribute__((noinline)) f2()
      {
      	c = a / b;
      }
      
      __attribute__((noinline)) f1()
      {
      	f2();
      	f2();
      }
      main()
      {
      	int i;
      	for (i = 0; i < 1000000; i++)
      		f1();
      }
      
      % perf record -b -g ./tsrc/tcall
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.044 MB perf.data (~1923 samples) ]
      % perf report --no-children --branch-history
      ...
          54.91%  tcall.c:6  [.] f2                      tcall
                  |
                  |--65.53%-- f2 tcall.c:5
                  |          |
                  |          |--70.83%-- f1 tcall.c:11
                  |          |          f1 tcall.c:10
                  |          |          main tcall.c:18
                  |          |          main tcall.c:18
                  |          |          main tcall.c:17
                  |          |          main tcall.c:17
                  |          |          f1 tcall.c:13
                  |          |          f1 tcall.c:13
                  |          |          f2 tcall.c:7
                  |          |          f2 tcall.c:5
                  |          |          f1 tcall.c:12
                  |          |          f1 tcall.c:12
                  |          |          f2 tcall.c:7
                  |          |          f2 tcall.c:5
                  |          |          f1 tcall.c:11
                  |          |
                  |           --29.17%-- f1 tcall.c:12
                  |                     f1 tcall.c:12
                  |                     f2 tcall.c:7
                  |                     f2 tcall.c:5
                  |                     f1 tcall.c:11
                  |                     f1 tcall.c:10
                  |                     main tcall.c:18
                  |                     main tcall.c:18
                  |                     main tcall.c:17
                  |                     main tcall.c:17
                  |                     f1 tcall.c:13
                  |                     f1 tcall.c:13
                  |                     f2 tcall.c:7
                  |                     f2 tcall.c:5
                  |                     f1 tcall.c:12
      
      The default output is unchanged.
      
      This is only implemented in perf report, no change to record or anywhere
      else.
      
      This adds the basic code to report:
      
      - add a new "branch" option to the -g option parser to enable this mode
      - when the flag is set include the LBR into the callstack in machine.c.
      
      The rest of the history code is unchanged and doesn't know the
      difference between LBR entry and normal call entry.
      
      - detect overlaps with the callchain
      - remove small loop duplicates in the LBR
      
      Current limitations:
      
      - The LBR flags (mispredict etc.) are not shown in the history
      and LBR entries have no special marker.
      - It would be nice if annotate marked the LBR entries somehow
      (e.g. with arrows)
      
      v2: Various fixes.
      v3: Merge further patches into this one. Fix white space.
      v4: Improve manpage. Address review feedback.
      v5: Rename functions. Better error message without -g. Fix crash without
          -b.
      v6: Rebase
      v7: Rebase. Use NO_ENTRY in memset.
      v8: Port to latest tip. Move add_callchain_ip to separate
          patch. Skip initial entries in callchain. Minor cleanups.
      Signed-off-by: NAndi Kleen <ak@linux.intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/1415844328-4884-3-git-send-email-andi@firstfloor.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8b7bad58
  21. 25 11月, 2014 1 次提交
  22. 19 11月, 2014 2 次提交
  23. 05 11月, 2014 2 次提交
    • N
      perf tools: Make vmlinux short name more like kallsyms short name · 96d78059
      Namhyung Kim 提交于
      The previous patch changed kernel dso name from '[kernel.kallsyms]' to
      vmlinux.  However it might add confusion to old users accustomed to the
      old name.  So change the short name to '[kernel.vmlinux]' to reduce such
      confusion.
      
      Before:
        # Overhead  Command         Shared Object            Symbol
        # ........  ..............  .......................  ...............................
        #
             9.83%  swapper         vmlinux                  [k] intel_idle
             4.10%  awk             libc-2.20.so             [.] __strcmp_sse2
             1.86%  sed             libc-2.20.so             [.] __strcmp_sse2
             1.78%  netctl-auto     libc-2.20.so             [.] __strcmp_sse2
             1.23%  netctl-auto     libc-2.20.so             [.] __mbrtowc
             1.21%  firefox         libxul.so                [.] 0x00000000024b62bd
             1.20%  swapper         vmlinux                  [k] cpuidle_enter_state
             1.03%  sleep           vmlinux                  [k] copy_user_generic_unrolled
      
      After:
        # Overhead  Command         Shared Object            Symbol
        # ........  ..............  .......................  ...............................
        #
             9.83%  swapper         [kernel.vmlinux]         [k] intel_idle
             4.10%  awk             libc-2.20.so             [.] __strcmp_sse2
             1.86%  sed             libc-2.20.so             [.] __strcmp_sse2
             1.78%  netctl-auto     libc-2.20.so             [.] __strcmp_sse2
             1.23%  netctl-auto     libc-2.20.so             [.] __mbrtowc
             1.21%  firefox         libxul.so                [.] 0x00000000024b62bd
             1.20%  swapper         [kernel.vmlinux]         [k] cpuidle_enter_state
             1.03%  sleep           [kernel.vmlinux]         [k] copy_user_generic_unrolled
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      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/1415063674-17206-9-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      96d78059
    • N
      perf tools: Fix build-id matching on vmlinux · b837a8bd
      Namhyung Kim 提交于
      There's a problem on finding correct kernel symbols when perf report
      runs on a different kernel.  Although a part of the problem was solved
      by the prior commit 0a7e6d1b ("perf tools: Check recorded kernel
      version when finding vmlinux"), there's a remaining problem still.
      
      When perf records samples, it synthesizes the kernel map using
      machine__mmap_name() and ref_reloc_sym like "[kernel.kallsyms]_text".
      You can easily see it using 'perf report -D' command.
      
      After finishing record, it goes through the recorded events to find
      maps/dsos actually used.  And then record build-id info of them.
      
      During this process, it needs to load symbols in a dso and it'd call
      dso__load_vmlinux_path() since the default value of the symbol_conf.
      try_vmlinux_path is true.  However it changes dso->long_name to a real
      path of the vmlinux file (e.g. /lib/modules/3.16.4/build/vmlinux) if one
      is running on a custom kernel.
      
      It resulted in that perf report reads the build-id of the vmlinux, but
      cannot use it since it only knows about the [kernel.kallsyms] map.  It
      then falls back to possible vmlinux paths by using the recorded kernel
      version (in case of a recent version) or a running kernel silently.
      
      Even with the recent tools, this still has a possibility of breaking
      the result.  As the build directory is a symbolic link, if one built a
      new kernel in the same directory with different source/config, the old
      link to vmlinux will point the new file.  So it's absolutely needed to
      use build-id when finding a kernel image.
      
      In this patch, it's now changed to try to search a kernel dso in the
      existing dso list which was constructed during build-id table parsing
      so it'll always have a build-id.  If not found, search "[kernel.kallsyms]".
      
      Before:
      
        $ perf report
        # Children      Self  Command  Shared Object      Symbol
        # ........  ........  .......  .................  ...............................
        #
            72.15%     0.00%  swapper  [kernel.kallsyms]  [k] set_curr_task_rt
            72.15%     0.00%  swapper  [kernel.kallsyms]  [k] native_calibrate_tsc
            72.15%     0.00%  swapper  [kernel.kallsyms]  [k] tsc_refine_calibration_work
            71.87%    71.87%  swapper  [kernel.kallsyms]  [k] module_finalize
         ...
      
      After (for the same perf.data):
      
            72.15%     0.00%  swapper  vmlinux  [k] cpu_startup_entry
            72.15%     0.00%  swapper  vmlinux  [k] arch_cpu_idle
            72.15%     0.00%  swapper  vmlinux  [k] default_idle
            71.87%    71.87%  swapper  vmlinux  [k] native_safe_halt
         ...
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Link: http://lkml.kernel.org/r/20140924073356.GB1962@gmail.com
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      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/1415063674-17206-8-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b837a8bd
  24. 04 11月, 2014 1 次提交
  25. 29 10月, 2014 3 次提交