1. 19 7月, 2016 1 次提交
  2. 14 7月, 2016 1 次提交
  3. 13 7月, 2016 5 次提交
  4. 23 6月, 2016 1 次提交
    • H
      perf tools: Let python use correct gcc for build_ext · 48d8d5db
      He Kuang 提交于
      Currently, python uses host gcc instead of cross-compile gcc in the last
      step of compiling build_ext(remove '--quiet' to show verbose):
      
        cross-gcc ...
        cross-gcc ...
        creating ~/out/python_ext_build/lib
        gcc -pthread -shared -Wl,-z ...
      
      This is wrong but may not cause any errors unless the features detected
      by cross-compiler do not match those for host compiler, and causes the
      following errors:
      
        /usr/lib64/gcc/bin/ld: cannot find -lunwind-x86
        collect2: error: ld returned 1 exit status
        error: command 'gcc' failed with exit status 1
        cp: cannot stat ‘~/out/python_ext_build/lib/perf.so’: No such file or directory
        Makefile.perf:257: recipe for target '~/out/python/perf.so' failed
        make[1]: *** [~/out/python/perf.so] Error 1
        Makefile:68: recipe for target 'all' failed
        make: *** [all] Error 2
      
      This issue is also reported and anwsered on stackoverflow.
      Link: http://stackoverflow.com/questions/5986256/python-distutils-gcc-pathSigned-off-by: NHe Kuang <hekuang@huawei.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ekaterina Tumanova <tumanova@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Josh Poimboeuf <jpoimboe@redhat.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Pekka Enberg <penberg@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1466578626-92406-5-git-send-email-hekuang@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      48d8d5db
  5. 08 4月, 2016 1 次提交
    • A
      perf tools: Build syscall table .c header from kernel's syscall_64.tbl · 1b700c99
      Arnaldo Carvalho de Melo 提交于
      We used libaudit to map ids to syscall names and vice-versa, but that
      imposes a delay in supporting new syscalls, having to wait for libaudit
      to get those new syscalls on its tables.
      
      To remove that delay, for x86_64 initially, grab a copy of
      arch/x86/entry/syscalls/syscall_64.tbl and use it to generate those
      tables.
      
      Syscalls currently not available in audit-libs:
      
        # trace -e copy_file_range,membarrier,mlock2,pread64,pwrite64,timerfd_create,userfaultfd
        Error:	Invalid syscall copy_file_range, membarrier, mlock2, pread64, pwrite64, timerfd_create, userfaultfd
        Hint:	try 'perf list syscalls:sys_enter_*'
        Hint:	and: 'man syscalls'
        #
      
      With this patch:
      
        # trace -e copy_file_range,membarrier,mlock2,pread64,pwrite64,timerfd_create,userfaultfd
          8505.733 ( 0.010 ms): gnome-shell/2519 timerfd_create(flags: 524288) = 36
          8506.688 ( 0.005 ms): gnome-shell/2519 timerfd_create(flags: 524288) = 40
         30023.097 ( 0.025 ms): qemu-system-x8/24629 pwrite64(fd: 18, buf: 0x7f63ae382000, count: 4096, pos: 529592320) = 4096
         31268.712 ( 0.028 ms): qemu-system-x8/24629 pwrite64(fd: 18, buf: 0x7f63afd8b000, count: 4096, pos: 2314133504) = 4096
         31268.854 ( 0.016 ms): qemu-system-x8/24629 pwrite64(fd: 18, buf: 0x7f63afda2000, count: 4096, pos: 2314137600) = 4096
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-51xfjbxevdsucmnbc4ka5r88@git.kernel.org
      [ Added make dep for 'prepare' in 'LIBPERF_IN', fix by Wang Nan to fix parallell build ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1b700c99
  6. 06 4月, 2016 1 次提交
  7. 19 3月, 2016 1 次提交
  8. 12 2月, 2016 1 次提交
  9. 05 2月, 2016 1 次提交
  10. 27 1月, 2016 1 次提交
  11. 26 1月, 2016 1 次提交
    • W
      perf test: Add libbpf relocation checker · 7b6982ce
      Wang Nan 提交于
      There's a bug in LLVM that it can generate unneeded relocation
      information. See [1] and [2]. Libbpf should check the target section of
      a relocation symbol.
      
      This patch adds a testcase which references a global variable (BPF
      doesn't support global variables). Before fixing libbpf, the new test
      case can be loaded into kernel, the global variable acts like the first
      map. It is incorrect.
      
      Result:
      
        # ~/perf test BPF
        37: Test BPF filter                                          :
        37.1: Test basic BPF filtering                               : Ok
        37.2: Test BPF prologue generation                           : Ok
        37.3: Test BPF relocation checker                            : FAILED!
      
        # ~/perf test -v BPF
        ...
        libbpf: loading object '[bpf_relocation_test]' from buffer
        libbpf: section .strtab, size 126, link 0, flags 0, type=3
        libbpf: section .text, size 0, link 0, flags 6, type=1
        libbpf: section .data, size 0, link 0, flags 3, type=1
        libbpf: section .bss, size 0, link 0, flags 3, type=8
        libbpf: section func=sys_write, size 104, link 0, flags 6, type=1
        libbpf: found program func=sys_write
        libbpf: section .relfunc=sys_write, size 16, link 10, flags 0, type=9
        libbpf: section maps, size 16, link 0, flags 3, type=1
        libbpf: maps in [bpf_relocation_test]: 16 bytes
        libbpf: section license, size 4, link 0, flags 3, type=1
        libbpf: license of [bpf_relocation_test] is GPL
        libbpf: section version, size 4, link 0, flags 3, type=1
        libbpf: kernel version of [bpf_relocation_test] is 40400
        libbpf: section .symtab, size 144, link 1, flags 0, type=2
        libbpf: map 0 is "my_table"
        libbpf: collecting relocating info for: 'func=sys_write'
        libbpf: relocation: insn_idx=7
        Success unexpectedly: libbpf error when dealing with relocation
        test child finished with -1
        ---- end ----
        Test BPF filter subtest 2: FAILED!
      
      [1] https://llvm.org/bugs/show_bug.cgi?id=26243
      [2] https://patchwork.ozlabs.org/patch/571385/Signed-off-by: NWang Nan <wangnan0@huawei.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1453715801-7732-2-git-send-email-wangnan0@huawei.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      7b6982ce
  12. 16 1月, 2016 2 次提交
  13. 09 1月, 2016 1 次提交
    • N
      perf report: Show random usage tip on the help line · 14cbfbeb
      Namhyung Kim 提交于
      Currently perf report only shows a help message "For a higher level
      overview, try: perf report --sort comm,dso" unconditionally (even if
      the sort keys were used).  Add more help tips and show randomly.
      
      Load tips from ${prefix}/share/doc/perf-tip/tips.txt file.
      
        $ perf report | tail
            0.10%  swapper  [kernel.vmlinux]   [k] irq_exit
            0.09%  swapper  [kernel.vmlinux]   [k] flush_smp_call_function_queue
            0.08%  swapper  [kernel.vmlinux]   [k] native_write_msr_safe
            0.03%  swapper  [kernel.vmlinux]   [k] group_sched_in
            0.01%  perf     [kernel.vmlinux]   [k] native_write_msr_safe
      
        #
        # (Tip: Search options using a keyword: perf report -h <keyword>)
        #
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Cc: Andi Kleen <andi@firstfloor.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@kernel.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/1452166913-27046-1-git-send-email-namhyung@kernel.org
      [ Renamed it to perf_tip() and the parameter dirname to dirpath to fix the build on older distros ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      14cbfbeb
  14. 08 1月, 2016 1 次提交
  15. 07 1月, 2016 1 次提交
  16. 18 12月, 2015 1 次提交
  17. 14 12月, 2015 2 次提交
  18. 27 11月, 2015 1 次提交
    • J
      perf build: Fix traceevent plugins build race · 67befc65
      Jiri Olsa 提交于
      Ingo reported following build failure:
      
        $ make clean install
        ...
          CC       plugin_kmem.o
        fixdep: error opening depfile: ./.plugin_hrtimer.o.d: No such file or directory
        /home/mingo/tip/tools/build/Makefile.build:77: recipe for target
        'plugin_hrtimer.o' failed
        make[3]: *** [plugin_hrtimer.o] Error 2
        Makefile:189: recipe for target 'plugin_hrtimer-in.o' failed
        make[2]: *** [plugin_hrtimer-in.o] Error 2
        Makefile.perf:414: recipe for target 'libtraceevent_plugins' failed
        make[1]: *** [libtraceevent_plugins] Error 2
        make[1]: *** Waiting for unfinished jobs....
      
      Currently we have the install-traceevent-plugins target being dependent
      on $(LIBTRACEEVENT), which will actualy not build any plugin. So the
      install-traceevent-plugins target itself will try to build plugins,
      but..
      
      Plugins built is also triggered by perf build itself via
      libtraceevent_plugins target.
      
      This might cause a race having one make thread removing temp files from
      another and result in above error. Fixing this by having proper plugins
      build dependency before installing plugins.
      Reported-and-Tested-by: N: Ingo Molnar <mingo@kernel.org>
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1448546044-28973-3-git-send-email-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      67befc65
  19. 30 10月, 2015 1 次提交
  20. 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
  21. 29 9月, 2015 3 次提交
  22. 14 9月, 2015 1 次提交
  23. 17 8月, 2015 1 次提交
  24. 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
  25. 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
  26. 02 7月, 2015 2 次提交
  27. 18 6月, 2015 1 次提交
  28. 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
  29. 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
  30. 27 5月, 2015 1 次提交
  31. 06 5月, 2015 1 次提交