1. 25 Jul, 2016 3 commits
  2. 22 Jul, 2016 5 commits
  3. 21 Jul, 2016 3 commits
  4. 20 Jul, 2016 1 commit
  5. 19 Jul, 2016 1 commit
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-20160718' of... · 5048c2af
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-20160718' 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:
      
       - Properly report when a function wildcard produces no matches in 'perf probe'
         (Masami Hiramatsu)
      
       - Balance opening and reading events in 'perf stat', which could cause
         it to get stuck trying to close invalid file descriptors (Mark Rutland)
      
      Infrastructure changes:
      
       - Copy more headers from the kernel, this time for headers that
         were just including the contents of its kernel counterparts, should
         help resolving the problems with linux-next, where some uapi related
         patches seem to be breaking tools/object/ build. (Arnaldo Carvalho de Melo)
      
         Some more combing will be done, but at least it is possible to build
         perf out of tree, via a detached tarball (make help | grep perf),
         without including kernel files in its MANIFEST (Arnaldo Carvalho de Melo)
      
       - Fix smatch found errors that were not causing problems, but are
         mistakes nonetheless (Dan Carpenter)
      
       - Fix string vs. byte array resolving in the python script code (Jiri Olsa)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      5048c2af
  6. 18 Jul, 2016 15 commits
  7. 16 Jul, 2016 1 commit
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo-20160715' of... · 09211e25
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo-20160715' 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:
      
       - Allow reading from a backward ring buffer (one setup via sys_perf_event_open()
         with perf_event_attr.write_backward = 1) (Wang Nan)
      
      Infrastructure changes:
      
       - Fix the build on Android NDK r12b (initially just for ARM), that is now port
         of my perf-build container collection and will get tested prior to sending
         patches upstream (Arnaldo Carvalho de Melo)
      
       - Add correct header for IPv6 definitions
      
       - Fix bitsperlong.h fallout (Arnaldo Carvalho de Melo, Peter Zijlstra)
      
       - Use base 0 (auto) in filename__read_ull(), so that we can handle hex values too (Jiri Olsa)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      09211e25
  8. 15 Jul, 2016 11 commits
    • Arnaldo Carvalho de Melo's avatar
      objtool: Initialize variable to silence old compiler · b49364f3
      Arnaldo Carvalho de Melo authored
      gcc version 4.1.2 20080704 (Red Hat 4.1.2-55) barfs with:
      
          CC       /tmp/build/objtool/builtin-check.o
        cc1: warnings being treated as errors
        builtin-check.c: In function 'cmd_check':
        builtin-check.c:667: warning: 'prev_rela' may be used uninitialized in this function
        mv: cannot stat `/tmp/build/objtool/.builtin-check.o.tmp': No such file or directory
        make[1]: *** [/tmp/build/objtool/builtin-check.o] Error 1
      
      Init it to NULL to silence it.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-qolo31rl2ojlwj1lj9dhemyz@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b49364f3
    • Arnaldo Carvalho de Melo's avatar
      objtool: Add -I$(srctree)/tools/arch/$(ARCH)/include/uapi · 4a0982f9
      Arnaldo Carvalho de Melo authored
      So that it can find asm/bitsperlong.h to get the __BITS_PER_LONG
      definition.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-pr3pvskh65pey4po7t122z4j@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4a0982f9
    • Wang Nan's avatar
      perf record: Add --tail-synthesize option · 4ea648ae
      Wang Nan authored
      When working with overwritable ring buffer there's a inconvenience
      problem: if perf dumps data after a long period after it starts,
      non-sample events may lost, which makes following 'perf report' unable
      to identify proc name and mmap layout. For example:
      
       # perf record -m 4 -e raw_syscalls:* -g --overwrite --switch-output \
              dd if=/dev/zero of=/dev/null
      
      send SIGUSR2 after dd runs long enough. The resuling perf.data lost
      correct comm and mmap events:
      
       # perf script -i perf.data.2016061522374354
       perf 24478 [004] 2581325.601789:  raw_syscalls:sys_exit: NR 0 = 512
       ^^^^
       Should be 'dd'
                         27b2e8 syscall_slow_exit_work+0xfe2000e3 (/lib/modules/4.6.0-rc3+/build/vmlinux)
                         203cc7 do_syscall_64+0xfe200117 (/lib/modules/4.6.0-rc3+/build/vmlinux)
                         b18d83 return_from_SYSCALL_64+0xfe200000 (/lib/modules/4.6.0-rc3+/build/vmlinux)
                   7f47c417edf0 [unknown] ([unknown])
                   ^^^^^^^^^^^^
                   Fail to unwind
      
      This patch provides a '--tail-synthesize' option, allows perf to collect
      system status when finalizing output file. In resuling output file, the
      non-sample events reflect system status when dumping data.
      
      After this patch:
       # perf record -m 4 -e raw_syscalls:* -g --overwrite --switch-output --tail-synthesize \
              dd if=/dev/zero of=/dev/null
      
       # perf script -i perf.data.2016061600544998
       dd 27364 [004] 2583244.994464: raw_syscalls:sys_enter: NR 1 (1, ...
       ^^
       Correct comm
                         203a18 syscall_trace_enter_phase2+0xfe2001a8 ([kernel.kallsyms])
                         203aa5 syscall_trace_enter+0xfe200055 ([kernel.kallsyms])
                         203caa do_syscall_64+0xfe2000fa ([kernel.kallsyms])
                         b18d83 return_from_SYSCALL_64+0xfe200000 ([kernel.kallsyms])
                          d8e50 __GI___libc_write+0xffff01d9639f4010 (/tmp/oxygen_root-w00229757/lib64/libc-2.18.so)
                          ^^^^^
                          Correct unwind
      
      This option doesn't aim to solve this problem completely. If a process
      terminates before SIGUSR2, we still lost its COMM and MMAP events. For
      example, we can't unwind correctly from the final perf.data we get from
      the previous example, because when perf collects the final output file
      (when we press C-c), 'dd' has been terminated so its '/proc/<pid>/mmap'
      becomes empty.
      
      However, this is a cheaper choice. To completely solve this problem we
      need to continously output non-sample events. To satisify the
      requirement of daemonization, we need to merge them periodically. It is
      possible but requires much more code and cycles.
      
      Automatically select --tail-synthesize when --overwrite is provided.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nilay Vaish <nilayvaish@gmail.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1468485287-33422-16-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4ea648ae
    • Wang Nan's avatar
      perf session: Don't warn about out of order event if write_backward is used · f06149c0
      Wang Nan authored
      If write_backward attribute is set, records are written into kernel
      ring buffer from end to beginning, but read from beginning to end.
      To avoid 'XX out of order events recorded' warning message (timestamps
      of records is in reverse order when using write_backward), suppress the
      warning message if write_backward is selected by at lease one event.
      
      Result:
      
      Before this patch:
        # perf record -m 1 -e raw_syscalls:sys_exit/overwrite/ \
                           -e raw_syscalls:sys_enter \
                           dd if=/dev/zero of=/dev/null count=300
        300+0 records in
        300+0 records out
        153600 bytes (154 kB) copied, 0.000601617 s, 255 MB/s
        [ perf record: Woken up 5 times to write data ]
        Warning:
        40 out of order events recorded.
        [ perf record: Captured and wrote 0.096 MB perf.data (696 samples) ]
      
      After this patch:
        # perf record -m 1 -e raw_syscalls:sys_exit/overwrite/ \
                           -e raw_syscalls:sys_enter \
                           dd if=/dev/zero of=/dev/null count=300
        300+0 records in
        300+0 records out
        153600 bytes (154 kB) copied, 0.000644873 s, 238 MB/s
        [ perf record: Woken up 5 times to write data ]
        [ perf record: Captured and wrote 0.096 MB perf.data (696 samples) ]
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nilay Vaish <nilayvaish@gmail.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1468485287-33422-15-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarHe Kuang <hekuang@huawei.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f06149c0
    • Wang Nan's avatar
      perf tools: Enable overwrite settings · 626a6b78
      Wang Nan authored
      This patch allows following config terms and option:
      
      Globally setting events to overwrite;
      
        # perf record --overwrite ...
      
      Set specific events to be overwrite or no-overwrite.
      
        # perf record --event cycles/overwrite/ ...
        # perf record --event cycles/no-overwrite/ ...
      
      Add missing config terms and update the config term array size because
      the longest string length has changed.
      
      For overwritable events, it automatically selects attr.write_backward
      since perf requires it to be backward for reading.
      
      Test result:
      
        # perf record --overwrite -e syscalls:*enter_nanosleep* usleep 1
        [ perf record: Woken up 2 times to write data ]
        [ perf record: Captured and wrote 0.011 MB perf.data (1 samples) ]
        # perf evlist -v
        syscalls:sys_enter_nanosleep: type: 2, size: 112, config: 0x134, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CPU|PERIOD|RAW, disabled: 1, inherit: 1, mmap: 1, comm: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1, write_backward: 1
        # Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nilay Vaish <nilayvaish@gmail.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1468485287-33422-14-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarHe Kuang <hekuang@huawei.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      626a6b78
    • Wang Nan's avatar
      perf evlist: Make {pause,resume} internal helpers · f6cdff83
      Wang Nan authored
      There's no user of these two function outside evlist.c. Remove them from
      public namespace.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nilay Vaish <nilayvaish@gmail.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1468485287-33422-13-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f6cdff83
    • Wang Nan's avatar
      perf record: Read from overwritable ring buffer · 05737464
      Wang Nan authored
      Drive the evlist->bkw_mmap_state state machine during draining and when
      SIGUSR2 is received. Read the backward ring buffer in record__mmap_read_all.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nilay Vaish <nilayvaish@gmail.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1468485287-33422-12-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarHe Kuang <hekuang@huawei.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      05737464
    • Wang Nan's avatar
      perf evlist: Setup backward mmap state machine · 54cc54de
      Wang Nan authored
      Introduce a bkw_mmap_state state machine to evlist:
      
                           .________________(forbid)_____________.
                           |                                     V
       NOTREADY --(0)--> RUNNING --(1)--> DATA_PENDING --(2)--> EMPTY
                           ^  ^              |   ^               |
                           |  |__(forbid)____/   |___(forbid)___/|
                           |                                     |
                            \_________________(3)_______________/
      
       NOTREADY     : Backward ring buffers are not ready
       RUNNING      : Backward ring buffers are recording
       DATA_PENDING : We are required to collect data from backward ring buffers
       EMPTY        : We have collected data from backward ring buffers.
      
       (0): Setup backward ring buffer
       (1): Pause ring buffers for reading
       (2): Read from ring buffers
       (3): Resume ring buffers for recording
      
      We can't avoid this complexity. Since we deliberately drop records from
      overwritable ring buffer, there's no way for us to check remaining from
      ring buffer itself (by checking head and old pointers). Therefore, we
      need DATA_PENDING and EMPTY state to help us recording what we have done
      to the ring buffer.
      
      In record__mmap_read_evlist(), drive this state machine from DATA_PENDING
      to EMPTY.
      
      In perf_evlist__mmap_per_evsel(), drive this state machine from NOTREADY
      to RUNNING when creating backward mmap.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nilay Vaish <nilayvaish@gmail.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1468485287-33422-11-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      54cc54de
    • Wang Nan's avatar
      perf evlist: Drop evlist->backward · a0c6f451
      Wang Nan authored
      Now there's no real user of evlist->backward. Drop it. We are going to
      use evlist->backward_mmap as a container for backward ring buffer.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nilay Vaish <nilayvaish@gmail.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1468485287-33422-10-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a0c6f451
    • Wang Nan's avatar
      perf evlist: Map backward events to backward_mmap · 078c3386
      Wang Nan authored
      In perf_evlist__mmap_per_evsel(), select backward_mmap for backward
      events.  Utilize new perf_mmap APIs. Dynamically alloc backward_mmap.
      
      Remove useless functions.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nilay Vaish <nilayvaish@gmail.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1468485287-33422-9-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      078c3386
    • Wang Nan's avatar
      perf evlist: Introduce backward_mmap array for evlist · b2cb615d
      Wang Nan authored
      Add backward_mmap to evlist, free it together with normal mmap.
      
      Improve perf_evlist__pick_pc(), search backward_mmap if evlist->mmap is
      not available.
      
      This patch doesn't alloc this array. It will be allocated conditionally
      in the following commits.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Nilay Vaish <nilayvaish@gmail.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1468485287-33422-8-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b2cb615d