1. 29 Oct, 2015 6 commits
    • Wang Nan's avatar
      perf bpf: Attach eBPF filter to perf event · 1f45b1d4
      Wang Nan authored
      This is the final patch which makes basic BPF filter work. After
      applying this patch, users are allowed to use BPF filter like:
      
       # perf record --event ./hello_world.o ls
      
      A bpf_fd field is appended to 'struct evsel', and setup during the
      callback function add_bpf_event() for each 'probe_trace_event'.
      
      PERF_EVENT_IOC_SET_BPF ioctl is used to attach eBPF program to a newly
      created perf event. The file descriptor of the eBPF program is passed to
      perf record using previous patches, and stored into evsel->bpf_fd.
      
      It is possible that different perf event are created for one kprobe
      events for different CPUs. In this case, when trying to call the ioctl,
      EEXIST will be return. This patch doesn't treat it as an error.
      
      Committer note:
      
      The bpf proggie used so far:
      
        __attribute__((section("fork=_do_fork"), used))
        int fork(void *ctx)
        {
      	  return 0;
        }
      
        char _license[] __attribute__((section("license"), used)) = "GPL";
        int _version __attribute__((section("version"), used)) = 0x40300;
      
      failed to produce any samples, even with forks happening and it being
      running in system wide mode.
      
      That is because now the filter is being associated, and the code above
      always returns zero, meaning that all forks will be probed but filtered
      away ;-/
      
      Change it to 'return 1;' instead and after that:
      
        # trace --no-syscalls --event /tmp/foo.o
           0.000 perf_bpf_probe:fork:(ffffffff8109be30))
           2.333 perf_bpf_probe:fork:(ffffffff8109be30))
           3.725 perf_bpf_probe:fork:(ffffffff8109be30))
           4.550 perf_bpf_probe:fork:(ffffffff8109be30))
        ^C#
      
      And it works with all tools, including 'perf trace'.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei 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-8-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1f45b1d4
    • Jiri Olsa's avatar
      perf tools: Make sure fixdep is built before libbpf · 50f1e6d0
      Jiri Olsa authored
      While doing 'make -C tools/perf build-test':
      
         LD       fixdep-in.o
         LINK     fixdep
       /bin/sh: /home/acme/git/linux/tools/build/fixdep: Permission denied
       make[6]: *** [bpf.o] Error 1
       make[5]: *** [libbpf-in.o] Error 2
       make[4]: *** [/home/acme/git/linux/tools/lib/bpf/libbpf.a] Error 2
       make[4]: *** Waiting for unfinished jobs....
      
      The fixdep tool needs to be built as the first binary.  Libraries are
      built in paralel, so each of them needs to depend on fixdep target.
      Reported-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20151028204450.GA25553@krava.redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      50f1e6d0
    • Stephane Eranian's avatar
      perf script: Enable printing of branch stack · dc323ce8
      Stephane Eranian authored
      This patch improves perf script by enabling printing of the
      branch stack via the 'brstack' and 'brstacksym' arguments to
      the field selection option -F. The option is off by default
      and operates only if the perf.data file has branch stack content.
      
      The branches are printed in to/from pairs. The most recent branch
      is printed first. The number of branch entries vary based on the
      underlying hardware and filtering used.
      
      The brstack prints FROM/TO addresses in raw hexadecimal format.
      The brstacksym prints FROM/TO addresses in symbolic form wherever
      possible.
      
       $ perf script -F ip,brstack
        5d3000 0x401aa0/0x5d2000/M/-/-/-/0 ...
      
       $ perf script -F ip,brstacksym
        4011e0 noploop+0x0/noploop+0x0/P/-/-/0
      
      The notation F/T/M/X/A/C describes the attributes of the branch.
      F=from, T=to, M/P=misprediction/prediction, X=TSX, A=TSX abort, C=cycles (SKL)
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Yuanfang Chen <cyfmxc@gmail.com>
      Link: http://lkml.kernel.org/r/1441039273-16260-5-git-send-email-eranian@google.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      dc323ce8
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Add cmd string table to decode sys_bpf first arg · 729a7841
      Arnaldo Carvalho de Melo authored
       # perf trace -e bpf perf record -e /tmp/foo.o -a
         362.779 (0.130 ms): perf/3451 bpf(cmd: PROG_LOAD, uattr: 0x7ffe9a6825d0, size: 48) = 3
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexei Starovoitov <ast@plumgrid.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-2b0nknu53baz9e0wj4thcdd8@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      729a7841
    • Ingo Molnar's avatar
      Merge tag 'perf-ebpf-for-mingo' of... · 66a565c2
      Ingo Molnar authored
      Merge tag 'perf-ebpf-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull basic perf/ebpf integration:
      
       "Please see the changeset comments, but this is the very basic integration of
        perf with libbpf that, given a .o file built for the 'bpf' target with clang,
        will get it validated and loaded into the kernel via the sys_bpf syscall, which
        can be seen using 'perf trace' to trace the whole thing looking just for the
        bpf and perf_event_open syscalls:
      
          # perf trace -e bpf,perf_event_open perf record -g --event /tmp/foo.o -a
           362.779 ( 0.129 ms): perf/22408 bpf(cmd: 5, uattr: 0x7ffd4edb6db0, size: 48                           ) = 3
           384.192 ( 0.016 ms): perf/22408 perf_event_open(attr_uptr: 0x7ffd4edbace0, pid: -1, cpu: 3, group_fd: -1, flags: FD_CLOEXEC) = 5
           384.247 ( 0.038 ms): perf/22408 perf_event_open(attr_uptr: 0x37aedd8, pid: -1, group_fd: -1, flags: FD_CLOEXEC) = 5
           384.261 ( 0.007 ms): perf/22408 perf_event_open(attr_uptr: 0x37aedd8, pid: -1, group_fd: -1, flags: FD_CLOEXEC) = 5
           387.680 ( 3.413 ms): perf/22408 perf_event_open(attr_uptr: 0x3222f08, pid: -1, group_fd: -1, flags: FD_CLOEXEC) = 5
           387.688 ( 0.005 ms): perf/22408 perf_event_open(attr_uptr: 0x3222f08, pid: -1, cpu: 1, group_fd: -1, flags: FD_CLOEXEC) = 6
           387.693 ( 0.004 ms): perf/22408 perf_event_open(attr_uptr: 0x3222f08, pid: -1, cpu: 2, group_fd: -1, flags: FD_CLOEXEC) = 7
           387.698 ( 0.003 ms): perf/22408 perf_event_open(attr_uptr: 0x3222f08, pid: -1, cpu: 3, group_fd: -1, flags: FD_CLOEXEC) = 8
          ^C[ perf record: Woken up 1 times to write data ]
            [ perf record: Captured and wrote 0.221 MB perf.data (2 samples) ]
          # perf script
          bash 18389 [002] 83446.412607: perf_bpf_probe:fork: (ffffffff8109be30)
                          29be31 _do_fork (/lib/modules/4.3.0-rc6+/build/vmlinux)
                          96d662 tracesys_phase2 (/lib/modules/4.3.0-rc6+/build/vmlinux)
                           bd56c __libc_fork (/usr/lib64/libc-2.17.so)
                           413b2 make_child (/usr/bin/bash)
      
          bash 18389 [002] 83447.227255: perf_bpf_probe:fork: (ffffffff8109be30)
                          29be31 _do_fork (/lib/modules/4.3.0-rc6+/build/vmlinux)
                          96d662 tracesys_phase2 (/lib/modules/4.3.0-rc6+/build/vmlinux)
                           bd56c __libc_fork (/usr/lib64/libc-2.17.so)
                           413b2 make_child (/usr/bin/bash)
      
          # perf evlist -v
          perf_bpf_probe:fork: type: 2, size: 112, config: 0x6cf, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CALLCHAIN|CPU|PERIOD|RAW, disabled: 1, inherit: 1, mmap: 1, comm: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
          #
      
        More work is about to be reviewed, tested and merged that will allow the whole
        process of going from a .c file to an .o file via clang, etc to be done
        automagically. (Wang Nan)"
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      66a565c2
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo' of... · 6fc774ef
      Ingo Molnar authored
      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 from Arnaldo Carvalho de Melo:
      
      User visible changes:
      
        - Enable per-event perf_event_attr.inherit setting by config terms, i.e.
          this becomes possible:
      
              $ perf record -e cycles/inherit/ -e instructions/no-inherit/
      
          This affects the default, that can be changed globally using the --no-inherit
          option.
      
          This fine grained control appeared in the eBPF patchkit, but this added
          flexibility may end up being useful in other scenarios. (Wang Nan)
      
        - Setup pager when printing usage and help, we have long lists of options,
          better use the pager like we do with normal tooling output, i.e. when needed,
          and including any error messages in the paged output. (Namhyung Kim)
      
        - Search for more options when passing args to -h, e.g.: (Arnaldo Carvalho de Melo)
      
          $ perf report -h interface
      
           Usage: perf report [<options>]
      
            --gtk    Use the GTK2 interface
            --stdio  Use the stdio interface
            --tui    Use the TUI interface
      
        - Fix reading separate debuginfo files based on a build-id, problem
          found on a Debian system. (Dima Kogan)
      
        - Fix endless loop when splitting kallsyms symbols per section for
          handling kcore files, problem found on a s390x system. (Jiri Olsa)
      
      Infrastructure changes:
      
        - Prep work for the 'perf stat record' work that will allow generating
          perf.data files with counting data in addition to the sampling mode
          we have now (Jiri Olsa)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      6fc774ef
  2. 28 Oct, 2015 10 commits
    • Wang Nan's avatar
      perf bpf: Collect perf_evsel in BPF object files · 4edf30e3
      Wang Nan authored
      This patch creates a 'struct perf_evsel' for every probe in a BPF object
      file(s) and fills 'struct evlist' with them. The previously introduced
      dummy event is now removed. After this patch, the following command:
      
       # perf record --event filter.o ls
      
      Can trace on each of the probes defined in filter.o.
      
      The core of this patch is bpf__foreach_tev(), which calls a callback
      function for each 'struct probe_trace_event' event for a bpf program
      with each associated file descriptors. The add_bpf_event() callback
      creates evsels by calling parse_events_add_tracepoint().
      
      Since bpf-loader.c will not be built if libbpf is turned off, an empty
      bpf__foreach_tev() is defined in bpf-loader.h to avoid build errors.
      
      Committer notes:
      
      Before:
      
        # /tmp/oldperf record --event /tmp/foo.o -a usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.198 MB perf.data ]
        # perf evlist
        /tmp/foo.o
        # perf evlist -v
        /tmp/foo.o: type: 1, size: 112, config: 0x9, { sample_period,
        sample_freq }: 4000, sample_type: IP|TID|TIME|CPU|PERIOD, disabled: 1,
        inherit: 1, mmap: 1, comm: 1, freq: 1, task: 1, sample_id_all: 1,
        exclude_guest: 1, mmap2: 1, comm_exec: 1
      
      I.e. we create just the PERF_TYPE_SOFTWARE (type: 1),
      PERF_COUNT_SW_DUMMY(config 0x9) event, now, with this patch:
      
        # perf record --event /tmp/foo.o -a usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.210 MB perf.data ]
        # perf evlist -v
        perf_bpf_probe:fork: type: 2, size: 112, config: 0x6bd, { sample_period,
        sample_freq }: 1, sample_type: IP|TID|TIME|CPU|PERIOD|RAW, disabled: 1,
        inherit: 1, mmap: 1, comm: 1, task: 1, sample_id_all: 1, exclude_guest:
        1, mmap2: 1, comm_exec: 1
        #
      
      We now have a PERF_TYPE_SOFTWARE (type: 1), but the config states 0x6bd,
      which is how, after setting up the event via the kprobes interface, the
      'perf_bpf_probe:fork' event is accessible via the perf_event_open
      syscall. This is all transient, as soon as the 'perf record' session
      ends, these probes will go away.
      
      To see how it looks like, lets try doing a neverending session, one that
      expects a control+C to end:
      
        # perf record --event /tmp/foo.o -a
      
      So, with that in place, we can use 'perf probe' to see what is in place:
      
        # perf probe -l
          perf_bpf_probe:fork  (on _do_fork@acme/git/linux/kernel/fork.c)
      
      We also can use debugfs:
      
        [root@felicio ~]# cat /sys/kernel/debug/tracing/kprobe_events
        p:perf_bpf_probe/fork _text+638512
      
      Ok, now lets stop and see if we got some forks:
      
        [root@felicio linux]# perf record --event /tmp/foo.o -a
        ^C[ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.325 MB perf.data (111 samples) ]
      
        [root@felicio linux]# perf script
            sshd  1271 [003] 81797.507678: perf_bpf_probe:fork: (ffffffff8109be30)
            sshd 18309 [000] 81797.524917: perf_bpf_probe:fork: (ffffffff8109be30)
            sshd 18309 [001] 81799.381603: perf_bpf_probe:fork: (ffffffff8109be30)
            sshd 18309 [001] 81799.408635: perf_bpf_probe:fork: (ffffffff8109be30)
        <SNIP>
      
      Sure enough, we have 111 forks :-)
      
      Callchains seems to work as well:
      
        # perf report --stdio --no-child
        # To display the perf.data header info, please use --header/--header-only options.
        #
        # Total Lost Samples: 0
        #
        # Samples: 562  of event 'perf_bpf_probe:fork'
        # Event count (approx.): 562
        #
        # Overhead  Command   Shared Object     Symbol
        # ........  ........  ................  ............
        #
            44.66%  sh        [kernel.vmlinux]  [k] _do_fork
                          |
                          ---_do_fork
                             entry_SYSCALL_64_fastpath
                             __libc_fork
                             make_child
      
          26.16%  make      [kernel.vmlinux]  [k] _do_fork
      <SNIP>
        #
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei 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-7-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4edf30e3
    • Wang Nan's avatar
      perf tools: Load eBPF object into kernel · 1e5e3ee8
      Wang Nan authored
      This patch utilizes bpf_object__load() provided by libbpf to load all
      objects into kernel.
      
      Committer notes:
      
      Testing it:
      
      When using an incorrect kernel version number, i.e., having this in your
      eBPF proggie:
      
        int _version __attribute__((section("version"), used)) = 0x40100;
      
      For a 4.3.0-rc6+ kernel, say, this happens and needs checking at event
      parsing time, to provide a better error report to the user:
      
        # perf record --event /tmp/foo.o sleep 1
        libbpf: load bpf program failed: Invalid argument
        libbpf: -- BEGIN DUMP LOG ---
        libbpf:
      
        libbpf: -- END LOG --
        libbpf: failed to load program 'fork=_do_fork'
        libbpf: failed to load object '/tmp/foo.o'
        event syntax error: '/tmp/foo.o'
                             \___ Invalid argument: Are you root and runing a CONFIG_BPF_SYSCALL kernel?
      
        (add -v to see detail)
        Run 'perf list' for a list of valid events
      
         Usage: perf record [<options>] [<command>]
            or: perf record [<options>] -- <command> [<options>]
      
            -e, --event <event>   event selector. use 'perf list' to list available events
      
      If we instead make it match, i.e. use 0x40300 on this v4.3.0-rc6+
      kernel, the whole process goes thru:
      
        # perf record --event /tmp/foo.o -a usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.202 MB perf.data ]
        # perf evlist -v
        /tmp/foo.o: type: 1, size: 112, config: 0x9, { sample_period,
        sample_freq }: 4000, sample_type: IP|TID|TIME|CPU|PERIOD, disabled: 1,
        inherit: 1, mmap: 1, comm: 1, freq: 1, task: 1, sample_id_all: 1,
        exclude_guest: 1, mmap2: 1, comm_exec: 1
        #
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei 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: Paul Mackerras <paulus@samba.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-6-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      1e5e3ee8
    • Wang Nan's avatar
      perf tools: Create probe points for BPF programs · aa3abf30
      Wang Nan authored
      This patch introduces bpf__{un,}probe() functions to enable callers to
      create kprobe points based on section names a BPF program. It parses the
      section names in the program and creates corresponding 'struct
      perf_probe_event' structures. The parse_perf_probe_command() function is
      used to do the main parsing work. The resuling 'struct perf_probe_event'
      is stored into program private data for further using.
      
      By utilizing the new probing API, this patch creates probe points during
      event parsing.
      
      To ensure probe points be removed correctly, register an atexit hook so
      even perf quit through exit() bpf__clear() is still called, so probing
      points are cleared. Note that bpf_clear() should be registered before
      bpf__probe() is called, so failure of bpf__probe() can still trigger
      bpf__clear() to remove probe points which are already probed.
      
      strerror style error reporting scaffold is created by this patch.
      bpf__strerror_probe() is the first error reporting function in
      bpf-loader.c.
      
      Committer note:
      
      Trying it:
      
      To build a test eBPF object file:
      
      I am testing using a script I built from the 'perf test -v LLVM' output:
      
        $ cat ~/bin/hello-ebpf
        export KERNEL_INC_OPTIONS="-nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/4.8.3/include -I/home/acme/git/linux/arch/x86/include -Iarch/x86/include/generated/uapi -Iarch/x86/include/generated -I/home/acme/git/linux/include -Iinclude -I/home/acme/git/linux/arch/x86/include/uapi -Iarch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -Iinclude/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h"
        export WORKING_DIR=/lib/modules/4.2.0/build
        export CLANG_SOURCE=-
        export CLANG_OPTIONS=-xc
      
        OBJ=/tmp/foo.o
        rm -f $OBJ
        echo '__attribute__((section("fork=do_fork"), used)) int fork(void *ctx) {return 0;} char _license[] __attribute__((section("license"), used)) = "GPL";int _version __attribute__((section("version"), used)) = 0x40100;' | \
        clang -D__KERNEL__ $CLANG_OPTIONS $KERNEL_INC_OPTIONS -Wno-unused-value -Wno-pointer-sign -working-directory $WORKING_DIR -c "$CLANG_SOURCE" -target bpf -O2 -o /tmp/foo.o && file $OBJ
      
       ---
      
      First asking to put a probe in a function not present in the kernel
      (misses the initial _):
      
        $ perf record --event /tmp/foo.o sleep 1
        Probe point 'do_fork' not found.
        event syntax error: '/tmp/foo.o'
                             \___ You need to check probing points in BPF file
      
        (add -v to see detail)
        Run 'perf list' for a list of valid events
      
         Usage: perf record [<options>] [<command>]
            or: perf record [<options>] -- <command> [<options>]
      
            -e, --event <event>   event selector. use 'perf list' to list available events
        $
      
       ---
      
      Now, with "__attribute__((section("fork=_do_fork"), used)):
      
       $ grep _do_fork /proc/kallsyms
       ffffffff81099ab0 T _do_fork
       $ perf record --event /tmp/foo.o sleep 1
       Failed to open kprobe_events: Permission denied
       event syntax error: '/tmp/foo.o'
                            \___ Permission denied
      
       ---
      
      Cool, we need to provide some better hints, "kprobe_events" is too low
      level, one doesn't strictly need to know the precise details of how
      these things are put in place, so something that shows the command
      needed to fix the permissions would be more helpful.
      
      Lets try as root instead:
      
        # perf record --event /tmp/foo.o sleep 1
        Lowering default frequency rate to 1000.
        Please consider tweaking /proc/sys/kernel/perf_event_max_sample_rate.
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.013 MB perf.data ]
        # perf evlist
        /tmp/foo.o
        [root@felicio ~]# perf evlist -v
        /tmp/foo.o: type: 1, size: 112, config: 0x9, { sample_period,
        sample_freq }: 1000, sample_type: IP|TID|TIME|PERIOD, disabled: 1,
        inherit: 1, mmap: 1, comm: 1, freq: 1, enable_on_exec: 1, task: 1,
        sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
      
       ---
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei 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-5-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      aa3abf30
    • Wang Nan's avatar
      perf tools: Enable passing bpf object file to --event · 84c86ca1
      Wang Nan authored
      By introducing new rules in tools/perf/util/parse-events.[ly], this
      patch enables 'perf record --event bpf_file.o' to select events by an
      eBPF object file. It calls parse_events_load_bpf() to load that file,
      which uses bpf__prepare_load() and finally calls bpf_object__open() for
      the object files.
      
      After applying this patch, commands like:
      
       # perf record --event foo.o sleep
      
      become possible.
      
      However, at this point it is unable to link any useful things onto the
      evsel list because the creating of probe points and BPF program
      attaching have not been implemented.  Before real events are possible to
      be extracted, to avoid perf report error because of empty evsel list,
      this patch link a dummy evsel. The dummy event related code will be
      removed when probing and extracting code is ready.
      
      Commiter notes:
      
      Using it:
      
        $ ls -la foo.o
        ls: cannot access foo.o: No such file or directory
        $ perf record --event foo.o sleep
        libbpf: failed to open foo.o: No such file or directory
        event syntax error: 'foo.o'
                             \___ BPF object file 'foo.o' is invalid
      
        (add -v to see detail)
        Run 'perf list' for a list of valid events
      
         Usage: perf record [<options>] [<command>]
            or: perf record [<options>] -- <command> [<options>]
      
            -e, --event <event>   event selector. use 'perf list' to list available events
        $
      
        $ file /tmp/build/perf/perf.o
        /tmp/build/perf/perf.o: ELF 64-bit LSB relocatable, x86-64, version 1 (SYSV), not stripped
        $ perf record --event /tmp/build/perf/perf.o sleep
        libbpf: /tmp/build/perf/perf.o is not an eBPF object file
        event syntax error: '/tmp/build/perf/perf.o'
                             \___ BPF object file '/tmp/build/perf/perf.o' is invalid
      
        (add -v to see detail)
        Run 'perf list' for a list of valid events
      
         Usage: perf record [<options>] [<command>]
            or: perf record [<options>] -- <command> [<options>]
      
            -e, --event <event>   event selector. use 'perf list' to list available events
        $
      
        $ file /tmp/foo.o
        /tmp/foo.o: ELF 64-bit LSB relocatable, no machine, version 1 (SYSV), not stripped
        $ perf record --event /tmp/foo.o sleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.013 MB perf.data ]
        $ perf evlist
        /tmp/foo.o
        $ perf evlist  -v
        /tmp/foo.o: type: 1, size: 112, config: 0x9, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|PERIOD, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, enable_on_exec: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
        $
      
      So, type 1 is PERF_TYPE_SOFTWARE, config 0x9 is PERF_COUNT_SW_DUMMY, ok.
      
        $ perf report --stdio
        Error:
        The perf.data file has no samples!
        # To display the perf.data header info, please use --header/--header-only options.
        #
        $
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Tested-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexei 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-4-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      84c86ca1
    • Wang Nan's avatar
      perf ebpf: Add the libbpf glue · 69d262a9
      Wang Nan authored
      The 'bpf-loader.[ch]' files are introduced in this patch. Which will be
      the interface between perf and libbpf. bpf__prepare_load() resides in
      bpf-loader.c. Following patches will enrich these two files.
      Signed-off-by: default avatarWang Nan <wangnan0@huawei.com>
      Acked-by: default avatarAlexei 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-3-git-send-email-wangnan0@huawei.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      69d262a9
    • Wang Nan's avatar
      perf tools: Make perf depend on libbpf · ed63f34c
      Wang Nan authored
      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: default avatarWang Nan <wangnan0@huawei.com>
      Acked-by: default avatarAlexei 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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ed63f34c
    • Jiri Olsa's avatar
      perf symbols: Fix endless loop in dso__split_kallsyms_for_kcore · 443f8c75
      Jiri Olsa authored
      Currently we split symbols based on the map comparison, but symbols are stored
      within dso objects and maps could point into same dso objects (kernel maps).
      
      Hence we could end up changing rbtree we are currently iterating and mess it
      up. It's easily reproduced on s390x by running:
      
        $ perf record -a -- sleep 3
        $ perf buildid-list -i perf.data --with-hits
      
      The fix is to compare dso objects instead.
      Reported-by: default avatarMichael Petlan <mpetlan@redhat.com>
      Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
      Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Kan Liang <kan.liang@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20151026135130.GA26003@krava.brq.redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      443f8c75
    • Wang Nan's avatar
      perf tools: Enable pre-event inherit setting by config terms · 374ce938
      Wang Nan authored
      This patch allows perf record setting event's attr.inherit bit by
      config terms like:
      
        # perf record -e cycles/no-inherit/ ...
        # perf record -e cycles/inherit/ ...
      
      So user can control inherit bit for each event separately.
      
      In following example, a.out fork()s in main then do some complex
      CPU intensive computations in both of its children.
      
      Basic result with and without inherit:
      
        # perf record -e cycles -e instructions ./a.out
        [ perf record: Woken up 9 times to write data ]
        [ perf record: Captured and wrote 2.205 MB perf.data (47920 samples) ]
        # perf report --stdio
        # ...
        # Samples: 23K of event 'cycles'
        # Event count (approx.): 23641752891
        ...
        # Samples: 24K of event 'instructions'
        # Event count (approx.): 30428312415
      
        # perf record -i -e cycles -e instructions ./a.out
        [ perf record: Woken up 5 times to write data ]
        [ perf record: Captured and wrote 1.111 MB perf.data (24019 samples) ]
        ...
        # Samples: 12K of event 'cycles'
        # Event count (approx.): 11699501775
        ...
        # Samples: 12K of event 'instructions'
        # Event count (approx.): 15058023559
      
      Cancel inherit for one event when globally enable:
      
        # perf record -e cycles/no-inherit/ -e instructions ./a.out
        [ perf record: Woken up 7 times to write data ]
        [ perf record: Captured and wrote 1.660 MB perf.data (36004 samples) ]
        ...
        # Samples: 12K of event 'cycles/no-inherit/'
        # Event count (approx.): 11895759282
       ...
        # Samples: 24K of event 'instructions'
        # Event count (approx.): 30668000441
      
      Enable inherit for one event when globally disable:
      
        # perf record -i -e cycles/inherit/ -e instructions ./a.out
        [ perf record: Woken up 7 times to write data ]
        [ perf record: Captured and wrote 1.654 MB perf.data (35868 samples) ]
        ...
        # Samples: 23K of event 'cycles/inherit/'
        # Event count (approx.): 23285400229
        ...
        # Samples: 11K of event 'instructions'
        # Event count (approx.): 14969050259
      
      Committer note:
      
      One can check if the bit was set, in addition to seeing the result in
      the perf.data file size as above by doing one of:
      
        # perf record -e cycles -e instructions -a usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.911 MB perf.data (63 samples) ]
        # perf evlist -v
        cycles: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ID|CPU|PERIOD, read_format: ID, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
        instructions: size: 112, config: 0x1, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ID|CPU|PERIOD, read_format: ID, disabled: 1, inherit: 1, freq: 1, sample_id_all: 1, exclude_guest: 1
        #
      
      So, the inherit bit was set in both, now, if we disable it globally using
      --no-inherit:
      
        # perf record --no-inherit -e cycles -e instructions -a usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.910 MB perf.data (56 samples) ]
        # perf evlist -v
        cycles: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ID|CPU|PERIOD, read_format: ID, disabled: 1, mmap: 1, comm: 1, freq: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
        instructions: size: 112, config: 0x1, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ID|CPU|PERIOD, read_format: ID, disabled: 1, freq: 1, sample_id_all: 1, exclude_guest: 1
      
      No inherit bit set, then disabling it and setting just on the cycles event:
      
        # perf record --no-inherit -e cycles/inherit/ -e instructions -a usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.909 MB perf.data (48 samples) ]
        # perf evlist -v
        cycles/inherit/: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ID|CPU|PERIOD, read_format: ID, disabled: 1, inherit: 1, mmap: 1, comm: 1, freq: 1, task: 1, sample_id_all: 1, exclude_guest: 1, mmap2: 1, comm_exec: 1
        instructions: size: 112, config: 0x1, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|ID|CPU|PERIOD, read_format: ID, disabled: 1, freq: 1, sample_id_all: 1, exclude_guest: 1
        #
      
      We can see it as well in by using a more verbose level of debug messages in
      the tool that sets up the perf_event_attr, 'perf record' in this case:
      
        [root@zoo ~]# perf record -vv --no-inherit -e cycles/inherit/ -e instructions -a usleep 1
        ------------------------------------------------------------
        perf_event_attr:
          size                             112
          { sample_period, sample_freq }   4000
          sample_type                      IP|TID|TIME|ID|CPU|PERIOD
          read_format                      ID
          disabled                         1
          inherit                          1
          mmap                             1
          comm                             1
          freq                             1
          task                             1
          sample_id_all                    1
          exclude_guest                    1
          mmap2                            1
          comm_exec                        1
        ------------------------------------------------------------
        sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
        sys_perf_event_open: pid -1  cpu 1  group_fd -1  flags 0x8
        sys_perf_event_open: pid -1  cpu 2  group_fd -1  flags 0x8
        sys_perf_event_open: pid -1  cpu 3  group_fd -1  flags 0x8
        ------------------------------------------------------------
        perf_event_attr:
          size                             112
          config                           0x1
          { sample_period, sample_freq }   4000
          sample_type                      IP|TID|TIME|ID|CPU|PERIOD
          read_format                      ID
          disabled                         1
          freq                             1
          sample_id_all                    1
          exclude_guest                    1
        ------------------------------------------------------------
        sys_perf_event_open: pid -1  cpu 0  group_fd -1  flags 0x8
      
      <SNIP>
      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: Alexei Starovoitov <ast@plumgrid.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Li Zefan <lizefan@huawei.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Zefan Li <lizefan@huawei.com>
      Cc: pi3orama@163.com
      Link: http://lkml.kernel.org/r/1446029705-199659-2-git-send-email-wangnan0@huawei.com
      [ s/u64/bool/ for the perf_evsel_config_term inherit field - jolsa]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      374ce938
    • Dima Kogan's avatar
      perf symbols: we can now read separate debug-info files based on a build ID · 5baecbcd
      Dima Kogan authored
      Recent GDB (at least on a vanilla Debian box) looks for debug information in
      
        /usr/lib/debug/.build-id/nn/nnnnnnn
      
      where nn/nnnnnn is the build-id of the stripped ELF binary. This is
      documented here:
      
        https://sourceware.org/gdb/onlinedocs/gdb/Separate-Debug-Files.html
      
      This was not working in perf because we didn't read the build id until
      AFTER we searched for the separate debug information file. This patch
      reads the build ID and THEN does the search.
      Signed-off-by: default avatarDima Kogan <dima@secretsauce.net>
      Link: http://lkml.kernel.org/r/87si6pfwz4.fsf@secretsauce.netSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5baecbcd
    • Dima Kogan's avatar
      perf symbols: Fix type error when reading a build-id · f2f30968
      Dima Kogan authored
      This was benign, but wrong. The build-id should live in a char[], not a char*[]
      Signed-off-by: default avatarDima Kogan <dima@secretsauce.net>
      Link: http://lkml.kernel.org/r/87si6pfwz4.fsf@secretsauce.netSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f2f30968
  3. 27 Oct, 2015 5 commits
  4. 26 Oct, 2015 3 commits
  5. 25 Oct, 2015 1 commit
  6. 24 Oct, 2015 2 commits
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Provide help for subset of options · 161d9041
      Arnaldo Carvalho de Melo authored
      Some tools have a lot of options, so, providing a way to show help just
      for some of them may come handy:
      
        $ perf report -h --tui
      
         Usage: perf report [<options>]
      
              --tui             Use the TUI interface
      
        $ perf report -h --tui --showcpuutilization -b -c
      
         Usage: perf report [<options>]
      
          -b, --branch-stack    use branch records for per branch histogram filling
          -c, --comms <comm[,comm...]>
                                only consider symbols in these comms
              --showcpuutilization
                                Show sample percentage for different cpu modes
              --tui             Use the TUI interface
      
        $
      
      Using it with perf bash completion is also handy, just make sure you
      source the needed file:
      
        $ . ~/git/linux/tools/perf/perf-completion.sh
      
      Then press tab/tab after -- to see a list of options, put them after -h
      and only the options chosen will have its help presented:
      
        $ perf report -h --
        --asm-raw              --demangle-kernel      --group
        --kallsyms             --pretty               --stdio
        --branch-history       --disassembler-style   --gtk
        --max-stack            --showcpuutilization   --symbol-filter
        --branch-stack         --dsos                 --header
        --mem-mode             --show-info            --symbols
        --call-graph           --dump-raw-trace       --header-only
        --modules              --show-nr-samples      --symfs
        --children             --exclude-other        --hide-unresolved
        --objdump              --show-ref-call-graph  --threads
        --column-widths        --fields               --ignore-callees
        --parent               --show-total-period    --tid
        --comms                --field-separator      --input
        --percentage           --socket-filter        --tui
        --cpu                  --force                --inverted
        --percent-limit        --sort                 --verbose
        --demangle             --full-source-path     --itrace
        --pid                  --source               --vmlinux
        $ perf report -h --socket-filter
      
         Usage: perf report [<options>]
      
            --socket-filter <n>
                        only show processor socket that match with this filter
      Suggested-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Chandler Carruth <chandlerc@gmail.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-83mcdd3wj0379jcgea8w0fxa@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      161d9041
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Show tool command line options ordered · 869c55b0
      Arnaldo Carvalho de Melo authored
      When asking for a listing of the options, be it using -h or when an
      unknown option is passed, order it by one-letter options, then the ones
      having just long names.
      Suggested-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Chandler Carruth <chandlerc@gmail.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/n/tip-41qh68t35n4ehrpsuazp1dx8@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      869c55b0
  7. 23 Oct, 2015 1 commit
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo' of... · 80fcd45e
      Ingo Molnar authored
      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 from Arnaldo Carvalho de Melo:
      
      User visible changes:
      
        - The default for callchains is back to 'callee' when --children is not used.
          (Namhyung Kim)
      
        - Move the 'use_offset' option to the right place where the annotate code
          expects it to be to be able to properly handle it. (Namhyung Kim)
      
        - Don't die when an unknown 'annotate' option is found in the perf config
          file (usually ~/.perfconfig), just warn the user. (Arnaldo Carvalho de Melo)
      
      Infrastructure changes:
      
        - Support %ps/%pS in libtraceevent. (Scott Wood)
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      80fcd45e
  8. 22 Oct, 2015 9 commits
  9. 21 Oct, 2015 2 commits
  10. 20 Oct, 2015 1 commit
    • Kan Liang's avatar
      perf cpu_map: Fix core dump caused by per-socket/core system-wide stat · bc1d0368
      Kan Liang authored
      Perf will core dump if --per-socket/core -a are applied for perf stat.
      
      The root cause is that cpu_map__build_map set refcnt of evlist's cpu_map
      to 1.  It should set refcnt for the newly created cpu_map, not evlist's
      cpu_map.
      
      Here is the example:
      
        # perf stat -e cycles --per-socket -a sleep 1
      
         Performance counter stats for 'system wide':
      
        S0       36         30,196,257      cycles
        S1       28         15,823,536      cycles
      
             1.001126828 seconds time elapsed
      
        *** Error in `./perf': corrupted double-linked list: 0x00000000021f9090 ***
        ======= Backtrace: =========
        /lib64/libc.so.6[0x3002e7bbe7]
        /lib64/libc.so.6[0x3002e7d2b5]
        ./perf(perf_evsel__delete+0x28)[0x485bdd]
        ./perf[0x4800e8]
        ./perf(perf_evlist__delete+0x5e)[0x482cd5]
        ./perf(cmd_stat+0xf25)[0x432328]
        ./perf[0x4768e0]
        ./perf[0x476ad6]
        ./perf[0x476b41]
        ./perf(main+0x1d0)[0x476db2]
        /lib64/libc.so.6(__libc_start_main+0xf5)[0x3002e21b45]
        ./perf[0x4202c5]
      Signed-off-by: default avatarKan Liang <kan.liang@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Link: http://lkml.kernel.org/r/1444388363-35936-1-git-send-email-kan.liang@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bc1d0368