1. 08 1月, 2015 1 次提交
    • N
      perf hists: Fix children sort key behavior · 5ca82710
      Namhyung Kim 提交于
      When perf report --children resorts output fields, it tries to put
      caller above the callee.  But this was only meaningful for a same thread
      and doing this requires callchain enabled.  So fix its check before
      comparing the callchain depth.
      
      This also changes the hist accumulation tests: In test 3, xmalloc in
      bash thread should be above than other perf threads due to alphabetical
      order of comm string.  Also it's under page_fault in bash thread since
      alphabetical order of dso name.  The sys_perf_event_open in perf thread
      is put on the last line since it's self overhead is 0.
      
      In test 4, the sys_perf_event_open is put above other perf entries that
      have same children overhead since its callchain depth is smaller.
      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: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1419309381-2593-1-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5ca82710
  2. 03 1月, 2015 2 次提交
    • N
      perf diff: Fix to sort by baseline field by default · e7024fc3
      Namhyung Kim 提交于
      The currently perf diff didn't add the baseline and delta (or other
      compute) fields to the sort list so output will be sorted by other
      fields like alphabetical order of DSO or symbol as below example.
      
      Fix it by adding hpp formats for the fields and provides default compare
      functions.
      
      Before:
      
        $ perf diff
        # Event 'cycles'
        #
        # Baseline    Delta  Shared Object       Symbol
        # ........  .......  ..................  ...............................
        #
                             [bridge]            [k] ip_sabotage_in
                             [btrfs]             [k] __etree_search.constprop.47
             0.01%           [btrfs]             [k] btrfs_file_mmap
             0.01%   -0.01%  [btrfs]             [k] btrfs_getattr
                             [e1000e]            [k] e1000_watchdog
             0.00%           [kernel.vmlinux]    [k] PageHuge
             0.00%           [kernel.vmlinux]    [k] __acct_update_integrals
             0.00%           [kernel.vmlinux]    [k] __activate_page
                             [kernel.vmlinux]    [k] __alloc_fd
             0.02%   +0.02%  [kernel.vmlinux]    [k] __alloc_pages_nodemask
             ...
      
      After:
      
        # Baseline    Delta  Shared Object       Symbol
        # ........  .......  ..................  ................................
        #
            24.73%   -4.62%  perf                [.] append_chain_children
             7.96%   -1.29%  perf                [.] dso__find_symbol
             6.97%   -2.07%  libc-2.20.so        [.] vfprintf
             4.61%   +0.88%  libc-2.20.so        [.] __fprintf_chk
             4.41%   +2.43%  perf                [.] sort__comm_cmp
             4.10%   -0.16%  perf                [.] comm__str
             4.03%   -0.93%  perf                [.] machine__findnew_thread_time
             3.82%   +3.09%  perf                [.] __hists__add_entry
             2.95%   -0.18%  perf                [.] sort__dso_cmp
             ...
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1419656793-32756-1-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e7024fc3
    • T
      perf list: Fix --raw-dump option · b3505208
      Taesoo Kim 提交于
      Currently, 'perf list --raw-dump' requires extra arguments
      (e.g., hw) to invoke, which breaks bash/zsh completion
      (perf-completion.sh).
      
        $ perf list --raw-dump
          Error: unknown option `raw-dump'
      
           usage: perf list [hw|sw|cache|tracepoint|pmu|event_glob]
      
      After,
      
        $ perf list --raw-dump
        cpu-cycles instructions cache-references cache-misses ...
      Signed-off-by: NTaesoo Kim <tsgatesv@gmail.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Taesoo kim <taesoo@gatech.edu>
      Link: http://lkml.kernel.org/r/1419997015-11071-1-git-send-email-tsgatesv@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b3505208
  3. 02 1月, 2015 2 次提交
    • N
      perf probe: Fix crash in dwarf_getcfi_elf · 4093325f
      Namhyung Kim 提交于
      David reported that perf can segfault when adding an uprobe event like
      this:
      
        $ perf probe -x /lib64/libc-2.14.90.so -a 'malloc  size=%di'
      
        (gdb) bt
        #0  parse_eh_frame_hdr (hdr=0x0, hdr_size=2596, hdr_vaddr=71788,
            ehdr=0x7fffffffd390, eh_frame_vaddr=
            0x7fffffffd378, table_entries=0x8808d8, table_encoding=0x8808e0 "") at
            dwarf_getcfi_elf.c:79
        #1  0x000000385f81615a in getcfi_scn_eh_frame (hdr_vaddr=71788,
            hdr_scn=0x8839b0, shdr=0x7fffffffd2f0, scn=<optimized out>,
            ehdr=0x7fffffffd390, elf=0x882b30) at dwarf_getcfi_elf.c:231
        #2  getcfi_shdr (ehdr=0x7fffffffd390, elf=0x882b30) at dwarf_getcfi_elf.c:283
        #3  dwarf_getcfi_elf (elf=0x882b30) at dwarf_getcfi_elf.c:309
        #4  0x00000000004d5bac in debuginfo__find_probes (pf=0x7fffffffd4f0,
            dbg=Unhandled dwarf expression opcode 0xfa) at util/probe-finder.c:993
        #5  0x00000000004d634a in debuginfo__find_trace_events (dbg=0x880840,
            pev=<optimized out>, tevs=0x880f88, max_tevs=<optimized out>) at
            util/probe-finder.c:1200
        #6  0x00000000004aed6b in try_to_find_probe_trace_events (target=0x881b20
            "/lib64/libpthread-2.14.90.so",
            max_tevs=128, tevs=0x880f88, pev=0x859b30) at util/probe-event.c:482
        #7  convert_to_probe_trace_events (target=0x881b20
            "/lib64/libpthread-2.14.90.so", max_tevs=128, tevs=0x880f88,
            pev=0x859b30) at util/probe-event.c:2356
        #8  add_perf_probe_events (pevs=<optimized out>, npevs=1, max_tevs=128,
            target=0x881b20 "/lib64/libpthread-2.14.90.so", force_add=false) at
            util/probe-event.c:2391
        #9  0x000000000044014f in __cmd_probe (argc=<optimized out>,
            argv=0x7fffffffe2f0, prefix=Unhandled dwarf expression opcode 0xfa) at
            at builtin-probe.c:488
        #10 0x0000000000440313 in cmd_probe (argc=5, argv=0x7fffffffe2f0,
            prefix=<optimized out>) at builtin-probe.c:506
        #11 0x000000000041d133 in run_builtin (p=0x805680, argc=5,
            argv=0x7fffffffe2f0) at perf.c:341
        #12 0x000000000041c8b2 in handle_internal_command (argv=<optimized out>,
            argc=<optimized out>) at perf.c:400
        #13 run_argv (argv=<optimized out>, argcp=<optimized out>) at perf.c:444
        #14 main (argc=5, argv=0x7fffffffe2f0) at perf.c:559
      
      And I found a related commit (5704c8c4fa71 "getcfi_scn_eh_frame: Don't
      crash and burn when .eh_frame bits aren't there.") in elfutils that can
      lead to a unexpected crash like this.  To safely use the function, it
      needs to check the .eh_frame section is a PROGBITS type.
      Reported-by: NDavid Ahern <dsahern@gmail.com>
      Tested-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Mark Wielaard <mjw@redhat.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Link: http://lkml.kernel.org/r/20141230090533.GH6081@sejongSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4093325f
    • M
      perf probe: Fix to fall back to find probe point in symbols · 906451b9
      Masami Hiramatsu 提交于
      Fix to fall back to find a probe point in symbols if perf fails to find
      it in debuginfo.
      
      This can happen when the target function is an alias of another
      function. Such alias doesn't have an entry in debuginfo but in symbols.
      
      David Ahern reported this problem in https://lkml.org/lkml/2014/12/29/355
      
      I ensured the problem and deeper investigation discovers it.
       -----
       eu-readelf --debug-dump=info /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so | grep \"malloc\" -A6
                   name                 (strp) "malloc"
                   decl_file            (data1) 25
                   decl_line            (data2) 466
                   prototyped           (flag_present)
                   type                 (ref4) [  81b5]
                   declaration          (flag_present)
       [  8f58]      formal_parameter
       --
                   name                 (strp) "malloc"
                   decl_file            (data1) 23
                   decl_line            (data2) 466
                   prototyped           (flag_present)
                   type                 (ref4) [  9f4a]
                   declaration          (flag_present)
                   sibling              (ref4) [  bb29]
       ...
       -----
      All these entires have no instances (all of them are declarations)
      This is why the perf probe failed to find it in debuginfo.
      
      However, there are some malloc instances in symbols.
       -----
       eu-readelf --symbols /usr/lib/debug/lib/x86_64-linux-gnu/libc-2.19.so | grep malloc$
        1181: 0000000000080700   5332 FUNC    LOCAL  DEFAULT       12 _int_malloc
        4537: 00000000000831d0    339 FUNC    LOCAL  DEFAULT       12 __GI___libc_malloc
        5545: 00000000000831d0    339 FUNC    LOCAL  DEFAULT       12 __malloc
        6063: 00000000000831d0    339 FUNC    GLOBAL DEFAULT       12 malloc
        7302: 00000000000831d0    339 FUNC    GLOBAL DEFAULT       12 __libc_malloc
       -----
      As you an see, malloc and __libc_malloc have same address, and actually
      __libc_malloc has an entry in debuginfo. So you can set up a probe on
      __libc_malloc.
      
      To fix this problem shortly, perf probe simply falls back to find probe
      point(malloc) in symbols if it is not found in debuginfo.
      Reported-by: NDavid Ahern <dsahern@gmail.com>
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: yrl.pp-manager.tt@hitachi.com
      Link: http://lkml.kernel.org/r/20141231062747.2087.80961.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      906451b9
  4. 23 12月, 2014 3 次提交
  5. 19 12月, 2014 1 次提交
    • W
      perf: Fix building warning on ARM 32 · ac931f87
      Wang Nan 提交于
      Commit 85c116a6 ("perf callchain: Make get_srcline fall back to sym+offset")
      introduces asprintf() call and matches '%ld' to a u64 argument, which is
      incorrect on ARM:
      
         CC       /home/wn/util/srcline.o
       util/srcline.c: In function 'get_srcline':
       util/srcline.c:297:6: error: format '%ld' expects argument of type 'long int', but argument 4 has type 'u64' [-Werror=format]
       cc1: all warnings being treated as errors
       make[1]: *** [/home/wn/util/srcline.o] Error 1
      
      In addition, all users of get_srcline() use u64 addr, and libbfd
      also use 64 bit bfd_vma as address. This patch also fix
      prototype of get_srcline() and addr2line() to use u64 addr
      instead of unsigned long.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: <lizefan@huawei.com>
      Cc: <a.p.zijlstra@chello.nl>
      Cc: <paulus@samba.org>
      Cc: <acme@kernel.org>
      Cc: <ak@linux.intel.com>
      Link: http://lkml.kernel.org/r/1418710746-35943-1-git-send-email-wangnan0@huawei.comSigned-off-by: NIngo Molnar <mingo@kernel.org>
      ac931f87
  6. 17 12月, 2014 16 次提交
  7. 12 12月, 2014 4 次提交
    • A
      perf trace: Provide a better explanation when mmap fails · e09b18d4
      Arnaldo Carvalho de Melo 提交于
      If we ask for a mmap lenght than the max configured via the relevant
      sysctl, provide a better warning, instead of just expanding the EPERM
      returned:
      
      [acme@ssdandy ~]$ trace -m 256 -e nanosleep sleep 2
      Error:	Operation not permitted.
      Hint:	Check /proc/sys/kernel/perf_event_mlock_kb (516 kB) setting.
      Hint:	Tried using 1028 kB.
      Hint:	Try using a bigger -m/--mmap-pages value.
      
      [acme@ssdandy ~]$ trace -m 128 -e nanosleep sleep 2
        2001.280 (2000.403 ms): nanosleep(rqtp: 0x7fff89a8a7f0) = 0
      [acme@ssdandy ~]$
      
      An upcoming patch will autotune the request for non-root users when -m
      is not used.
      
      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: 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-cdvxfz2gycetbkopm9sna1qp@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e09b18d4
    • A
      perf evlist: Introduce strerror_mmap method · 956fa571
      Arnaldo Carvalho de Melo 提交于
      To pretty print hints about perf_evlist__mmap errors. Will be used in
      'trace' in the next patch.
      
      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: 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-2g3gczfwyz0xt3we0s15mqqt@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      956fa571
    • A
      perf tools: Use sysctl__read_int instead of ad-hoc copies · ce27309f
      Arnaldo Carvalho de Melo 提交于
      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: 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-pt2u7a3b50oddggecx7rwq2n@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ce27309f
    • A
      tools lib fs: Adopt filename__read_int from tools/perf/ · 3a351127
      Arnaldo Carvalho de Melo 提交于
      Will be useful for new helpers to read sysctl values.
      
      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: 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>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3a351127
  8. 11 12月, 2014 1 次提交
  9. 10 12月, 2014 1 次提交
  10. 09 12月, 2014 9 次提交