1. 20 4月, 2017 1 次提交
  2. 12 4月, 2017 2 次提交
    • D
      perf session: Don't rely on evlist in pipe mode · 0973ad97
      David Carrillo-Cisneros 提交于
      Session sets a number parameters that rely on evlist. These parameters
      are not used in pipe-mode and should not be set, since evlist is
      unavailable. Fix that.
      Signed-off-by: NDavid Carrillo-Cisneros <davidcc@google.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Simon Que <sque@chromium.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20170410201432.24807-6-davidcc@google.com
      [ Check if file != NULL in perf_session__new(), like when used by builtin-top.c ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0973ad97
    • D
      perf inject: Copy events when reordering events in pipe mode · 1e0d4f02
      David Carrillo-Cisneros 提交于
      __perf_session__process_pipe_events reuses the same memory buffer to
      process all events in the pipe.
      
      When reordering is needed (e.g. -b option), events are not immediately
      flushed, but kept around until reordering is possible, causing
      memory corruption.
      
      The problem is usually observed by a "Unknown sample error" output. It
      can easily be reproduced by:
      
        perf record -o - noploop | perf inject -b > output
      
      Committer testing:
      
      Before:
      
        $ perf record -o - stress -t 2 -c 2 | perf inject -b > /dev/null
        stress: info: [8297] dispatching hogs: 2 cpu, 0 io, 0 vm, 0 hdd
        stress: info: [8297] successful run completed in 2s
        [ perf record: Woken up 3 times to write data ]
        [ perf record: Captured and wrote 0.000 MB - ]
        Warning:
        Found 1 unknown events!
      
        Is this an older tool processing a perf.data file generated by a more recent tool?
      
        If that is not the case, consider reporting to linux-kernel@vger.kernel.org.
      
        $
      
      After:
      
        $ perf record -o - stress -t 2 -c 2 | perf inject -b > /dev/null
        stress: info: [9027] dispatching hogs: 2 cpu, 0 io, 0 vm, 0 hdd
        stress: info: [9027] successful run completed in 2s
        [ perf record: Woken up 3 times to write data ]
        [ perf record: Captured and wrote 0.000 MB - ]
        no symbols found in /usr/bin/stress, maybe install a debug package?
        no symbols found in /usr/bin/stress, maybe install a debug package?
        $
      Signed-off-by: NDavid Carrillo-Cisneros <davidcc@google.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Paul Turner <pjt@google.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Simon Que <sque@chromium.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Wang Nan <wangnan0@huawei.com>
      Link: http://lkml.kernel.org/r/20170410201432.24807-3-davidcc@google.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      1e0d4f02
  3. 17 3月, 2017 1 次提交
    • A
      perf tools: Handle partial AUX records and print a warning · 05a1f47e
      Alexander Shishkin 提交于
      This patch decodes the 'partial' flag in AUX records and prints
      a warning to the user, so that they don't have to guess why their
      PT traces contain gaps (or missing altogether):
      
        Warning:
        AUX data had gaps in it 8 times out of 8!
      
        Are you running a KVM guest in the background?
      
      Trying to be even more helpful, we will detect if the user's kvm driver sets up
      exclusive VMX root mode for the entire lifespan of the kvm process:
      
        Reloading kvm_intel module with vmm_exclusive=0
        will reduce the gaps to only guest's timeslices.
      
      Note however, that you'll still have gaps in cpu-wide traces even with
      vmm_exclusive=0, but the number of gaps will be below 100% (as opposed to the
      above example).
      
      Currently this is the only reason for partial records.
      Signed-off-by: NAlexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Vince Weaver <vince@deater.net>
      Link: http://lkml.kernel.org/r/8760j941ig.fsf@ashishki-desk.ger.corp.intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      05a1f47e
  4. 14 3月, 2017 1 次提交
    • H
      perf tools: Add PERF_RECORD_NAMESPACES to include namespaces related info · f3b3614a
      Hari Bathini 提交于
      Introduce a new option to record PERF_RECORD_NAMESPACES events emitted
      by the kernel when fork, clone, setns or unshare are invoked. And update
      perf-record documentation with the new option to record namespace
      events.
      
      Committer notes:
      
      Combined it with a later patch to allow printing it via 'perf report -D'
      and be able to test the feature introduced in this patch. Had to move
      here also perf_ns__name(), that was introduced in another later patch.
      
      Also used PRIu64 and PRIx64 to fix the build in some enfironments wrt:
      
        util/event.c:1129:39: error: format '%lx' expects argument of type 'long unsigned int', but argument 6 has type 'long long unsigned int' [-Werror=format=]
           ret  += fprintf(fp, "%u/%s: %lu/0x%lx%s", idx
                                               ^
      Testing it:
      
        # perf record --namespaces -a
        ^C[ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 1.083 MB perf.data (423 samples) ]
        #
        # perf report -D
        <SNIP>
        3 2028902078892 0x115140 [0xa0]: PERF_RECORD_NAMESPACES 14783/14783 - nr_namespaces: 7
                      [0/net: 3/0xf0000081, 1/uts: 3/0xeffffffe, 2/ipc: 3/0xefffffff, 3/pid: 3/0xeffffffc,
                       4/user: 3/0xeffffffd, 5/mnt: 3/0xf0000000, 6/cgroup: 3/0xeffffffb]
      
        0x1151e0 [0x30]: event: 9
        .
        . ... raw event: size 48 bytes
        .  0000:  09 00 00 00 02 00 30 00 c4 71 82 68 0c 7f 00 00  ......0..q.h....
        .  0010:  a9 39 00 00 a9 39 00 00 94 28 fe 63 d8 01 00 00  .9...9...(.c....
        .  0020:  03 00 00 00 00 00 00 00 ce c4 02 00 00 00 00 00  ................
        <SNIP>
              NAMESPACES events:          1
        <SNIP>
        #
      Signed-off-by: NHari Bathini <hbathini@linux.vnet.ibm.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@fb.com>
      Cc: Ananth N Mavinakayanahalli <ananth@linux.vnet.ibm.com>
      Cc: Aravinda Prasad <aravinda@linux.vnet.ibm.com>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Eric Biederman <ebiederm@xmission.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Sargun Dhillon <sargun@sargun.me>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/148891930386.25309.18412039920746995488.stgit@hbathini.in.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f3b3614a
  5. 17 2月, 2017 1 次提交
    • A
      perf session: Fix DEBUG=1 build with clang · 8074bf51
      Arnaldo Carvalho de Melo 提交于
      The struct branch_stack->branch_stack.cycles field is a u64 :16
      bitfield, and this somehow confuses clang 4.0 when checking the
      arguments of a printf format, so cast the :16 to unsigned short to help
      it.
      
      Silences this:
      
        util/session.c:935:4: error: format specifies type 'unsigned short' but the argument has type 'u64' (aka 'unsigned long') [-Werror,-Wformat]
                                e->flags.cycles,
                                ^~~~~~~~~~~~~~~
        1 error generated.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Andi Kleen <ak@linux.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-eo2t4uhlbne105z72tvyzkp1@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      8074bf51
  6. 15 2月, 2017 1 次提交
  7. 17 1月, 2017 1 次提交
  8. 24 10月, 2016 1 次提交
  9. 16 7月, 2016 1 次提交
    • W
      perf session: Don't warn about out of order event if write_backward is used · f06149c0
      Wang Nan 提交于
      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: NWang Nan <wangnan0@huawei.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Tested-by: NArnaldo 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: NHe Kuang <hekuang@huawei.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f06149c0
  10. 23 6月, 2016 1 次提交
  11. 22 6月, 2016 1 次提交
  12. 30 5月, 2016 1 次提交
    • A
      perf tools: Per event max-stack settings · 792d48b4
      Arnaldo Carvalho de Melo 提交于
      The tooling counterpart, now it is possible to do:
      
        # perf record -e sched:sched_switch/max-stack=10/ -e cycles/call-graph=dwarf,max-stack=4/ -e cpu-cycles/call-graph=dwarf,max-stack=1024/ usleep 1
        [ perf record: Woken up 1 times to write data ]
        [ perf record: Captured and wrote 0.052 MB perf.data (5 samples) ]
        # perf evlist -v
        sched:sched_switch: type: 2, size: 112, config: 0x110, { sample_period, sample_freq }: 1, sample_type: IP|TID|TIME|CALLCHAIN|CPU|PERIOD|RAW|IDENTIFIER, read_format: ID, 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, sample_max_stack: 10
        cycles/call-graph=dwarf,max-stack=4/: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|CALLCHAIN|PERIOD|REGS_USER|STACK_USER|IDENTIFIER, read_format: ID, disabled: 1, inherit: 1, freq: 1, enable_on_exec: 1, sample_id_all: 1, exclude_guest: 1, exclude_callchain_user: 1, sample_regs_user: 0xff0fff, sample_stack_user: 8192, sample_max_stack: 4
        cpu-cycles/call-graph=dwarf,max-stack=1024/: size: 112, { sample_period, sample_freq }: 4000, sample_type: IP|TID|TIME|CALLCHAIN|PERIOD|REGS_USER|STACK_USER|IDENTIFIER, read_format: ID, disabled: 1, inherit: 1, freq: 1, enable_on_exec: 1, sample_id_all: 1, exclude_guest: 1, exclude_callchain_user: 1, sample_regs_user: 0xff0fff, sample_stack_user: 8192, sample_max_stack: 1024
        # Tip: use 'perf evlist --trace-fields' to show fields for tracepoint events
      
      Using just /max-stack=N/ means /call-graph=fp,max-stack=N/, that should
      be further configurable by means of some .perfconfig knob.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
      Cc: Alexei Starovoitov <ast@kernel.org>
      Cc: Brendan Gregg <brendan.d.gregg@gmail.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: He Kuang <hekuang@huawei.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Masami Hiramatsu <mhiramat@kernel.org>
      Cc: Milian Wolff <milian.wolff@kdab.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vince Weaver <vincent.weaver@maine.edu>
      Cc: Wang Nan <wangnan0@huawei.com>
      Cc: Zefan Li <lizefan@huawei.com>
      Link: http://lkml.kernel.org/n/tip-kolmn1yo40p7jhswxwrc7rrd@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      792d48b4
  13. 18 4月, 2016 2 次提交
  14. 14 4月, 2016 1 次提交
  15. 13 4月, 2016 1 次提交
  16. 12 4月, 2016 5 次提交
  17. 31 3月, 2016 1 次提交
    • A
      perf tools: Add time conversion event · 46bc29b9
      Adrian Hunter 提交于
      Intel PT uses the time members from the perf_event_mmap_page to convert
      between TSC and perf time.
      
      Due to a lack of foresight when Intel PT was implemented, those time
      members were recorded in the (implementation dependent) AUXTRACE_INFO
      event, the structure of which is generally inaccessible outside of the
      Intel PT decoder.  However now the conversion between TSC and perf time
      is needed when processing a jitdump file when Intel PT has been used for
      tracing.
      
      So add a user event to record the time members.  'perf record' will
      synthesize the event if the information is available.  And session
      processing will put a copy of the event on the session so that tools
      like 'perf inject' can easily access it.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1457426324-30158-1-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      46bc29b9
  18. 23 3月, 2016 1 次提交
  19. 08 3月, 2016 1 次提交
  20. 16 1月, 2016 1 次提交
    • R
      perf kvm record/report: 'unprocessable sample' error while recording/reporting guest data · 3caeaa56
      Ravi Bangoria 提交于
      While recording guest samples in host using perf kvm record, it will
      populate unprocessable sample error, though samples will be recorded
      properly. While generating report using perf kvm report, no samples will
      be processed and same error will populate. We have seen this behaviour
      with upstream perf(4.4-rc3) on x86 and ppc64 hardware.
      
      Reason behind this failure is, when it tries to fetch machine from
      rb_tree of machines, it fails. As a part of tracing a bug, we figured
      out that this code was incorrectly refactored in commit 54245fdc
      ("perf session: Remove wrappers to machines__find").
      
      This patch will change the functionality such that if it can't fetch
      machine in first trial, it will create one node of machine and add that to
      rb_tree. So next time when it tries to fetch same machine from rb_tree,
      it won't fail. Actually it was the case before refactoring of code in
      aforementioned commit.
      
      This patch is generated from acme perf/core branch.
      
      Below I've mention an example that demonstrate the behaviour before and
      after applying patch.
      
      Before applying patch:
      [Note: One needs to run guest before recording data in host]
      
        ravi@ravi-bangoria:~$ ./perf kvm record -a
        Warning:
        5903 unprocessable samples recorded.
        Do you have a KVM guest running and not using 'perf kvm'?
        [ perf record: Captured and wrote 1.409 MB perf.data.guest (285 samples) ]
      
        ravi@ravi-bangoria:~$ ./perf kvm report --stdio
        Warning:
        5903 unprocessable samples recorded.
        Do you have a KVM guest running and not using 'perf kvm'?
        # To display the perf.data header info, please use --header/--header-only options.
        #
        # Total Lost Samples: 0
        #
        # Samples: 285  of event 'cycles'
        # Event count (approx.): 88715406
        #
        # Overhead  Command  Shared Object  Symbol
        # ........  .......  .............  ......
        #
      
        # (For a higher level overview, try: perf report --sort comm,dso)
        #
      
      After applying patch:
      
        ravi@ravi-bangoria:~$ ./perf kvm record -a
        [ perf record: Captured and wrote 1.188 MB perf.data.guest (17 samples) ]
      
        ravi@ravi-bangoria:~$ ./perf kvm report --stdio
        # To display the perf.data header info, please use --header/--header-only options.
        #
        # Total Lost Samples: 0
        #
        # Samples: 17  of event 'cycles'
        # Event count (approx.): 700746
        #
        # Overhead  Command  Shared Object     Symbol
        # ........  .......  ................  ......................
        #
            34.19%  :5758    [unknown]         [g] 0xffffffff818682ab
            22.79%  :5758    [unknown]         [g] 0xffffffff812dc7f8
            22.79%  :5758    [unknown]         [g] 0xffffffff818650d0
            14.83%  :5758    [unknown]         [g] 0xffffffff8161a1b6
             2.49%  :5758    [unknown]         [g] 0xffffffff818692bf
             0.48%  :5758    [unknown]         [g] 0xffffffff81869253
             0.05%  :5758    [unknown]         [g] 0xffffffff81869250
      Signed-off-by: NRavi Bangoria <ravi.bangoria@linux.vnet.ibm.com>
      Cc: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Cc: stable@vger.kernel.org # v3.19+
      Fixes: 54245fdc ("perf session: Remove wrappers to machines__find")
      Link: http://lkml.kernel.org/r/1449471302-11283-1-git-send-email-ravi.bangoria@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3caeaa56
  21. 18 12月, 2015 8 次提交
  22. 11 12月, 2015 1 次提交
    • M
      perf tools: Make perf_session__register_idle_thread drop the refcount · 9d8b172f
      Masami Hiramatsu 提交于
      Note that since the thread was already inserted to the session
      list, it will be released when the session is released.
      Also, in perf_session__register_idle_thread() failure path,
      the thread should be put before returning.
      
      Refcnt debugger shows that the perf_session__register_idle_thread
      gets the returned thread, but the caller (__cmd_top) does not
      put the returned idle thread.
      
        ----
        ==== [0] ====
        Unreclaimed thread@0x24e6240
        Refcount +1 => 0 at
          ./perf(thread__new+0xe5) [0x4c8a75]
          ./perf(machine__findnew_thread+0x9a) [0x4bbdba]
          ./perf(perf_session__register_idle_thread+0x28) [0x4c63c8]
          ./perf(cmd_top+0xd7d) [0x43cf6d]
          ./perf() [0x47ba35]
          ./perf(main+0x617) [0x4225b7]
          /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f06027c5af5]
          ./perf() [0x42272d]
        Refcount +1 => 1 at
          ./perf(thread__get+0x2c) [0x4c8bcc]
          ./perf(machine__findnew_thread+0xee) [0x4bbe0e]
          ./perf(perf_session__register_idle_thread+0x28) [0x4c63c8]
          ./perf(cmd_top+0xd7d) [0x43cf6d]
          ./perf() [0x47ba35]
          ./perf(main+0x617) [0x4225b7]
          /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f06027c5af5]
          ./perf() [0x42272d]
        Refcount +1 => 2 at
          ./perf(thread__get+0x2c) [0x4c8bcc]
          ./perf(machine__findnew_thread+0x112) [0x4bbe32]
          ./perf(perf_session__register_idle_thread+0x28) [0x4c63c8]
          ./perf(cmd_top+0xd7d) [0x43cf6d]
          ./perf() [0x47ba35]
          ./perf(main+0x617) [0x4225b7]
          /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f06027c5af5]
          ./perf() [0x42272d]
        ----
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20151209021122.10245.69707.stgit@localhost.localdomain
      [ Drop the refcount in perf_session__register_idle_thread() ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      9d8b172f
  23. 12 11月, 2015 1 次提交
  24. 01 10月, 2015 1 次提交
  25. 29 9月, 2015 2 次提交
  26. 18 9月, 2015 1 次提交
    • M
      perf record: Avoid infinite loop at buildid processing with no samples · 381c02f6
      Mark Rutland 提交于
      If a session contains no events, we can get stuck in an infinite loop in
      __perf_session__process_events, with a non-zero file_size and data_offset, but
      a zero data_size.
      
      In this case, we can mmap the entirety of the file (consisting of the file and
      attribute headers), and fetch_mmaped_event will correctly refuse to read any
      (unmapped and non-existent) event headers. This causes
      __perf_session__process_events to unmap the file and retry with the exact same
      parameters, getting stuck in an infinite loop.
      
      This has been observed to result in an exit-time hang when counting
      rare/unschedulable events with perf record, and can be triggered artificially
      with the script below:
      
        ----
        #!/bin/sh
        printf "REPRO: launching perf\n";
        ./perf record -e software/config=9/ sleep 1 &
        PERF_PID=$!;
        sleep 0.002;
        kill -2 $PERF_PID;
        printf "REPRO: waiting for perf (%d) to exit...\n" "$PERF_PID";
        wait $PERF_PID;
        printf "REPRO: perf exited\n";
        ----
      
      To avoid this, have __perf_session__process_events bail out early when
      the file has no data (i.e. it has no events).
      
      Commiter note:
      
      I only managed to reproduce this when setting
      /proc/sys/kernel/kptr_restrict to '1' and changing the code to
      purposefully not process any samples and no synthesized samples, i.e.
      kptr_restrict prevents 'record' from synthesizing the kernel mmaps for
      vmlinux + modules and since it is a workload started from perf, we don't
      synthesize mmap/comm records for existing threads.
      
      Adrian Hunter managed to reproduce it in his environment tho.
      Signed-off-by: NMark Rutland <mark.rutland@arm.com>
      Tested-by: NArnaldo Carvalho de Melo <acme@kernel.org>
      Tested-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1442423929-12253-1-git-send-email-mark.rutland@arm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      381c02f6