1. 29 11月, 2014 1 次提交
    • J
      perf session: Do not fail on processing out of order event · f61ff6c0
      Jiri Olsa 提交于
      Linus reported perf report command being interrupted due to processing
      of 'out of order' event, with following error:
      
        Timestamp below last timeslice flush
        0x5733a8 [0x28]: failed to process type: 3
      
      I could reproduce the issue and in my case it was caused by one CPU
      (mmap) being behind during record and userspace mmap reader seeing the
      data after other CPUs data were already stored.
      
      This is expected under some circumstances because we need to limit the
      number of events that we queue for reordering when we receive a
      PERF_RECORD_FINISHED_ROUND or when we force flush due to memory
      pressure.
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NJiri Olsa <jolsa@kernel.org>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Matt Fleming <matt.fleming@intel.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1417016371-30249-1-git-send-email-jolsa@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      f61ff6c0
  2. 16 11月, 2014 1 次提交
  3. 29 10月, 2014 4 次提交
    • A
      perf session: Add perf_session__deliver_synth_event() · a293829d
      Adrian Hunter 提交于
      Add a function to deliver synthesized events from within a session.
      
      Intel PT decoding works by synthesizing events (primarily branch events)
      that can then be consumed by existing tools.  This function will be used
      to deliver those events.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1414417770-18602-3-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a293829d
    • A
      perf tools: Use evlist__for_each in a few remaining places · cba9b847
      Arnaldo Carvalho de Melo 提交于
      Where direct use of the longer form using list_for_entry() was being
      used.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-v4fw80flg25nkl8jgeod3ot9@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cba9b847
    • A
      perf tools: Add id index · 3c659eed
      Adrian Hunter 提交于
      Add an index of the event identifiers, in preparation for Intel PT.
      
      The event id (also called the sample id) is a unique number
      allocated by the kernel to the event created by perf_event_open().  Events
      can include the event id by having a sample type including PERF_SAMPLE_ID or
      PERF_SAMPLE_IDENTIFIER.
      
      Currently the main use of the event id is to match an event back to the
      evsel to which it belongs i.e. perf_evlist__id2evsel()
      
      The purpose of this patch is to make it possible to match an event back to
      the mmap from which it was read.  The reason that is useful is because the
      mmap represents a time-ordered context (either for a cpu or for a thread).
      Intel PT decodes trace information on that basis.  In full-trace mode, that
      information can be recorded when the Intel PT trace is read, but in
      sample-mode the Intel PT trace data is embedded in a sample and it is in
      that case that the "id index" is needed.
      
      So the mmaps are numbered (idx) and the cpu and tid recorded against the id
      by perf_evlist__set_sid_idx() which is called by perf_evlist__mmap_per_evsel().
      
      That information is recorded on the perf.data file in the new "id index".
      idx, cpu and tid are added to struct perf_sample_id (which is the node of
      evlist's hash table to match ids to evsels).  The information can be
      retrieved using perf_evlist__id2sid().  Note however this all depends on
      having a sample type including PERF_SAMPLE_ID or PERF_SAMPLE_IDENTIFIER,
      otherwise ids are not recorded.
      
      The "id index" is a synthesized event record which will be created when
      Intel PT sampling is used by calling perf_event__synthesize_id_index().
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1414417770-18602-2-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3c659eed
    • A
      perf thread: Adopt resolve_callchain method from machine · cc8b7c2b
      Arnaldo Carvalho de Melo 提交于
      Shortening function signature lenght too, since a thread's machine can be
      obtained from thread->mg->machine, no need to pass thread, machine.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-5wb6css280ty0cel5p0zo2b1@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      cc8b7c2b
  4. 16 10月, 2014 1 次提交
    • A
      perf session: Add option to copy events when queueing · 54bf53b1
      Alexander Yarygin 提交于
      When processing events the session code has an ordered samples queue
      which is used to time-sort events coming in across multiple mmaps. At a
      later point in time samples on the queue are flushed up to some
      timestamp at which point the event is actually processed.
      
      When analyzing events live (ie., record/analysis path in the same
      command) there is a race that leads to corrupted events and parse errors
      which cause perf to terminate. The problem is that when the event is
      placed in the ordered samples queue it is only a reference to the event
      which is really sitting in the mmap buffer. Even though the event is
      queued for later processing the mmap tail pointer is updated which
      indicates to the kernel that the event has been processed. The race is
      flushing the event from the queue before it gets overwritten by some
      other event. For commands trying to process events live (versus just
      writing to a file) and processing a high rate of events this leads to
      parse failures and perf terminates.
      
      Examples hitting this problem are 'perf kvm stat live', especially with
      nested VMs which generate 100,000+ traces per second, and a command
      processing scheduling events with a high rate of context switching --
      e.g., running 'perf bench sched pipe'.
      
      This patch offers live commands an option to copy the event when it is
      placed in the ordered samples queue.
      
      Based on a patch from David Ahern <dsahern@gmail.com>
      Signed-off-by: NAlexander Yarygin <yarygin@linux.vnet.ibm.com>
      Acked-by: NJiri Olsa <jolsa@kernel.org>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1412347212-28237-2-git-send-email-yarygin@linux.vnet.ibm.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      54bf53b1
  5. 14 10月, 2014 1 次提交
    • A
      perf session: Remove last reference to hists struct · 2a1731fb
      Arnaldo Carvalho de Melo 提交于
      Now perf_session doesn't require that the evsels in its evlist are hists
      containing ones.
      
      Tools that are hists based and want to do per evsel events_stats
      updates, if at some point this turns into a necessity, should do it in
      the tool specific code, keeping the session class hists agnostic.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-cli1bgwpo82mdikuhy3djsuy@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      2a1731fb
  6. 11 10月, 2014 1 次提交
    • A
      perf session: Don't count per evsel events · c2329ade
      Arnaldo Carvalho de Melo 提交于
      PERF_RECORD_SAMPLE was not being counted here and is the only per-evsel
      thing anyway, the other events were not mapping to a evsel.
      
      With this we don't require that evsels used with a perf_session need to
      have space for hists, like the ones in annotate, report, top.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-kzchpz0l1mhrsfpkirz086m2@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c2329ade
  7. 10 10月, 2014 1 次提交
    • A
      perf evsel: Add hists helper · 4ea062ed
      Arnaldo Carvalho de Melo 提交于
      Not all tools need a hists instance per perf_evsel, so lets pave the way
      to remove evsel->hists while leaving a way to access the hists from a
      specially allocated evsel, one that comes with space at the end where
      lives the evsel.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Don Zickus <dzickus@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jean Pihet <jean.pihet@linaro.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/n/tip-qlktkhe31w4mgtbd84035sr2@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      4ea062ed
  8. 26 9月, 2014 1 次提交
  9. 14 8月, 2014 2 次提交
  10. 12 8月, 2014 13 次提交
  11. 25 7月, 2014 1 次提交
  12. 24 7月, 2014 3 次提交
  13. 17 7月, 2014 2 次提交
  14. 16 5月, 2014 1 次提交
  15. 15 3月, 2014 1 次提交
  16. 18 2月, 2014 1 次提交
  17. 10 2月, 2014 1 次提交
  18. 21 1月, 2014 1 次提交
  19. 13 1月, 2014 1 次提交
  20. 28 12月, 2013 1 次提交
  21. 24 12月, 2013 1 次提交
    • D
      perf kvm: Fix kvm report without guestmount. · ad85ace0
      Dongsheng Yang 提交于
      Currently, if we use perf kvm --guestkallsyms --guestmodules report, we
      can not get the perf information from perf data file. All sample are
      shown as unknown.
      
      Reproducing steps:
      	# perf kvm --guestkallsyms /tmp/kallsyms --guestmodules /tmp/modules record -a sleep 1
      	[ perf record: Woken up 1 times to write data ]
      	[ perf record: Captured and wrote 0.624 MB perf.data.guest (~27260 samples) ]
      	# perf kvm --guestkallsyms /tmp/kallsyms --guestmodules /tmp/modules report |grep %
      	   100.00%  [guest/6471]  [unknown]         [g] 0xffffffff8164f330
      
      This bug was introduced by 207b5792 (perf kvm: Fix regression with guest machine creation).
      In original code, it uses perf_session__find_machine(), it means we deliver symbol to machine
      which has the same pid, if no machine found, deliver it to *default* guest. But if we use
      perf_session__findnew_machine() here, if no machine was found, new machine with pid will be built
      and added. Then the default guest which with pid == 0 will never get a symbol.
      
      And because the new machine initialized here has no kernel map created, the symbol delivered to
      it will be marked as "unknown".
      
      This patch here is to revert commit 207b5792 and fix the SEGFAULT bug in another way.
      
      Verification steps:
      	# ./perf kvm --guestkallsyms /home/kallsyms --guestmodules /home/modules record -a sleep 1
      	[ perf record: Woken up 1 times to write data ]
      	[ perf record: Captured and wrote 0.651 MB perf.data.guest (~28437 samples) ]
      	# ./perf kvm --guestkallsyms /home/kallsyms --guestmodules /home/modules report |grep %
      	    22.64%    :6471  [guest.kernel.kallsyms]  [g] update_rq_clock.part.70
      	    19.99%    :6471  [guest.kernel.kallsyms]  [g] d_free
      	    18.46%    :6471  [guest.kernel.kallsyms]  [g] bio_phys_segments
      	    16.25%    :6471  [guest.kernel.kallsyms]  [g] dequeue_task
      	    12.78%    :6471  [guest.kernel.kallsyms]  [g] __switch_to
      	     7.91%    :6471  [guest.kernel.kallsyms]  [g] scheduler_tick
      	     1.75%    :6471  [guest.kernel.kallsyms]  [g] native_apic_mem_write
      	     0.21%    :6471  [guest.kernel.kallsyms]  [g] apic_timer_interrupt
      Signed-off-by: NDongsheng Yang <yangds.fnst@cn.fujitsu.com>
      Acked-by: NDavid Ahern <dsahern@gmail.com>
      Cc: stable@vger.kernel.org # 3.3+
      Cc: David Ahern <dsahern@gmail.com>
      Link: http://lkml.kernel.org/r/1387564907-3045-1-git-send-email-yangds.fnst@cn.fujitsu.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ad85ace0