1. 20 6月, 2015 8 次提交
  2. 18 6月, 2015 8 次提交
    • I
      Merge tag 'perf-core-for-mingo-2' of... · 79928928
      Ingo Molnar 提交于
      Merge tag 'perf-core-for-mingo-2' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes from Arnaldo Carvalho de Melo:
      
      User visible changes:
      
        - List perf probes to stdout. (Masami Hiramatsu)
      
        - Return error when none of the requested probes were
          installed. (Masami Hiramatsu)
      
        - Cut off the gcc optimization postfixes from
          function name in 'perf probe'. (Masami Hiramatsu)
      
        - Allow disabling/enabling events dynamicly in 'perf top':
          a 'perf top' session can instantly become a 'perf report'
          one, i.e. going from dynamic analysis to a static one,
          returning to a dynamic one is possible, to toogle the
          modes, just press CTRL+z. (Arnaldo Carvalho de Melo)
      
        - Greatly speed up 'perf probe --list' by caching debuginfo.
          (Masami Hiramatsu)
      
        - Fix 'perf trace' race condition at the end of started
          workloads. (Sukadev Bhattiprolu)
      
        - Fix a problem when opening old perf.data with different
          byte order. (Wang Nan)
      
      Infrastructure changes:
      
        - Replace map->referenced & maps->removed_maps with
          map->refcnt. (Arnaldo Carvalho de Melo)
      
        - Introduce the xyarray__reset() function. (Jiri Olsa)
      
        - Add thread_map__(alloc|realloc)() helpers. (Jiri Olsa)
      
        - Move perf_evsel__(alloc|free|reset)_counts into stat object. (Jiri Olsa)
      
        - Introduce perf_counts__(new|delete|reset)() functions. (Jiri Olsa)
      
        - Ignore .config-detected in .gitignore. (Wang Nan)
      
        - Move libtraceevent dynamic list to separated LDFLAGS
          variable. (Wang Nan)
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      79928928
    • A
      perf top: Allow disabling/enabling events dynamicly · 5d484f99
      Arnaldo Carvalho de Melo 提交于
      Now it is possible to press CTRL+z at anytime and that will disable the
      events being monitored, essentially turning 'top' into 'report', with
      pressing CTRL+z again making it enable the events again, returning to
      the 'top' behaviour, i.e. dynamic + decaying of older samples.
      
      One may want, for instance, play with:
      
          -d, --delay <n>       number of seconds to delay between refreshes
      
      and:
      
          -z, --zero            zero history across updates
      
      Plus CTRL+z to see only the events since last zeroing, etc.
      Suggested-by: NIngo Molnar <mingo@kernel.org>
      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-zq7tnh5462blt2yda0bcxh5b@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5d484f99
    • A
      perf evlist: Add toggle_enable() method · 2b56bcfb
      Arnaldo Carvalho de Melo 提交于
      For an upcoming feature in 'perf top' we will have a hotkey to
      enable/disable events, so remember if the events in the list are
      enabled or disabled and allows toggling this state using a new
      method.
      
      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-64c4jvdl5feg2zhimxvokqka@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2b56bcfb
    • S
      perf trace: Fix race condition at the end of started workloads · 7951722d
      Sukadev Bhattiprolu 提交于
      I get following crash on multiple systems and across several releases
      (at least since v3.18).
      
      	Core was generated by `/tmp/perf trace sleep 0.2 '.
      	Program terminated with signal SIGSEGV, Segmentation fault.
      	#0  perf_mmap__read_head (mm=0x3fff9bf30070) at util/evlist.h:195
      	195		u64 head = ACCESS_ONCE(pc->data_head);
      	(gdb) bt
      	#0  perf_mmap__read_head (mm=0x3fff9bf30070) at util/evlist.h:195
      	#1  perf_evlist__mmap_read (evlist=0x10027f11910, idx=<optimized out>)
      	    at util/evlist.c:637
      	#2  0x000000001003ce4c in trace__run (argv=<optimized out>,
      	    argc=<optimized out>, trace=0x3fffd7b28288) at builtin-trace.c:2259
      	#3  cmd_trace (argc=<optimized out>, argv=<optimized out>,
      	    prefix=<optimized out>) at builtin-trace.c:2799
      	#4  0x00000000100657b8 in run_builtin (p=0x10176798 <commands+480>, argc=3,
      	    argv=0x3fffd7b2b550) at perf.c:370
      	#5  0x00000000100063e8 in handle_internal_command (argv=0x3fffd7b2b550, argc=3)
      	    at perf.c:429
      	#6  run_argv (argv=0x3fffd7b2af70, argcp=0x3fffd7b2af7c) at perf.c:473
      	#7  main (argc=3, argv=0x3fffd7b2b550) at perf.c:588
      
      The problem seems to be a race condition, when the application has just
      exited.  Some/all fds associated with the perf-events (tracepoints) go
      into a POLLHUP/ POLLERR state and the mmap region associated with those
      events are unmapped (in perf_evlist__filter_pollfd()).
      
      But we go back and do a perf_evlist__mmap_read() which assumes that the
      mmaps are still valid and we hit the crash.
      
      If the mapping for an event is released, its refcnt is 0 (and ->base
      is NULL), so ensure we have non-zero refcount before accessing the map.
      
      Note that perf-record has a similar logic but unlike perf-trace, the
      record__mmap_read_all() checks the evlist->mmap[i].base before accessing
      the map.
      Signed-off-by: NSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Li Zhang <zhlcindy@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/20150612060003.GA19913@us.ibm.com
      [ Fixed it up to use atomic_read() ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7951722d
    • M
      perf probe: Speed up perf probe --list by caching debuginfo · 7737af01
      Masami Hiramatsu 提交于
      Speed up the "perf probe --list" by caching the last used debuginfo.
      perf probe --list always open and load debuginfo for each entry of probe
      list. This takes very a long time.
      
      E.g. with vfs_* events (total 96 probes)
      
        [root@localhost perf]# time  ./perf probe -l &> /dev/null
      
        real    0m25.376s
        user    0m24.381s
        sys     0m1.012s
      
      To solve this issue, this adds debuginfo_cache to cache the
      last used debuginfo on memory.
      
      With this fix, the perf-probe --list significantly improves
      its speed.
      
        [root@localhost perf]#  time  ./perf probe -l &> /dev/null
      
        real    0m0.161s
        user    0m0.136s
        sys     0m0.025s
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Naohiro Aota <naota@elisp.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20150617145854.19715.15314.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7737af01
    • M
      perf probe: Show usage even if the last event is skipped · d350bd57
      Masami Hiramatsu 提交于
      When the last part of converted events are blacklisted or out-of-text,
      those are skipped and perf probe doesn't show usage examples.  This
      fixes it to show the example even if the last part of event list is
      skipped.
      
      E.g. without this patch, events are added, but suddenly end:
      
        # perf probe vfs_*
        vfs_caches_init_early is out of .text, skip it.
        vfs_caches_init is out of .text, skip it.
        Added new events:
          probe:vfs_fallocate  (on vfs_*)
          probe:vfs_open       (on vfs_*)
        ...
          probe:vfs_dentry_acceptable (on vfs_*)
          probe:vfs_load_quota_inode (on vfs_*)
        #
      
      With this fix:
      
        # perf probe vfs_*
        vfs_caches_init_early is out of .text, skip it.
        vfs_caches_init is out of .text, skip it.
        Added new events:
          probe:vfs_fallocate  (on vfs_*)
        ...
          probe:vfs_load_quota_inode (on vfs_*)
      
        You can now use it in all perf tools, such as:
      
      	perf record -e probe:vfs_load_quota_inode -aR sleep 1
      
      Note that this can be reproduced ONLY IF the vfs_caches_init* is the
      last part of matched symbol list. I've checked this happens on
      "3.19.0-generic #18-Ubuntu" kernel binary.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Naohiro Aota <naota@elisp.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20150616115057.19906.5502.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d350bd57
    • W
      perf tools: Move libtraceevent dynamic list to separated LDFLAGS variable · 5d618324
      Wang Nan 提交于
      Commit e3d09ec8 ("tools lib traceevent:
      Export dynamic symbols used by traceevent plugins") adds libtraceevent
      dynamic list directly into LDFLAGS, which makes all targets depend on
      that list through LDFLAGS.
      
      This is not good since some of targets like libgtk.so doesn't use plugin
      at all, but require the existance of that list because of linker
      options.
      
      This patch isolates the -Xlink option into LIBTRACEEVENT_DYNAMIC_LIST_LDFLAGS,
      makes only perf and perf.so use it.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1434552389-89144-1-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5d618324
    • W
      perf tools: Fix a problem when opening old perf.data with different byte order · b30b6172
      Wang Nan 提交于
      Following error occurs when trying to use 'perf report' on x86_64 to
      cross analysis a perf.data generated by an old perf on a big-endian
      machine:
      
       # perf report
       *** Error in `/home/w00229757/perf': free(): invalid next size (fast): 0x00000000032c99f0 ***
       ======= Backtrace: =========
       /lib64/libc.so.6(+0x6eeef)[0x7ff6ff7e2eef]
       /lib64/libc.so.6(+0x78cae)[0x7ff6ff7eccae]
       /lib64/libc.so.6(+0x79987)[0x7ff6ff7ed987]
       /path/to/perf[0x4ac734]
       /path/to/perf[0x4ac829]
       /path/to/perf(perf_header__process_sections+0x129)[0x4ad2c9]
       /path/to/perf(perf_session__read_header+0x2e1)[0x4ad9e1]
       /path/to/perf(perf_session__new+0x168)[0x4bd458]
       /path/to/perf(cmd_report+0xfa0)[0x43eb70]
       /path/to/perf[0x47adc3]
       /path/to/perf(main+0x5f6)[0x42fd06]
       /lib64/libc.so.6(__libc_start_main+0xf5)[0x7ff6ff795bd5]
       /path/to/perf[0x42fe35]
       ======= Memory map: ========
       [SNIP]
      
      The bug is in perf_event__attr_swap(). It swaps all fields in 'struct
      perf_event_attr' without checking whether the swapped field exist or
      not. In addition, in read_event_desc() allocs memory for attr according
      to size read from perf.data.
      
      Therefore, if the perf.data is collected by an old perf (without
      aux_watermark, for example), when perf_event__attr_swap() swaping
      attr->aux_watermark it destroy malloc's metadata.
      
      This patch introduces boundary checking in perf_event__attr_swap(). It
      adds macros bswap_field_64 and bswap_field_32 into
      perf_event__attr_swap() to make it only swap exist fields.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1434534999-85347-1-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b30b6172
  3. 17 6月, 2015 1 次提交
  4. 16 6月, 2015 9 次提交
  5. 13 6月, 2015 1 次提交
    • M
      perf probe: Cut off the gcc optimization postfixes from function name · 35a23ff9
      Masami Hiramatsu 提交于
      Cut off the postfixes which gcc added for optimized routines from the
      event name automatically generated from symbol name, since *probe-events
      doesn't accept it.  Those symbols will be used if we don't use debuginfo
      to find target functions.
      
      E.g. without this fix;
        -----
        # perf probe -va alloc_buf.isra.23
        probe-definition(0): alloc_buf.isra.23
        symbol:alloc_buf.isra.23 file:(null) line:0 offset:0 return:0 lazy:(null)
        [...]
        Opening /sys/kernel/debug/tracing/kprobe_events write=1
        Added new event:
        Writing event: p:probe/alloc_buf.isra.23 _text+4869328
        Failed to write event: Invalid argument
          Error: Failed to add events. Reason: Invalid argument (Code: -22)
        -----
      With this fix;
        -----
        perf probe -va alloc_buf.isra.23
        probe-definition(0): alloc_buf.isra.23
        symbol:alloc_buf.isra.23 file:(null) line:0 offset:0 return:0 lazy:(null)
        [...]
        Opening /sys/kernel/debug/tracing/kprobe_events write=1
        Added new event:
        Writing event: p:probe/alloc_buf _text+4869328
          probe:alloc_buf      (on alloc_buf.isra.23)
      
        You can now use it in all perf tools, such as:
      
        	perf record -e probe:alloc_buf -aR sleep 1
      
        -----
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Naohiro Aota <naota@elisp.net>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20150612050820.20548.41625.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      35a23ff9
  6. 12 6月, 2015 3 次提交
    • I
      Merge tag 'perf-core-for-mingo' of... · 61d67d56
      Ingo Molnar 提交于
      Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core improvements and fixes:
      
      User visible changes:
      
        - Beautify the perf_event_open() syscall in 'perf trace'. (Arnaldo Carvalho de Melo)
      
        - Error out unsupported group leader immediately in 'perf stat'. (Kan Liang)
      
        - Amend some 'perf record' option summaries (period, etc). (Peter Zijlstra)
      
        - Avoid possible race condition in copyfile() in 'perf buildid-cache'. (Milos Vyletel)
      
      Infrastructure changes:
      
        - Display 0x for hex values when printing the attribute. (Adrian Hunter)
      
        - Update MANIFEST per files removed from kernel. (David Ahern)
      
      Build fixes:
      
        - Fix PRIu64 printf related failure on 32-bit arch. (He Kuang)
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      61d67d56
    • D
      perf tools: Update MANIFEST per files removed from kernel · c8ad7063
      David Ahern 提交于
      Building perf out of kernel tree is currently broken because the
      MANIFEST file refers to kernel files that have been removed. With this
      patch make perf-targz-src-pkg succeeds as does building perf using the
      generated tarfile.
      Signed-off-by: NDavid Ahern <david.ahern@oracle.com>
      Link: http://lkml.kernel.org/r/1433526173-172332-1-git-send-email-david.ahern@oracle.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c8ad7063
    • A
      trace: Beautify perf_event_open syscall · a1c2552d
      Arnaldo Carvalho de Melo 提交于
      Syswide tracing and then running 'stat' and 'trace':
      
       $ perf trace -e perf_event_open
       1034.649 (0.019 ms): perf/6133 perf_event_open(attr_uptr: 0x36f0360, pid: 16134, cpu: -1, group_fd: -1, flags: FD_CLOEXEC) = -1 EINVAL Invalid argument
       1034.670 (0.008 ms): perf/6133 perf_event_open(attr_uptr: 0x36f0360, pid: 16134, cpu: -1, group_fd: -1) = -1 EINVAL Invalid argument
       1034.681 (0.007 ms): perf/6133 perf_event_open(attr_uptr: 0x36f0360, pid: 16134, cpu: -1, group_fd: -1) = -1 EINVAL Invalid argument
       1034.692 (0.007 ms): perf/6133 perf_event_open(attr_uptr: 0x36f0360, pid: 16134, cpu: -1, group_fd: -1) = -1 EINVAL Invalid argument
       9986.983 (0.014 ms): trace/6139 perf_event_open(attr_uptr: 0x7ffd9c629320, pid: -1, group_fd: -1, flags: FD_CLOEXEC) = 3
       9987.026 (0.016 ms): trace/6139 perf_event_open(attr_uptr: 0x37c7e70, pid: -1, group_fd: -1, flags: FD_CLOEXEC) = 3
       9987.041 (0.008 ms): trace/6139 perf_event_open(attr_uptr: 0x37c7e70, pid: -1, group_fd: -1, flags: FD_CLOEXEC) = 3
       9987.489 (0.092 ms): trace/6139 perf_event_open(attr_uptr: 0x3795ee0, pid: 16140, group_fd: -1, flags: FD_CLOEXEC) = 3
       9987.536 (0.044 ms): trace/6139 perf_event_open(attr_uptr: 0x3795ee0, pid: 16140, cpu: 1, group_fd: -1, flags: FD_CLOEXEC) = 4
       9987.580 (0.041 ms): trace/6139 perf_event_open(attr_uptr: 0x3795ee0, pid: 16140, cpu: 2, group_fd: -1, flags: FD_CLOEXEC) = 5
       9987.620 (0.037 ms): trace/6139 perf_event_open(attr_uptr: 0x3795ee0, pid: 16140, cpu: 3, group_fd: -1, flags: FD_CLOEXEC) = 7
       9987.659 (0.035 ms): trace/6139 perf_event_open(attr_uptr: 0x37975d0, pid: 16140, group_fd: -1, flags: FD_CLOEXEC) = 8
       9987.692 (0.031 ms): trace/6139 perf_event_open(attr_uptr: 0x37975d0, pid: 16140, cpu: 1, group_fd: -1, flags: FD_CLOEXEC) = 9
       9987.727 (0.032 ms): trace/6139 perf_event_open(attr_uptr: 0x37975d0, pid: 16140, cpu: 2, group_fd: -1, flags: FD_CLOEXEC) = 10
       9987.761 (0.031 ms): trace/6139 perf_event_open(attr_uptr: 0x37975d0, pid: 16140, cpu: 3, group_fd: -1, flags: FD_CLOEXEC) = 11
      
      Need to intercept perf_copy_attr() with a kprobe or with eBPF...
      
      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>
      Link: http://lkml.kernel.org/n/tip-njb105hab2i3t5dexym9lskl@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a1c2552d
  7. 11 6月, 2015 3 次提交
  8. 10 6月, 2015 2 次提交
  9. 09 6月, 2015 1 次提交
  10. 08 6月, 2015 4 次提交