1. 12 Jul, 2013 23 commits
    • Namhyung Kim's avatar
      tools lib traceevent: Remove unused install targets · 9f1efa82
      Namhyung Kim authored
      The html_install, img_install, install_plugin and install_python are
      unused in the Makefile.  Get rid of them.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Acked-by: default avatarSteven Rostedt <rostedt@goodmig.org>
      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: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/1370323231-14022-2-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9f1efa82
    • David Ahern's avatar
      perf parse events: Demystify memory allocations · c5cd8ac0
      David Ahern authored
      List heads are currently allocated way down the function chain in
      __add_event and add_tracepoint and then freed when the scanner code
      calls parse_events_update_lists.
      
      Be more explicit with where memory is allocated and who should free it. With
      this patch the list_head is allocated in the scanner code and freed when the
      scanner code calls parse_events_update_lists.
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1372793245-4136-7-git-send-email-dsahern@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c5cd8ac0
    • David Ahern's avatar
      perf tests: Make terms a stack variable in test_term · c549aca5
      David Ahern authored
      No need to malloc the memory for it.
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1372793245-4136-6-git-send-email-dsahern@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c549aca5
    • David Ahern's avatar
      perf tools: Don't free list head in parse_events__free_terms · 0142dab0
      David Ahern authored
      Function should only be freeing the entries in the list in case of
      failure, as those were allocated there, not the list_head itself.
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1372793245-4136-5-git-send-email-dsahern@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0142dab0
    • David Ahern's avatar
      perf evlist: Fix use of uninitialized variable · b3824404
      David Ahern authored
      Fixes valgrind complaint:
      ==1870== Syscall param write(buf) points to uninitialised byte(s)
      ==1870==    at 0x4E3F5B0: __write_nocancel (in /lib64/libpthread-2.14.90.so)
      ==1870==    by 0x449D7C: perf_evlist__start_workload (evlist.c:846)
      ==1870==    by 0x427BC1: cmd_record (builtin-record.c:561)
      ==1870==    by 0x419D72: run_builtin (perf.c:319)
      ==1870==    by 0x4195F2: main (perf.c:376)
      ==1870==  Address 0x7feffcdd7 is on thread 1's stack
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1372793245-4136-3-git-send-email-dsahern@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b3824404
    • Runzhen Wang's avatar
      perf tools: Make Power7 events available for perf · cfe0d8ba
      Runzhen Wang authored
      Power7 supports over 530 different perf events but only a small subset
      of these can be specified by name, for the remaining events, we must
      specify them by their raw code:
      
              perf stat -e r2003c <application>
      
      This patch makes all the POWER7 events available in sysfs.  So we can
      instead specify these as:
      
              perf stat -e 'cpu/PM_CMPLU_STALL_DFU/' <application>
      
      where PM_CMPLU_STALL_DFU is the r2003c in previous example.
      
      Before this patch is applied, the size of power7-pmu.o is:
      
      $ size arch/powerpc/perf/power7-pmu.o
         text	   data	    bss	    dec	    hex	filename
         3073	   2720	      0	   5793	   16a1	arch/powerpc/perf/power7-pmu.o
      
      and after the patch is applied, it is:
      
      $ size arch/powerpc/perf/power7-pmu.o
         text	   data	    bss	    dec	    hex	filename
        15950	  31112	      0	  47062	   b7d6	arch/powerpc/perf/power7-pmu.o
      
      For the run time overhead, I use two scripts, one is "event_name.sh",
      which contains 50 event names, it looks like:
      
       # ./perf record  -e 'cpu/PM_CMPLU_STALL_DFU/' -e .....  /bin/sleep 1
      
      the other one is named "event_code.sh" which use corresponding  events
      raw
      code instead of events names, it looks like:
      
       # ./perf record -e r2003c -e ......  /bin/sleep 1
      
      below is the result.
      
      Using events name:
      
      [root@localhost perf]# time ./event_name.sh
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.002 MB perf.data (~102 samples) ]
      
      real	0m1.192s
      user	0m0.028s
      sys	0m0.106s
      
      Using events raw code:
      
      [root@localhost perf]# time ./event_code.sh
      [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.003 MB perf.data (~112 samples) ]
      
      real	0m1.198s
      user	0m0.028s
      sys	0m0.105s
      Signed-off-by: default avatarRunzhen Wang <runzhen@linux.vnet.ibm.com>
      Acked-by: default avatarMichael Ellerman <michael@ellerman.id.au>
      Cc: icycoder@gmail.com
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: Michael Ellerman <michael@ellerman.id.au>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Runzhen Wang <runzhew@clemson.edu>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1372407297-6996-3-git-send-email-runzhen@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cfe0d8ba
    • Jiri Olsa's avatar
      perf report: Fix perf_session__delete removal · d4ae0a6f
      Jiri Olsa authored
      There's no point of having out_delete label with perf_session__delete
      call within __cmd_report function, because it's called at the end of the
      cmd_report function.
      
      The speed up due to commenting out the perf_session__delete at the end
      does not seem relevant anymore. Measured speedup for ~1GB data file with
      222466 FORKS events is around 0.5%.
      
        $ perf report -i perf.data.delete -P perf_session__delete -s parent
      
        +  99.51%  [other]
        +   0.49%  perf_session__delete
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      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@elte.hu>
      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/1372161253-22081-6-git-send-email-jolsa@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d4ae0a6f
    • Jiri Olsa's avatar
      perf tools: Do not elide parent symbol column · ad3d6f50
      Jiri Olsa authored
      I found the parent symbol column data interesting even
      if there's another sorting enabled. Switching it on.
      
      Previous behaviour:
        $ perf report -i perf.data.delete -p perf_session__delete -x
      
        +   3.60%  perf  perf               [.] __rb_change_child
        +   1.89%  perf  perf               [.] rb_erase
        +   1.89%  perf  perf               [.] rb_erase
        +   1.83%  perf  perf               [.] free@plt
      
      Current behaviour:
        $ perf report -i perf.data.delete -p perf_session__delete -x
      
        +   3.60%  perf  perf               [.] __rb_change_child        perf_session__delete
        +   1.89%  perf  perf               [.] rb_erase                 perf_session__delete_dead_threads
        +   1.89%  perf  perf               [.] rb_erase                 perf_session__delete_threads
        +   1.83%  perf  perf               [.] free@plt                 perf_session__delete
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      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@elte.hu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/n/tip-r79fn89bhqz16ixa5zmyflrd@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ad3d6f50
    • Namhyung Kim's avatar
      perf util: Use evsel->name to get tracepoint_paths · e7c93f09
      Namhyung Kim authored
      Most tracepoint events already have their system and event name in
      ->name field so that searching whole event tracing directory for each
      evsel to match given id is suboptimal.
      
      Factor out this routine into tracepoint_name_to_path().  In case of en
      invalid name, it'll try to find path using id again.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      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: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/1372230862-15861-3-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      e7c93f09
    • Namhyung Kim's avatar
      perf util: Move debugfs/tracing helper functions to util.c · 167aedc4
      Namhyung Kim authored
      Since they're generic helpers move them to util.c so that they can be
      used by others.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      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: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/1372230862-15861-2-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      167aedc4
    • Jiri Olsa's avatar
      perf tools: Remove callchain_cursor_reset call · fa1531fd
      Jiri Olsa authored
      Removing callchain_cursor_reset call as it is called in subsequent
      machine__resolve_callchain_sample function.
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      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@elte.hu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/n/tip-ic53wabwmmgvvwve2ymv3yf7@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      fa1531fd
    • David Ahern's avatar
      perf tools: Add methods for setting/retrieving priv element of thread struct · ba58041a
      David Ahern authored
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1370643734-9579-3-git-send-email-dsahern@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ba58041a
    • Robert Richter's avatar
      perf tools: Use default include path notation for libtraceevent headers · 4e319027
      Robert Richter authored
      Header files of libtraceevent or no longer local headers. Thus, use
      default path notation for them. Also removing extra traceevent include
      path and instead handle this similar to liblk.
      Signed-off-by: default avatarRobert Richter <robert.richter@linaro.org>
      Signed-off-by: default avatarRobert Richter <rric@kernel.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Robert Richter <rric@kernel.org>
      Link: http://lkml.kernel.org/r/1370964558-8599-1-git-send-email-rric@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4e319027
    • Jiri Olsa's avatar
      perf tests: Make TEST_ASSERT_VAL global · 450ac18d
      Jiri Olsa authored
      Making TEST_ASSERT_VAL global as it's used in multiple objects.
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      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@elte.hu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1370612223-19188-3-git-send-email-jolsa@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      450ac18d
    • Jiri Olsa's avatar
      perf tests: Omit end of the symbol check failure for test 1 · 5888a8c2
      Jiri Olsa authored
      Omitting end of the function check failure for test 1, since there's no
      way to get exact symbol end via kallsyms.
      
      Leaving the debug message.
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      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@elte.hu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1370612223-19188-2-git-send-email-jolsa@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5888a8c2
    • Jiri Olsa's avatar
      perf tools: Remove cwd from perf_session struct · eb4fe9cb
      Jiri Olsa authored
      Removing 'cwd' from perf_session struct as it's no longer needed.
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      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@elte.hu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1370612223-19188-1-git-send-email-jolsa@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      eb4fe9cb
    • Sukadev Bhattiprolu's avatar
      perf top: Add --objdump option · 0d3942db
      Sukadev Bhattiprolu authored
      perf: Add objdump option to 'perf top'
      
      Like with 'perf annotate' add the --objdump option to perf top so users
      can specify an alternate path to the /usr/bin/objdump binary.
      Reported-by: default avatarDavid A. Gilbert <DavidAGilbert@uk.ibm.com>
      Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: DavidAGilbert@uk.ibm.com
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Maynard Johnson <mpjohn@us.ibm.com>
      Link: http://lkml.kernel.org/r/20130515055651.GA9985@us.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0d3942db
    • Sukadev Bhattiprolu's avatar
      perf tools: Rename cpu_map__all() to cpu_map__empty() · ec1e7e43
      Sukadev Bhattiprolu authored
      The CPU map is in an "empty" (or not-applicable) state when monitoring
      specific threads.
      
      cpu_map__all() returns true if the CPU map is in this empty state (i.e
      for the 'empty_cpu_map' or if we created the map via
      cpu_map__dummy_new().
      
      The name, cpu_map__all(), is misleading, because even when monitoring
      all CPUs, (eg: perf record -a), cpu_map__all() returns false.
      
      Rename cpu_map__all() to cpu_map__empty().
      Signed-off-by: default avatarSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Link: http://lkml.kernel.org/r/20130523012620.GA27733@us.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      ec1e7e43
    • Jiri Olsa's avatar
      perf: Remove the 'match' callback for auxiliary events processing · 67516844
      Jiri Olsa authored
      It gives the following benefits:
      
        - only one function pointer is passed along the way
      
        - the 'match' function is called within output function
          and could be inlined by the compiler
      Suggested-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1373388991-9711-1-git-send-email-jolsa@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      67516844
    • Peter Zijlstra's avatar
      perf: Fix perf_lock_task_context() vs RCU · 058ebd0e
      Peter Zijlstra authored
      Jiri managed to trigger this warning:
      
       [] ======================================================
       [] [ INFO: possible circular locking dependency detected ]
       [] 3.10.0+ #228 Tainted: G        W
       [] -------------------------------------------------------
       [] p/6613 is trying to acquire lock:
       []  (rcu_node_0){..-...}, at: [<ffffffff810ca797>] rcu_read_unlock_special+0xa7/0x250
       []
       [] but task is already holding lock:
       []  (&ctx->lock){-.-...}, at: [<ffffffff810f2879>] perf_lock_task_context+0xd9/0x2c0
       []
       [] which lock already depends on the new lock.
       []
       [] the existing dependency chain (in reverse order) is:
       []
       [] -> #4 (&ctx->lock){-.-...}:
       [] -> #3 (&rq->lock){-.-.-.}:
       [] -> #2 (&p->pi_lock){-.-.-.}:
       [] -> #1 (&rnp->nocb_gp_wq[1]){......}:
       [] -> #0 (rcu_node_0){..-...}:
      
      Paul was quick to explain that due to preemptible RCU we cannot call
      rcu_read_unlock() while holding scheduler (or nested) locks when part
      of the read side critical section was preemptible.
      
      Therefore solve it by making the entire RCU read side non-preemptible.
      
      Also pull out the retry from under the non-preempt to play nice with RT.
      Reported-by: default avatarJiri Olsa <jolsa@redhat.com>
      Helped-out-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      058ebd0e
    • Jiri Olsa's avatar
      perf: Remove WARN_ON_ONCE() check in __perf_event_enable() for valid scenario · 06f41796
      Jiri Olsa authored
      The '!ctx->is_active' check has a valid scenario, so
      there's no need for the warning.
      
      The reason is that there's a time window between the
      'ctx->is_active' check in the perf_event_enable() function
      and the __perf_event_enable() function having:
      
        - IRQs on
        - ctx->lock unlocked
      
      where the task could be killed and 'ctx' deactivated by
      perf_event_exit_task(), ending up with the warning below.
      
      So remove the WARN_ON_ONCE() check and add comments to
      explain it all.
      
      This addresses the following warning reported by Vince Weaver:
      
      [  324.983534] ------------[ cut here ]------------
      [  324.984420] WARNING: at kernel/events/core.c:1953 __perf_event_enable+0x187/0x190()
      [  324.984420] Modules linked in:
      [  324.984420] CPU: 19 PID: 2715 Comm: nmi_bug_snb Not tainted 3.10.0+ #246
      [  324.984420] Hardware name: Supermicro X8DTN/X8DTN, BIOS 4.6.3 01/08/2010
      [  324.984420]  0000000000000009 ffff88043fce3ec8 ffffffff8160ea0b ffff88043fce3f00
      [  324.984420]  ffffffff81080ff0 ffff8802314fdc00 ffff880231a8f800 ffff88043fcf7860
      [  324.984420]  0000000000000286 ffff880231a8f800 ffff88043fce3f10 ffffffff8108103a
      [  324.984420] Call Trace:
      [  324.984420]  <IRQ>  [<ffffffff8160ea0b>] dump_stack+0x19/0x1b
      [  324.984420]  [<ffffffff81080ff0>] warn_slowpath_common+0x70/0xa0
      [  324.984420]  [<ffffffff8108103a>] warn_slowpath_null+0x1a/0x20
      [  324.984420]  [<ffffffff81134437>] __perf_event_enable+0x187/0x190
      [  324.984420]  [<ffffffff81130030>] remote_function+0x40/0x50
      [  324.984420]  [<ffffffff810e51de>] generic_smp_call_function_single_interrupt+0xbe/0x130
      [  324.984420]  [<ffffffff81066a47>] smp_call_function_single_interrupt+0x27/0x40
      [  324.984420]  [<ffffffff8161fd2f>] call_function_single_interrupt+0x6f/0x80
      [  324.984420]  <EOI>  [<ffffffff816161a1>] ? _raw_spin_unlock_irqrestore+0x41/0x70
      [  324.984420]  [<ffffffff8113799d>] perf_event_exit_task+0x14d/0x210
      [  324.984420]  [<ffffffff810acd04>] ? switch_task_namespaces+0x24/0x60
      [  324.984420]  [<ffffffff81086946>] do_exit+0x2b6/0xa40
      [  324.984420]  [<ffffffff8161615c>] ? _raw_spin_unlock_irq+0x2c/0x30
      [  324.984420]  [<ffffffff81087279>] do_group_exit+0x49/0xc0
      [  324.984420]  [<ffffffff81096854>] get_signal_to_deliver+0x254/0x620
      [  324.984420]  [<ffffffff81043057>] do_signal+0x57/0x5a0
      [  324.984420]  [<ffffffff8161a164>] ? __do_page_fault+0x2a4/0x4e0
      [  324.984420]  [<ffffffff8161665c>] ? retint_restore_args+0xe/0xe
      [  324.984420]  [<ffffffff816166cd>] ? retint_signal+0x11/0x84
      [  324.984420]  [<ffffffff81043605>] do_notify_resume+0x65/0x80
      [  324.984420]  [<ffffffff81616702>] retint_signal+0x46/0x84
      [  324.984420] ---[ end trace 442ec2f04db3771a ]---
      Reported-by: default avatarVince Weaver <vincent.weaver@maine.edu>
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Suggested-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1373384651-6109-2-git-send-email-jolsa@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      06f41796
    • Jiri Olsa's avatar
      perf: Clone child context from parent context pmu · 734df5ab
      Jiri Olsa authored
      Currently when the child context for inherited events is
      created, it's based on the pmu object of the first event
      of the parent context.
      
      This is wrong for the following scenario:
      
        - HW context having HW and SW event
        - HW event got removed (closed)
        - SW event stays in HW context as the only event
          and its pmu is used to clone the child context
      
      The issue starts when the cpu context object is touched
      based on the pmu context object (__get_cpu_context). In
      this case the HW context will work with SW cpu context
      ending up with following WARN below.
      
      Fixing this by using parent context pmu object to clone
      from child context.
      
      Addresses the following warning reported by Vince Weaver:
      
      [ 2716.472065] ------------[ cut here ]------------
      [ 2716.476035] WARNING: at kernel/events/core.c:2122 task_ctx_sched_out+0x3c/0x)
      [ 2716.476035] Modules linked in: nfsd auth_rpcgss oid_registry nfs_acl nfs locn
      [ 2716.476035] CPU: 0 PID: 3164 Comm: perf_fuzzer Not tainted 3.10.0-rc4 #2
      [ 2716.476035] Hardware name: AOpen   DE7000/nMCP7ALPx-DE R1.06 Oct.19.2012, BI2
      [ 2716.476035]  0000000000000000 ffffffff8102e215 0000000000000000 ffff88011fc18
      [ 2716.476035]  ffff8801175557f0 0000000000000000 ffff880119fda88c ffffffff810ad
      [ 2716.476035]  ffff880119fda880 ffffffff810af02a 0000000000000009 ffff880117550
      [ 2716.476035] Call Trace:
      [ 2716.476035]  [<ffffffff8102e215>] ? warn_slowpath_common+0x5b/0x70
      [ 2716.476035]  [<ffffffff810ab2bd>] ? task_ctx_sched_out+0x3c/0x5f
      [ 2716.476035]  [<ffffffff810af02a>] ? perf_event_exit_task+0xbf/0x194
      [ 2716.476035]  [<ffffffff81032a37>] ? do_exit+0x3e7/0x90c
      [ 2716.476035]  [<ffffffff810cd5ab>] ? __do_fault+0x359/0x394
      [ 2716.476035]  [<ffffffff81032fe6>] ? do_group_exit+0x66/0x98
      [ 2716.476035]  [<ffffffff8103dbcd>] ? get_signal_to_deliver+0x479/0x4ad
      [ 2716.476035]  [<ffffffff810ac05c>] ? __perf_event_task_sched_out+0x230/0x2d1
      [ 2716.476035]  [<ffffffff8100205d>] ? do_signal+0x3c/0x432
      [ 2716.476035]  [<ffffffff810abbf9>] ? ctx_sched_in+0x43/0x141
      [ 2716.476035]  [<ffffffff810ac2ca>] ? perf_event_context_sched_in+0x7a/0x90
      [ 2716.476035]  [<ffffffff810ac311>] ? __perf_event_task_sched_in+0x31/0x118
      [ 2716.476035]  [<ffffffff81050dd9>] ? mmdrop+0xd/0x1c
      [ 2716.476035]  [<ffffffff81051a39>] ? finish_task_switch+0x7d/0xa6
      [ 2716.476035]  [<ffffffff81002473>] ? do_notify_resume+0x20/0x5d
      [ 2716.476035]  [<ffffffff813654f5>] ? retint_signal+0x3d/0x78
      [ 2716.476035] ---[ end trace 827178d8a5966c3d ]---
      Reported-by: default avatarVince Weaver <vincent.weaver@maine.edu>
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: <stable@kernel.org>
      Signed-off-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1373384651-6109-1-git-send-email-jolsa@redhat.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      734df5ab
    • Ingo Molnar's avatar
      Merge tag 'perf-urgent-for-mingo' of... · c3a1b0cb
      Ingo Molnar authored
      Merge tag 'perf-urgent-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/urgent
      
      Pull perf/urgent fixes from Arnaldo Carvalho de Melo:
      
       * Fix some freeing bugs on the parsing error paths, from Adrian Hunter.
      
       * Update symbol_conf.nr_events when processing attribute events, fix from Adrian Hunter.
      
       * Fix missing increment in sample parsing when PERF_SAMPLE_STACK_USER
         is present, from Adrian Hunt.
      
       * Fix count parameter to read call in event_format__new, from David Ahern.
      
       * Remove -A/--append option, not working for a long time, from Jiri Olsa.
      
       * Remove -f/--force option, was a no-op for quite some time, from Jiri Olsa.
      
       * Fix -x/--exclude-other option for report command, from Jiri Olsa.
      
       * Cross build fixes, at least one for Android, from Joonsoo Kim.
      
       * Fix memory allocation fail check in mem{set,cpy} 'perf bench' workloads,
         from Kirill A. Shutemov.
      
       * Revert regression in configuration of Python support, from Michael Witten.
      
       * Fix -ldw/-lelf link test when static linking, from Mike Frysinger.
      
       * Fix issues with multiple children processing in perf_evlist__start_workload(),
         from Namhyung Kim.
      
       * Fix broken include in Context.xs ('perf script'), from Ramkumar Ramachandra.
      
       * Fixes for build problems, from Robert Richter.
      
       * Fix a typo of a Power7 event name, from Runzhen Wang.
      
       * Avoid sending SIGTERM to random processes in 'perf stat', fix from Stephane Eranian.
      
       * Fix per-socket output bug for uncore events in 'perf stat', from Stephane Eranian.
      
       * Fix vdso list searching, from Waiman Long.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      c3a1b0cb
  2. 10 Jul, 2013 2 commits
    • Ramkumar Ramachandra's avatar
      perf script: Fix broken include in Context.xs · 750ade7e
      Ramkumar Ramachandra authored
      765532c8 (perf script: Finish the rename from trace to script,
      2010-12-23) made a mistake during find-and-replace replacing
      "../../../util/trace-event.h" with "../../../util/script-event.h", a
      non-existent file.  Fix this include.
      Signed-off-by: default avatarRamkumar Ramachandra <artagnon@gmail.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Link: http://lkml.kernel.org/r/1373364033-7918-3-git-send-email-artagnon@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      750ade7e
    • Mike Frysinger's avatar
      perf tools: Fix -ldw/-lelf link test when static linking · d14c4965
      Mike Frysinger authored
      Since libelf sometimes uses libpthread, we have to list that after -lelf
      when someone tries to build statically.  Else things go boom:
      
      Makefile:479: *** No libelf.h/libelf found, please install \
      	libelf-dev/elfutils-libelf-devel.  Stop.
      
      Similarly, the -ldw test fails as it often uses -lz:
      
      Makefile:462: No libdw.h found or old libdw.h found or elfutils is older \
      	than 0.138, disables dwarf support. Please install new elfutils-devel/libdw-dev
      
      And if we add debugging to try-cc, we see:
      + echo '#include <dwarf.h>
      
      int main(void)
      {
              Dwarf *dbg = dwarf_begin(0, DWARF_C_READ);
              return (long)dbg;
      }'
      + i686-pc-linux-gnu-gcc -x c - -O2 -pipe -march=atom -mtune=atom -mfpmath=sse -g \
      	-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE \
      	-ldw -lelf -static -lpthread -lrt -lelf -lm -o .24368
      /usr/lib/libdw.a(dwarf_begin_elf.o):function check_section.isra.1: error: undefined reference to 'inflateInit_'
      /usr/lib/libdw.a(dwarf_begin_elf.o):function check_section.isra.1: error: undefined reference to 'inflate'
      /usr/lib/libdw.a(dwarf_begin_elf.o):function check_section.isra.1: error: undefined reference to 'inflateReset'
      /usr/lib/libdw.a(dwarf_begin_elf.o):function check_section.isra.1: error: undefined reference to 'inflateEnd'
      
      + echo '#include <libelf.h>
      
      int main(void)
      {
              Elf *elf = elf_begin(0, ELF_C_READ, 0);
              return (long)elf;
      }'
      + i686-pc-linux-gnu-gcc -x c - -O2 -pipe -march=atom -mtune=atom -mfpmath=sse -g \
      	-D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -D_GNU_SOURCE \
      	-static -lpthread -lrt -lelf -lm -o .19216
      /usr/lib/libelf.a(elf_begin.o):function file_read_elf: error: undefined reference to 'pthread_rwlock_init'
      /usr/lib/libelf.a(elf_begin.o):function __libelf_read_mmaped_file: error: undefined reference to 'pthread_rwlock_init'
      /usr/lib/libelf.a(elf_begin.o):function __libelf_read_mmaped_file: error: undefined reference to 'pthread_rwlock_init'
      /usr/lib/libelf.a(elf_begin.o):function read_file: error: undefined reference to 'pthread_rwlock_init'
      /usr/lib/libelf.a(elf_begin.o):function lock_dup_elf.8072: error: undefined reference to 'pthread_rwlock_unlock'
      /usr/lib/libelf.a(elf_begin.o):function lock_dup_elf.8072: error: undefined reference to 'pthread_rwlock_wrlock'
      /usr/lib/libelf.a(elf_begin.o):function elf_begin: error: undefined reference to 'pthread_rwlock_rdlock'
      /usr/lib/libelf.a(elf_begin.o):function elf_begin: error: undefined reference to 'pthread_rwlock_unlock'
      Signed-off-by: default avatarMike Frysinger <vapier@gentoo.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1368073064-18276-1-git-send-email-vapier@gentoo.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d14c4965
  3. 09 Jul, 2013 1 commit
    • Michael Witten's avatar
      perf tools: Revert regression in configuration of Python support · a363a9da
      Michael Witten authored
      Among other things, the following:
      
        commit 31160d7f
        Date:   Tue Jan 8 16:22:36 2013 -0500
        perf tools: Fix GNU make v3.80 compatibility issue
      
      attempts to aid the user by tapping into an existing error message,
      as described in the commit message:
      
        ... Also fix an issue where _get_attempt was called with only
        one argument. This prevented the error message from printing
        the name of the variable that can be used to fix the problem.
      
      or more precisely:
      
        -$(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2)))
        +$(if $($(1)),$(call _ge_attempt,$($(1)),$(1)),$(call _ge_attempt,$(2),$(1)))
      
      However, The "missing" argument was in fact missing on purpose; it's
      absence is a signal that the error message should be skipped, because
      the failure would be due to the default value, not any user-supplied
      value.  This can be seen in how `_ge_attempt' uses `gea_err' (in the
      config/utilities.mak file):
      
        _ge_attempt = $(if $(get-executable),$(get-executable),$(_gea_warn)$(call _gea_err,$(2)))
        _gea_warn = $(warning The path '$(1)' is not executable.)
        _gea_err  = $(if $(1),$(error Please set '$(1)' appropriately))
      
      That is, because the argument is no longer missing, the value `$(1)'
      (associated with `_gea_err') always evaluates to true, thus always
      triggering the error condition that is meant to be reserved for
      only the case when a user explicitly supplies an invalid value.
      
      Concretely, the result is a regression in the Makefile's configuration
      of python support; rather than gracefully disable support when the
      relevant executables cannot be found according to default values, the
      build process halts in error as though the user explicitly supplied
      the values.
      
      This new commit simply reverts the offending one-line change.
      Reported-by: default avatarPekka Enberg <penberg@kernel.org>
      Link: http://lkml.kernel.org/r/CAOJsxLHv17Ys3M7P5q25imkUxQW6LE_vABxh1N3Tt7Mv6Ho4iw@mail.gmail.comSigned-off-by: default avatarMichael Witten <mfwitten@gmail.com>
      a363a9da
  4. 08 Jul, 2013 14 commits
    • Robert Richter's avatar
      perf tools: Fix perf version generation · a4147f0f
      Robert Richter authored
      The tag of the perf version is wrongly determined, always the latest tag
      is taken regardless of the HEAD commit:
      
       $ perf --version
       perf version 3.9.rc8.gd7f5d3
       $ git describe d7f5d3
       v3.9-rc7-154-gd7f5d33
       $ head -n 4 Makefile
       VERSION = 3
       PATCHLEVEL = 9
       SUBLEVEL = 0
       EXTRAVERSION = -rc7
      
      In other cases no tag might be found.
      
      This patch fixes this.
      
      This new implementation handles also the case if there are no tags at
      all found in the git repo but there is a commit id.
      Signed-off-by: default avatarRobert Richter <robert.richter@calxeda.com>
      Link: http://lkml.kernel.org/r/1368006214-12912-1-git-send-email-rric@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a4147f0f
    • Stephane Eranian's avatar
      perf stat: Fix per-socket output bug for uncore events · 582ec082
      Stephane Eranian authored
      This patch fixes a problem reported by Andi Kleen on perf
      stat when measuring uncore events:
      
       # perf stat --per-socket -e uncore_pcu/event=0x0/ -I1000  -a sleep 2
      
      It would not report counts for the second socket. That was due to a
      cpu mapping bug in print_aggr().
      
      This patch also fixes the socket numbering bug for <not counted>
      events.
      Reported-by: default avatarAndi Kleen <ak@linux.intel.com>
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Tested-by: default avatarAndi Kleen <ak@linux.intel.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: zheng.z.yan@intel.com
      Link: http://lkml.kernel.org/r/20130705170645.GA32519@quadSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      582ec082
    • Waiman Long's avatar
      perf symbols: Fix vdso list searching · f9ceffb6
      Waiman Long authored
      When "perf record" was used on a large machine with a lot of CPUs, the
      perf post-processing time (the time after the workload was done until
      the perf command itself exited) could take a lot of minutes and even
      hours depending on how large the resulting perf.data file was.
      
      While running AIM7 1500-user high_systime workload on a 80-core x86-64
      system with a 3.9 kernel (with only the -s -a options used), the
      workload itself took about 2 minutes to run and the perf.data file had a
      size of 1108.746 MB. However, the post-processing step took more than 10
      minutes.
      
      With a gprof-profiled perf binary, the time spent by perf was as
      follows:
      
        %   cumulative   self              self     total
       time   seconds   seconds    calls   s/call   s/call  name
       96.90    822.10   822.10   192156     0.00     0.00  dsos__find
        0.81    828.96     6.86 172089958     0.00     0.00  rb_next
        0.41    832.44     3.48 48539289     0.00     0.00  rb_erase
      
      So 97% (822 seconds) of the time was spent in a single dsos_find()
      function. After analyzing the call-graph data below:
      
       -----------------------------------------------
                       0.00  822.12  192156/192156      map__new [6]
       [7]     96.9    0.00  822.12  192156         vdso__dso_findnew [7]
                     822.10    0.00  192156/192156      dsos__find [8]
                       0.01    0.00  192156/192156      dsos__add [62]
                       0.01    0.00  192156/192366      dso__new [61]
                       0.00    0.00       1/45282525     memdup [31]
                       0.00    0.00  192156/192230      dso__set_long_name [91]
       -----------------------------------------------
                     822.10    0.00  192156/192156      vdso__dso_findnew [7]
       [8]     96.9  822.10    0.00  192156         dsos__find [8]
       -----------------------------------------------
      
      It was found that the vdso__dso_findnew() function failed to locate
      VDSO__MAP_NAME ("[vdso]") in the dso list and have to insert a new
      entry at the end for 192156 times. This problem is due to the fact that
      there are 2 types of name in the dso entry - short name and long name.
      The initial dso__new() adds "[vdso]" to both the short and long names.
      After that, vdso__dso_findnew() modifies the long name to something
      like /tmp/perf-vdso.so-NoXkDj. The dsos__find() function only compares
      the long name. As a result, the same vdso entry is duplicated many
      time in the dso list. This bug increases memory consumption as well
      as slows the symbol processing time to a crawl.
      
      To resolve this problem, the dsos__find() function interface was
      modified to enable searching either the long name or the short
      name. The vdso__dso_findnew() will now search only the short name
      while the other call sites search for the long name as before.
      
      With this change, the cpu time of perf was reduced from 848.38s to
      15.77s and dsos__find() only accounted for 0.06% of the total time.
      
        0.06     15.73     0.01   192151     0.00     0.00  dsos__find
      Signed-off-by: default avatarWaiman Long <Waiman.Long@hp.com>
      Acked-by: default avatarIngo Molnar <mingo@kernel.org>
      Cc: "Chandramouleeswaran, Aswin" <aswin@hp.com>
      Cc: "Norton, Scott J" <scott.norton@hp.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Jiri Olsa <jolsa@redhat.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/1368110568-64714-1-git-send-email-Waiman.Long@hp.com
      [ replaced TRUE/FALSE with stdbool.h equivalents, fixing builds where
        those macros are not present (NO_LIBPYTHON=1 NO_LIBPERL=1), fix from Jiri Olsa ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f9ceffb6
    • Adrian Hunter's avatar
      perf evsel: Fix missing increment in sample parsing · 54bd2692
      Adrian Hunter authored
      The final sample format bit used to be PERF_SAMPLE_STACK_USER which
      neglected to do a final increment of the array pointer.  The result is
      that the following parsing might start at the wrong place.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.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@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/1372944040-32690-16-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      54bd2692
    • Adrian Hunter's avatar
      perf tools: Update symbol_conf.nr_events when processing attribute events · 7e0d6fc9
      Adrian Hunter authored
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.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@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/1372944040-32690-11-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7e0d6fc9
    • Adrian Hunter's avatar
      perf tools: Fix new_term() missing free on error path · 4be8be6b
      Adrian Hunter authored
      On the error path, newly allocated 'term' must be freed.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.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@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/1372944040-32690-6-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4be8be6b
    • Adrian Hunter's avatar
      perf tools: Fix parse_events_terms() segfault on error path · b2c34fde
      Adrian Hunter authored
      On the error path, 'data.terms' may not have been initialised.
      Signed-off-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
      Acked-by: default avatarJiri Olsa <jolsa@redhat.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@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/1372944040-32690-5-git-send-email-adrian.hunter@intel.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      b2c34fde
    • David Ahern's avatar
      perf evsel: Fix count parameter to read call in event_format__new · 7cab84e8
      David Ahern authored
      per realloc above the length of the buffer is alloc_size, not BUFSIZ.
      Adjust length per size as done for buf start.
      
      Addresses some valgrind complaints:
      
      ==1870== Syscall param read(buf) points to unaddressable byte(s)
      ==1870==    at 0x4E3F610: __read_nocancel (in /lib64/libpthread-2.14.90.so)
      ==1870==    by 0x44AEE1: event_format__new (unistd.h:45)
      ==1870==    by 0x44B025: perf_evsel__newtp (evsel.c:158)
      ==1870==    by 0x451919: add_tracepoint_event (parse-events.c:395)
      ==1870==    by 0x479815: parse_events_parse (parse-events.y:292)
      ==1870==    by 0x45463A: parse_events_option (parse-events.c:861)
      ==1870==    by 0x44FEE4: get_value (parse-options.c:113)
      ==1870==    by 0x450767: parse_options_step (parse-options.c:192)
      ==1870==    by 0x450C40: parse_options (parse-options.c:422)
      ==1870==    by 0x42735F: cmd_record (builtin-record.c:918)
      ==1870==    by 0x419D72: run_builtin (perf.c:319)
      ==1870==    by 0x4195F2: main (perf.c:376)
      ==1870==  Address 0xcffebf0 is 0 bytes after a block of size 8,192 alloc'd
      ==1870==    at 0x4C2A62F: malloc (vg_replace_malloc.c:270)
      ==1870==    by 0x4C2A7A3: realloc (vg_replace_malloc.c:662)
      ==1870==    by 0x44AF07: event_format__new (evsel.c:121)
      ==1870==    by 0x44B025: perf_evsel__newtp (evsel.c:158)
      ==1870==    by 0x451919: add_tracepoint_event (parse-events.c:395)
      ==1870==    by 0x479815: parse_events_parse (parse-events.y:292)
      ==1870==    by 0x45463A: parse_events_option (parse-events.c:861)
      ==1870==    by 0x44FEE4: get_value (parse-options.c:113)
      ==1870==    by 0x450767: parse_options_step (parse-options.c:192)
      ==1870==    by 0x450C40: parse_options (parse-options.c:422)
      ==1870==    by 0x42735F: cmd_record (builtin-record.c:918)
      ==1870==    by 0x419D72: run_builtin (perf.c:319)
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1372793245-4136-2-git-send-email-dsahern@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7cab84e8
    • Runzhen Wang's avatar
      perf tools: fix a typo of a Power7 event name · 7e40c920
      Runzhen Wang authored
      In the Power7 PMU guide:
      https://www.power.org/documentation/commonly-used-metrics-for-performance-analysis/
      PM_BRU_MPRED is referred to as PM_BR_MPRED.
      
      It fixed the typo by changing the name of the event in kernel and
      documentation accordingly.
      
      This patch changes the ABI, there are some reasons I think it's ok:
      
      - It is relatively new interface, specific to the Power7 platform.
      
      - No tools that we know of actually use this interface at this point
       (none are listed near the interface).
      
      - Users of this interface (eg oprofile users migrating to perf)
        would be more used to the "PM_BR_MPRED" rather than "PM_BRU_MPRED".
      
      - These are in the ABI/testing at this point rather than ABI/stable,
        so hoping we have some wiggle room.
      Signed-off-by: default avatarRunzhen Wang <runzhen@linux.vnet.ibm.com>
      Acked-by: default avatarMichael Ellerman <michael@ellerman.id.au>
      Cc: icycoder@gmail.com
      Cc: linuxppc-dev@lists.ozlabs.org
      Cc: Michael Ellerman <michael@ellerman.id.au>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Runzhen Wang <runzhew@clemson.edu>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Cc: Xiao Guangrong <xiaoguangrong@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1372407297-6996-2-git-send-email-runzhen@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7e40c920
    • Jiri Olsa's avatar
      perf tools: Fix -x/--exclude-other option for report command · 0276c22a
      Jiri Olsa authored
      Currently we have symbol_conf.exclude_other being set as true every time
      so the -x/--exclude-other has nothing to do.
      
      Also we have no way to see the data with symbol_conf.exclude_other being
      false which is useful sometimes.
      
      Fixing it by making symbol_conf.exclude_other false by default.
      
      1) Example without -x option:
      
        $ perf report -i perf.data.delete -p perf_session__delete -s parent
      
        +  99.91%  [other]
        +   0.08%  perf_session__delete
        +   0.00%  perf_session__delete_dead_threads
        +   0.00%  perf_session__delete_threads
      
      2) Example with -x option:
      
        $ ./perf report -i perf.data.delete -p perf_session__delete -s parent -x
      
        +  96.22%  perf_session__delete
        +   1.89%  perf_session__delete_dead_threads
        +   1.89%  perf_session__delete_threads
      
      In Example 1) we get the sorted out data together with the rest
      "[other]". This could help us estimate how much time we spent in the
      sorted data.
      
      In Example 2) the total is just the sorted data.
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      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@elte.hu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/n/tip-sg8fvu0fyqohf9ur9l38lhkw@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0276c22a
    • Namhyung Kim's avatar
      perf evlist: Enhance perf_evlist__start_workload() · bcf3145f
      Namhyung Kim authored
      When perf tries to start a workload, it relies on a pipe which the
      workload was blocked for reading.  After closing the pipe on the parent,
      the workload (child) can start the actual work via exec().
      
      However, if another process was forked after creating a workload, this
      mechanism cannot work since the other process (child) also inherits the
      pipe, so that closing the pipe in parent cannot unblock the workload.
      Fix it by using explicit write call can then closing it.
      
      For similar reason, the pipe fd on parent should be marked as CLOEXEC so
      that it can be closed after another child exec'ed.
      Signed-off-by: default avatarNamhyung Kim <namhyung@kernel.org>
      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: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Link: http://lkml.kernel.org/r/1372230862-15861-13-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      bcf3145f
    • Jiri Olsa's avatar
      perf record: Remove -f/--force option · 4a4d371a
      Jiri Olsa authored
      It no longer have any affect on the processing and is marked as obsolete
      anyway.
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      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@elte.hu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/n/tip-tvwyspiqr4getzfib2lw06ty@git.kernel.org
      Link: http://lkml.kernel.org/r/1372307120-737-1-git-send-email-namhyung@kernel.org
      [ combined patch removing the -f usage in various sub-commands, such as 'perf sched', etc, by Namhyung Kim ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4a4d371a
    • Jiri Olsa's avatar
      perf record: Remove -A/--append option · 563aecb2
      Jiri Olsa authored
      It's no longer working and needed.
      
      Quite straightforward discussion/vote was in here:
      http://marc.info/?t=137028288300004&r=1&w=2Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      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@elte.hu>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/n/tip-8fgdva12hl8w3xzzpsvvg7nx@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      563aecb2
    • Stephane Eranian's avatar
      perf stat: Avoid sending SIGTERM to random processes · d07f0b12
      Stephane Eranian authored
      This patch fixes a problem with perf stat whereby on termination it may
      send a SIGTERM signal to random processes on systems with high PID
      recycling. I got some actual bug reports on this.
      
      There is race between the SIGCHLD and sig_atexit() handlers.  This patch
      addresses this problem by clearing child_pid in the SIGCHLD handler.
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20130604154426.GA2928@quadSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      d07f0b12