1. 28 10月, 2015 1 次提交
    • W
      perf tools: Make perf depend on libbpf · ed63f34c
      Wang Nan 提交于
      By adding libbpf into perf's Makefile, this patch enables perf to build
      libbpf if libelf is found and neither NO_LIBELF nor NO_LIBBPF is set.
      
      The newly introduced code is similar to how libapi and libtraceevent
      are wired into Makefile.perf.
      
      MANIFEST is also updated for 'make perf-*-src-pkg'.
      
      Append make_no_libbpf to tools/perf/tests/make.
      
      The 'bpf' feature check is appended into default FEATURE_TESTS and
      FEATURE_DISPLAY, so perf will check the API version of bpf in
      /path/to/kernel/include/uapi/linux/bpf.h. Which should not fail except
      when we are trying to port this code to an old kernel.
      
      Error messages are also updated to notify users about the lack of BPF
      support in 'perf record' if libelf is missing or the BPF API check
      failed.
      
      tools/lib/bpf is added to TAG_FOLDERS to allow us to navigate libbpf
      files when working on perf using tools/perf/tags.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NAlexei Starovoitov <ast@plumgrid.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Kaixu Xia <xiakaixu@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/1444826502-49291-2-git-send-email-wangnan0@huawei.com
      [ Document NO_LIBBPF in Makefile.perf, noted by Jiri Olsa ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ed63f34c
  2. 29 9月, 2015 3 次提交
  3. 14 9月, 2015 1 次提交
  4. 17 8月, 2015 1 次提交
  5. 21 7月, 2015 1 次提交
    • A
      perf trace: Support 'strace' syscall event groups · 005438a8
      Arnaldo Carvalho de Melo 提交于
      I.e.:
      
        $ cat ~/share/perf-core/strace/groups/file
        access
        chmod
        creat
        execve
        faccessat
        getcwd
        lstat
        mkdir
        open
        openat
        quotactl
        readlink
        rename
        rmdir
        stat
        statfs
        symlink
        unlink
        $
      
      Then, on a quiet desktop, try running this and then moving your mouse to
      see the deluge of mouse related activity:
      
        # perf probe 'vfs_getname=getname_flags:72 pathname=filename:string'
        Added new event:
          probe:vfs_getname    (on getname_flags:72 with pathname=filename:string)
      
        You can now use it in all perf tools, such as:
      
      	perf record -e probe:vfs_getname -aR sleep 1
        #
        # trace --ev probe:vfs_getname --filter-pids 2232 -e file
         0.042 (0.042 ms): mousetweaks/2235 open(filename: 0x14e3910, mode: 438                                   ) ...
         0.042 (        ): probe:vfs_getname:(ffffffff812230bc) pathname="/home/acme/.icons/Adwaita/cursors/xterm")
         0.100 (0.100 ms): mousetweaks/2235  ... [continued]: open()) = -1 ENOENT No such file or directory
         0.142 (0.018 ms): mousetweaks/2235 open(filename: 0x14c3c10, mode: 438                                   ) ...
         0.142 (        ): probe:vfs_getname:(ffffffff812230bc) pathname="/home/acme/.icons/Adwaita/index.theme")
         0.192 (0.069 ms): mousetweaks/2235  ... [continued]: open()) = -1 ENOENT No such file or directory
         0.230 (0.017 ms): mousetweaks/2235 open(filename: 0x14c3c10, mode: 438                                   ) ...
         0.230 (        ): probe:vfs_getname:(ffffffff812230bc) pathname="/usr/share/icons/Adwaita/cursors/xterm")
         0.253 (0.041 ms): mousetweaks/2235  ... [continued]: open()) = 14
         0.459 (0.008 ms): mousetweaks/2235 open(filename: 0x14e3910, mode: 438                                   ) ...
         0.459 (        ): probe:vfs_getname:(ffffffff812230bc) pathname="/home/acme/.icons/Adwaita/cursors/left_side")
         0.468 (0.017 ms): mousetweaks/2235  ... [continued]: open()) = -1 ENOENT No such file or directory
      
      Need to combine that raw_syscalls:sys_enter(open) + probe:vfs_getname +
      raw_syscalls:sys_exit(open) sequence...
      
      Now, if you're bored, please write some more syscall groups, like the ones
      in 'strace' and send it our way :-)
      
      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: Milian Wolff <mail@milianw.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-a42xklu59lcbxp7bbnic74a8@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      005438a8
  6. 15 7月, 2015 1 次提交
    • A
      perf tools: Really allow to specify custom CC, AR or LD · 3c71ba3f
      Alexey Brodkin 提交于
      Commit 5ef7bbb0 ("perf tools: Allow to specify custom linker
      command") was meant to enable usage non $(CROSS_COMPILE)ld linker during
      perf building.
      
      But implementation didn't take into account the fact that LD is a
      pre-defined variable in GNU Make. I.e. it is always defined.
      
      Which means there's no point to check "LD ?= ..." because it will never
      succeed.
      
      And so LD will be either that explicitly passed to make like this:
      
       ------->8-------
       make LD=path_to_my_ld ...
       ------->8-------
       or default value, which is host's "ld".
      
      Latter leads to failure of cross-linkage because instead of cross linker
      "$(CROSS_COMPILE)ld" host's "ld" is used.
      
      Fortunately there's a way to do correct substitution of $(CROSS_COMPILE)ld
      with user defined LD on command-line.
      
      As a reference was used implementation in "tools/lib/traceevent/Makefile".
      
      Build tested for x86_64 and ARC.
      
      Thanks Jiri for this hint.
      Signed-off-by: NAlexey Brodkin <abrodkin@synopsys.com>
      Fixes: 5ef7bbb0 ("perf tools: Allow to specify custom linker command")
      Cc: Aaro Koskinen <aaro.koskinen@nokia.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Vineet Gupta <Vineet.Gupta1@synopsys.com>
      Cc: Vineet Gupta <vgupta@synopsys.com>
      Cc: linux-arch@vger.kernel.org
      Link: http://lkml.kernel.org/r/1436864720-26316-1-git-send-email-abrodkin@synopsys.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3c71ba3f
  7. 02 7月, 2015 2 次提交
  8. 18 6月, 2015 1 次提交
  9. 16 6月, 2015 1 次提交
    • W
      tools lib traceevent: Fix python/perf.so compiling error · a35489a6
      Wang Nan 提交于
      'make build-test' finds an error that make_python_perf_so fails due to
      missing of libtraceevent-dynamic-list:
      
       '.../python2' util/setup.py \
         --quiet build_ext; \
         mkdir -p python && \
         cp python_ext_build/lib/perf.so python/
         /path/to/ld: cannot open linker script file /path/to/kernel/tools/lib/traceevent/libtraceevent-dynamic-list: No such file or directory
         collect2: error: ld returned 1 exit status
         error: command 'x86_64-linux-gcc' failed with exit status 1
         cp: cannot stat 'python_ext_build/lib/perf.so': No such file or directory
         make[3]: *** [python/perf.so] Error 1
         make[2]: *** [python/perf.so] Error 2
           test: test -f ./python/perf.so
           make[1]: *** [make_python_perf_so] Error 1
           make: *** [build-test] Error 2
           make: Leaving directory `/path/to/kernel/tools/perf'
      
      This is caused by commit e3d09ec8
      ("tools lib traceevent: Export dynamic symbols used by traceevent
      plugins") that, it adds the list file to LDFLAGS but forgot to add it to
      dependency list of python/perf.so.
      
      This patch fixes this problem.
      Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Zefan Li <lizefan@huawei.com>
      Link: http://lkml.kernel.org/r/1434079031-123162-1-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a35489a6
  10. 08 6月, 2015 1 次提交
    • H
      tools lib traceevent: Export dynamic symbols used by traceevent plugins · e3d09ec8
      He Kuang 提交于
      Traceevent plugins need dynamic symbols exported from libtraceevent.a,
      otherwise a dlopen error will occur during plugins loading.
      
      This patch uses dynamic-list-file to export dynamic symbols which will
      be used in plugins to perf executable.
      
      The problem is covered up if feature-libpython is enabled, because
      PYTHON_EMBED_LDOPTS contains '-Xlinker --export-dynamic' which adds all
      symbols to the dynamic symbol table. So we should reproduce the problem
      by setting NO_LIBPYTHON=1.
      
      Before this patch:
      
        (Prepare plugins)
        $ ls /root/.traceevent/plugins/
        plugin_sched_switch.so
        plugin_function.so
        ...
      
        $ perf record -e 'ftrace:function' ls
      
        $ perf script
          Warning: could not load plugin '/mnt/data/root/.traceevent/plugins/plugin_sched_switch.so'
          /root/.traceevent/plugins/plugin_sched_switch.so: undefined symbol: pevent_unregister_event_handler
      
          Warning: could not load plugin '/root/.traceevent/plugins/plugin_function.so'
          /root/.traceevent/plugins/plugin_function.so: undefined symbol: warning
          ...
                 :1049  1049 [000]  9666.754487: ftrace:function:  ffffffff8118bc50 <-- ffffffff8118c5b3
                 :1049  1049 [000]  9666.754487: ftrace:function:  ffffffff818e2440 <-- ffffffff8118bc75
                 :1049  1049 [000]  9666.754487: ftrace:function:  ffffffff8106eee0 <-- ffffffff811212e2
      
      After this patch:
      
        $ perf record -e 'ftrace:function' ls
        $ perf script
                 :1049  1049 [000]  9666.754487: ftrace:function: __set_task_comm
                 :1049  1049 [000]  9666.754487: ftrace:function:    _raw_spin_lock
                 :1049  1049 [000]  9666.754487: ftrace:function: task_tgid_nr_ns
                 ...
      Signed-off-by: NHe Kuang <hekuang@huawei.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1432819735-35040-1-git-send-email-hekuang@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e3d09ec8
  11. 27 5月, 2015 1 次提交
  12. 06 5月, 2015 1 次提交
  13. 30 3月, 2015 1 次提交
  14. 22 3月, 2015 2 次提交
  15. 19 3月, 2015 2 次提交
  16. 12 3月, 2015 1 次提交
    • A
      perf tools: Output feature detection's gcc output to a file · 443a7054
      Arnaldo Carvalho de Melo 提交于
      So that we can debug feature detection problems.
      
      It will appear on $(OUTPUT)feature-checks/.make-libbabeltrace.output,
      using the libbabeltrace feature test.
      
      Whole process:
      
        [acme@ssdandy linux]$ make -C tools/perf install-bin
        make: Entering directory `/home/acme/git/linux/tools/perf'
          BUILD:   Doing 'make -j8' parallel build
        config/Makefile:425: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
        config/Makefile:709: No libbabeltrace found, disables 'perf data' CTF format support, please install libbabeltrace-dev[el]/libbabeltrace-ctf-dev
      
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...                         glibc: [ on  ]
        ...                          gtk2: [ on  ]
        ...                      libaudit: [ on  ]
        ...                        libbfd: [ on  ]
        ...                        libelf: [ on  ]
        ...                       libnuma: [ on  ]
        ...                       libperl: [ on  ]
        ...                     libpython: [ on  ]
        ...                      libslang: [ on  ]
        ...                     libunwind: [ OFF ]
        ...            libdw-dwarf-unwind: [ on  ]
        ...                 libbabeltrace: [ OFF ]
        <SNIP>
        [acme@ssdandy linux]$ find tools/perf -name ".make-*.output" | grep lib | tail -5
        tools/perf/config/feature-checks/.make-libdw-dwarf-unwind.output
        tools/perf/config/feature-checks/.make-libbabeltrace.output
        tools/perf/config/feature-checks/.make-zlib.output
        tools/perf/config/feature-checks/.make-liberty.output
        tools/perf/config/feature-checks/.make-liberty-z.output
        [acme@ssdandy linux]$
        [acme@ssdandy linux]$ cat tools/perf/config/feature-checks/.make-libbabeltrace.output
        make[1]: Entering directory `/home/acme/git/linux/tools/perf/config/feature-checks'
        gcc -MD  -Wall -Werror -o test-libbabeltrace.bin test-libbabeltrace.c -Wl,-z,noexecstack  -lbabeltrace-ctf # -lbabeltrace provided by
        test-libbabeltrace.c:2:42: fatal error: babeltrace/ctf-writer/writer.h: No such file or directory
          #include <babeltrace/ctf-writer/writer.h>
                                                ^
        compilation terminated.
        make[1]: *** [test-libbabeltrace.bin] Error 1
        make[1]: Leaving directory `/home/acme/git/linux/tools/perf/config/feature-checks'
        [acme@ssdandy linux]$
      
      So the libbabeltrace feature will not be builtin, but if we do what is required for it
      to be built, namely point where we have it installed:
      
        [acme@ssdandy linux]$ time make -C tools/perf LIBBABELTRACE_DIR=/opt/libbabeltrace install-bin
        make: Entering directory `/home/acme/git/linux/tools/perf'
          BUILD:   Doing 'make -j8' parallel build
        config/Makefile:425: No libunwind found. Please install libunwind-dev[el] >= 1.1 and/or set LIBUNWIND_DIR
      
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...                         glibc: [ on  ]
        ...                          gtk2: [ on  ]
        ...                      libaudit: [ on  ]
        ...                        libbfd: [ on  ]
        ...                        libelf: [ on  ]
        ...                       libnuma: [ on  ]
        ...                       libperl: [ on  ]
        ...                     libpython: [ on  ]
        ...                      libslang: [ on  ]
        ...                     libunwind: [ OFF ]
        ...            libdw-dwarf-unwind: [ on  ]
        ...                 libbabeltrace: [ on  ]
        ...                          zlib: [ on  ]
        ...     DWARF post unwind library: libdw
        <SNIP>
        [acme@ssdandy linux]$ find tools/perf -name ".make-libbabel*.output" | grep lib | tail -5
        tools/perf/config/feature-checks/.make-libbabeltrace.output
        [acme@ssdandy linux]$ cat tools/perf/config/feature-checks/.make-libbabeltrace.output
        make[1]: Entering directory `/home/acme/git/linux/tools/perf/config/feature-checks'
        gcc -MD -I/opt/libbabeltrace/include -Wall -Werror -o test-libbabeltrace.bin test-libbabeltrace.c -Wl,-z,noexecstack -L/opt/libbabeltrace/lib -lbabeltrace-ctf # -lbabeltrace provided by
        make[1]: Leaving directory `/home/acme/git/linux/tools/perf/config/feature-checks'
        [acme@ssdandy linux]$
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jeremie Galarneau <jgalar@efficios.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-h53xwueqwdeeiqcv9f50nqqb@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      443a7054
  17. 25 2月, 2015 1 次提交
    • J
      perf tools: Add feature check for libbabeltrace · 53d0a573
      Jiri Olsa 提交于
      Adding feature check for babeltrace library [1], which will be used for
      perf data file CTF [2] conversion in following patches.
      
      The babeltrace library is now automatically detected as standard
      feature. It's possible to specify LIBBABELTRACE_DIR make variable to
      specify location of installed libbabeltrace, like:
      
        $ make LIBBABELTRACE_DIR=/opt/libbabeltrace/
          BUILD:   Doing 'make -j4' parallel build
      
        Auto-detecting system features:
        ...                         dwarf: [ on  ]
        ...                         glibc: [ on  ]
        ...                          gtk2: [ on  ]
        ...                      libaudit: [ on  ]
        ...                        libbfd: [ on  ]
        ...                        libelf: [ on  ]
        ...                       libnuma: [ on  ]
        ...                       libperl: [ on  ]
        ...                     libpython: [ on  ]
        ...                      libslang: [ on  ]
        ...                     libunwind: [ on  ]
        ...                 libbabeltrace: [ on  ]
        ...            libdw-dwarf-unwind: [ on  ]
        ...                          zlib: [ on  ]
        ...     DWARF post unwind library: libunwind
      
      NOTE The installation of the [1] to to used by above make:
           $ git clone git://git.efficios.com/babeltrace.git
           $ cd babeltrace
           $ vim README
           $ ./bootstrap
           $ ./configure --prefix=/opt/libbabeltrace
           $ make prefix=/opt/libbabeltrace
           $ sudo make install prefix=/opt/libbabeltrace
      
      Please make sure that the /opt/libbabeltrace/lib directory is in your
      LD_LIBRARY_PATH:
      
       $ export LD_LIBRARY_PATH=/opt/libbabeltrace/lib
      
      [1] babeltrace - http://www.efficios.com/babeltrace
      [2] Common Trace Format - http://www.efficios.com/ctfSigned-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NNamhyung Kim <namhyung@kernel.org>
      Reviewed-by: NDavid Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jeremie Galarneau <jgalar@efficios.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1424470628-5969-2-git-send-email-jolsa@kernel.orgSigned-off-by: NSebastian Andrzej Siewior <bigeasy@linutronix.de>
      [ Added missing babeltrace build instructions ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      53d0a573
  18. 13 2月, 2015 10 次提交
  19. 12 2月, 2015 8 次提交