1. 02 Sep, 2009 1 commit
    • Ingo Molnar's avatar
      perf tools: Clean up warnings list in the Makefile · 61562445
      Ingo Molnar authored
      Make it easier to turn warnings on/off by using a separate
      line for each warning added.
      
      Some of the warnings have too much of a nuisance factor and
      we might want to turn them off in the future.
      
      Cc: Arjan van de Ven <arjan@infradead.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      61562445
  2. 31 Aug, 2009 6 commits
    • Frederic Weisbecker's avatar
      perf tools: Complete support for dynamic strings · 561f732c
      Frederic Weisbecker authored
      Complete support for __str_loc type strings of ftrace events
      which have dynamic offsets values set for each of them inside
      their sammples.
      
      Before:
              geany-5759  [000]     0.000000: lock_release: name
              geany-5759  [000]     0.000000: lock_release: name
              geany-5759  [000]     0.000000: lock_release: name
        kondemand/0-362   [000]     0.000000: lock_release: name
            pdflush-421   [000]     0.000000: lock_release: name
      
      After:
              geany-5759  [000]     0.000000: lock_release: &u->lock
              geany-5759  [000]     0.000000: lock_release: key
              geany-5759  [000]     0.000000: lock_release: &group->notification_mutex
        kondemand/0-362   [000]     0.000000: lock_release: &rq->lock
            pdflush-421   [000]     0.000000: lock_release: &rq->lock
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1251693921-6579-4-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      561f732c
    • Frederic Weisbecker's avatar
      perf tools: Unify swapper tasks naming · 9b8055a5
      Frederic Weisbecker authored
      In perf tools, we hardcode the pid 0 cmdline resolving to
      "idle" because the init task is not included in the COMM
      events.
      
      But the idle tasks secondary cpus are resolved into their
      "init" name through the COMM events.
      
      We have then such strange result in perf report (ditto with
      trace):
      
          19.66%       init    [kernel]          [k] acpi_idle_enter_c1
          17.32%       [idle]  [kernel]          [k] acpi_idle_enter_c1
      
      It's then better to unify the swapper tasks into a single init
      name.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1251693921-6579-3-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      9b8055a5
    • Frederic Weisbecker's avatar
      perf tools: Resolve idle thread cmdline for perf trace · 3a2684ca
      Frederic Weisbecker authored
      The cmd-trace tool used the cmdline file and resolved the idle
      thread using a hardcoded check for the 0 task pid.
      
      Now we have a centralized way to do that from perf using
      register_idle_thread() API.
      
      Before:
      	:0-0     [000]     0.000000: irq_handler_entry: irq=0 handler=name
      	:0-0     [000]     0.000000: irq_handler_entry: irq=0 handler=name
      
      After:
      	[idle]-0     [000]     0.000000: irq_handler_entry: irq=0 handler=name
      	[idle]-0     [000]     0.000000: irq_handler_entry: irq=0 handler=name
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1251693921-6579-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3a2684ca
    • Frederic Weisbecker's avatar
      perf tools: Librarize idle thread registration · 5b447a6a
      Frederic Weisbecker authored
      Librarize register_idle_thread() used by annotate and report.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1251693921-6579-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5b447a6a
    • Frederic Weisbecker's avatar
      perf tools: Add missing parameters documentation · ec7ba4ea
      Frederic Weisbecker authored
      Add missing documentation for the following parameters:
      
      - perf record -R
      - perf report -g
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1251682323-10395-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ec7ba4ea
    • Ingo Molnar's avatar
      Merge branch 'perfcounters/tracing' into perfcounters/core · 19c95962
      Ingo Molnar authored
      Merge reason: this topic is ready now to merge into the main
                    development branch for .32, with functional
                    perf trace output.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      19c95962
  3. 28 Aug, 2009 3 commits
    • Pierre Habouzit's avatar
      perf tools: do not complain if root is owning perf.data · 119e7a22
      Pierre Habouzit authored
      This improves patch fa6963b2 so that perf.data stuff that has
      been dumped as root can be read (annotate/report) by a user
      without the use of the --force.
      
      Rationale is that root has plenty of ways to screw us (usually)
      that do not require twisted schemes involving specially
      crafting a perf.data.
      Signed-off-by: default avatarPierre Habouzit <pierre.habouzit@intersec.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: <stable@kernel.org>
      LKML-Reference: <20090827075902.GF19653@laphroaig.corp>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      119e7a22
    • Frederic Weisbecker's avatar
      perf tools: Fix missing string field printing in perf trace · d498bc1f
      Frederic Weisbecker authored
      Some string fields are not printed because of a missing printf
      in the post-processing.
      
      Before:
      	    perf-10070 [000]     0.000000: sched_switch: task :10070 [120] (R) ==> :5720 [120]
                 geany-5720  [000]     0.000000: sched_switch: task :5720 [120] (S) ==> :10070 [120]
                  perf-10070 [000]     0.000000: sched_switch: task :10070 [120] (R) ==> :5720 [120]
                 geany-5720  [000]     0.000000: sched_switch: task :5720 [120] (S) ==> :10070 [120]
                <idle>-0     [000]     0.000000: sched_switch: task :0 [140] (R) ==> :361 [115]
      
      After:
      	    perf-10070 [000]     0.000000: sched_switch: task perf:10070 [120] (R) ==> geany:5720 [120]
                 geany-5720  [000]     0.000000: sched_switch: task geany:5720 [120] (S) ==> perf:10070 [120]
                  perf-10070 [000]     0.000000: sched_switch: task perf:10070 [120] (R) ==> geany:5720 [120]
                 geany-5720  [000]     0.000000: sched_switch: task geany:5720 [120] (S) ==> perf:10070 [120]
                <idle>-0     [000]     0.000000: sched_switch: task swapper:0 [140] (R) ==> kondemand/1:361 [115]
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1251427567-10551-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d498bc1f
    • Frederic Weisbecker's avatar
      perf tools: Only save the event formats we need · 1ef2ed10
      Frederic Weisbecker authored
      While opening a trace event counter, every events are saved in
      the trace.info file. But we only want to save the
      specifications of the events we are using.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1251421798-9101-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      1ef2ed10
  4. 26 Aug, 2009 1 commit
  5. 25 Aug, 2009 2 commits
    • Peter Zijlstra's avatar
      perf_counter: Allow sharing of output channels · a4be7c27
      Peter Zijlstra authored
      Provide the ability to configure a counter to send its output
      to another (already existing) counter's output stream.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: stephane eranian <eranian@googlemail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20090819092023.980284148@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a4be7c27
    • Paul Mackerras's avatar
      perf_counter: Start counting time enabled when group leader gets enabled · fa289bec
      Paul Mackerras authored
      Currently, if a group is created where the group leader is
      initially disabled but a non-leader member is initially
      enabled, and then the leader is subsequently enabled some time
      later, the time_enabled for the non-leader member will reflect
      the whole time since it was created, not just the time since
      the leader was enabled.
      
      This is incorrect, because all of the members are effectively
      disabled while the leader is disabled, since none of the
      members can go on the PMU if the leader can't.
      
      Thus we have to update the ->tstamp_enabled for all the enabled
      group members when a group leader is enabled, so that the
      time_enabled computation only counts the time since the leader
      was enabled.
      
      Similarly, when disabling a group leader we have to update the
      time_enabled and time_running for all of the group members.
      
      Also, in update_counter_times, we have to treat a counter whose
      group leader is disabled as being disabled.
      Reported-by: default avatarStephane Eranian <eranian@googlemail.com>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: <stable@kernel.org>
      LKML-Reference: <19091.29664.342227.445006@drongo.ozlabs.ibm.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      fa289bec
  6. 24 Aug, 2009 1 commit
  7. 21 Aug, 2009 2 commits
    • Masami Hiramatsu's avatar
      perf trace: Add OPT_END to option array of perf-trace · 1909629f
      Masami Hiramatsu authored
      Add OPT_END to option array of perf-trace for fixing a SEGV bug when
      showing perf-trace help message.
      
      Without this patch;
       ./perf trace -h
      
       usage: perf trace [<options>] <command>
      
          -D, --dump-raw-trace  dump raw trace in ASCII
          -v, --verbose         be more verbose (show symbol address, etc)
          -f, Segmentation fault
      
      With this patch:
       ./perf trace -h
      
       usage: perf trace [<options>] <command>
      
          -D, --dump-raw-trace  dump raw trace in ASCII
          -v, --verbose         be more verbose (show symbol address, etc)
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
      Cc: systemtap <systemtap@sources.redhat.com>
      Cc: DLE <dle-develop@lists.sourceforge.net>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Cc: Zhaolei <zhaolei@cn.fujitsu.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      LKML-Reference: <20090821185603.11039.62109.stgit@localhost.localdomain>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      1909629f
    • Peter Zijlstra's avatar
      perf_counter: Fix typo in read() output generation · 4464fcaa
      Peter Zijlstra authored
      When you iterate a list, using the iterator is useful.
      
      Before:
      
         ID: 5
         ID: 5
         ID: 5
         ID: 5
         EVNT: 0x40088b scale: nan ID: 5 CNT: 1006252 ID: 6 CNT: 1011090 ID: 7 CNT: 1011196 ID: 8 CNT: 1011095
         EVNT: 0x40088c scale: 1.000000 ID: 5 CNT: 2003065 ID: 6 CNT: 2011671 ID: 7 CNT: 2012620 ID: 8 CNT: 2013479
         EVNT: 0x40088c scale: 1.000000 ID: 5 CNT: 3002390 ID: 6 CNT: 3015996 ID: 7 CNT: 3018019 ID: 8 CNT: 3020006
         EVNT: 0x40088b scale: 1.000000 ID: 5 CNT: 4002406 ID: 6 CNT: 4021120 ID: 7 CNT: 4024241 ID: 8 CNT: 4027059
      
      After:
      
         ID: 1
         ID: 2
         ID: 3
         ID: 4
         EVNT: 0x400889 scale: nan ID: 1 CNT: 1005270 ID: 2 CNT: 1009833 ID: 3 CNT: 1010065 ID: 4 CNT: 1010088
         EVNT: 0x400898 scale: nan ID: 1 CNT: 2001531 ID: 2 CNT: 2022309 ID: 3 CNT: 2022470 ID: 4 CNT: 2022627
         EVNT: 0x400888 scale: 0.489467 ID: 1 CNT: 3001261 ID: 2 CNT: 3027088 ID: 3 CNT: 3027941 ID: 4 CNT: 3028762
      Reported-by: default avatarstephane eranian <eranian@googlemail.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey J Ashford <cjashfor@us.ibm.com>
      Cc: perfmon2-devel <perfmon2-devel@lists.sourceforge.net>
      LKML-Reference: <1250867976.7538.73.camel@twins>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4464fcaa
  8. 19 Aug, 2009 1 commit
    • Peter Zijlstra's avatar
      perf tools: Check perf.data owner · fa6963b2
      Peter Zijlstra authored
      Add an owner check to opening perf.data files and a switch to
      silence it.
      
      Because perf-report/perf-annotate are binary parsers reading
      another users' perf.data file could be a security risk if the
      file were explicitly engineered to trigger bugs in the parser
      (we hope of course there are non such bugs, but you never
      know).
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20090819092023.896648538@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      fa6963b2
  9. 18 Aug, 2009 10 commits
    • Kyle McMartin's avatar
      perf tools: Make 'make html' work · b395cd8a
      Kyle McMartin authored
      pushd tools/perf/Documentation
      make html
      popd
      
      is failing for me...
      
          ASCIIDOC perf-annotate.html
      ERROR: unsafe: include file: /etc/asciidoc/./stylesheets/xhtml11.css
      ERROR: unsafe: include file:
      /etc/asciidoc/./stylesheets/xhtml11-manpage.css
      ERROR: unsafe: include file:
      /etc/asciidoc/./stylesheets/xhtml11-quirks.css
      make: *** [perf-annotate.html] Error 1
      
      Apparently asciidoc "unsafe" is the default mode of operation
      in practice.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=506953
      
      Works tidily now.
      Signed-off-by: default avatarKyle McMartin <kyle@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20090818164125.GM25206@bombadil.infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b395cd8a
    • Frederic Weisbecker's avatar
      perf tools: Save partial non-overlapping map · 6e086437
      Frederic Weisbecker authored
      The librarization of the thread helpers between annotate and
      report lost some perf report specifics.
      
      thread__insert_map() had its most uptodate version in perf
      report which cared about partial map overlapping. In case of
      overlap between two maps, perf annotate's version removes the
      whole old map without considering if it partially or
      absolutely overlaps the new map.
      
      We exported the odd version, change it by using the perf
      report version.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1250607843-7395-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6e086437
    • Frederic Weisbecker's avatar
      perf tools: Fix comm column adjusting · 4273b005
      Frederic Weisbecker authored
      The librarization of the thread helpers between annotate and
      report lost some perf report specifics.
      
      This patch fixes the thread comm column adjusting that has
      been omitted during this export.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1250604226-6852-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4273b005
    • Ingo Molnar's avatar
      perf annotate: Fix segmentation fault · 15f3fa4e
      Ingo Molnar authored
      Linus reported this perf annotate segfault:
      
              [torvalds@nehalem git]$ perf annotate unmap_vmas
              Segmentation fault
      
             	#0  map__clone (self=<value optimized out>) at builtin-annotate.c:236
             	#1  thread__fork (self=<value optimized out>) at builtin-annotate.c:372
      
      The bug here was that builtin-annotate.c was a copy of
      builtin-report.c and a threading related fix to builtin-report.c
      didnt get propagated to builtin-annotate.c ...
      Reported-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      15f3fa4e
    • Ingo Molnar's avatar
      perf_counter: Fix the PARISC build · f738eb1b
      Ingo Molnar authored
      PARISC does not build:
      
      /home/mingo/tip/kernel/perf_counter.c: In function 'perf_counter_index':
      /home/mingo/tip/kernel/perf_counter.c:2016: error: 'PERF_COUNTER_INDEX_OFFSET' undeclared (first use in this function)
      /home/mingo/tip/kernel/perf_counter.c:2016: error: (Each undeclared identifier is reported only once
      /home/mingo/tip/kernel/perf_counter.c:2016: error: for each function it appears in.)
      
      As PERF_COUNTER_INDEX_OFFSET is not defined.
      
      Now, we could define it in the architecture - but lets also provide
      a core default of 0 (which happens to be what all but one
      architecture uses at the moment).
      
      Architectures that need a different index offset should set this
      value in their asm/perf_counter.h files.
      
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Helge Deller <deller@gmx.de>
      Cc: linux-parisc@vger.kernel.org
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f738eb1b
    • Ingo Molnar's avatar
      perf tools: Remove obsolete defines · 1f18345b
      Ingo Molnar authored
      The _XOPEN_SOURCE* defines are not really needed on Linux and
      it's not like we'll port this to AIX ;-)
      
      The define also broke the build with gcc 4.4.1:
      
       CC util/trace-event-parse.o
       In file included from util/trace-event-parse.c:32:
       util/util.h:43:1: error: "_XOPEN_SOURCE" redefined
      
      So remove them.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      1f18345b
    • Ingo Molnar's avatar
      Merge branch 'master' of... · 8178d000
      Ingo Molnar authored
      Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/perfcounters into perfcounters/core
      8178d000
    • Paul Mackerras's avatar
      perf_counter: powerpc: Add callchain support · 20002ded
      Paul Mackerras authored
      This adds support for tracing callchains for powerpc, both 32-bit
      and 64-bit, and both in the kernel and userspace, from PMU interrupt
      context.
      
      The first three entries stored for each callchain are the NIP (next
      instruction pointer), LR (link register), and the contents of the LR
      save area in the second stack frame (the first is ignored because the
      ABI convention on powerpc is that functions save their return address
      in their caller's stack frame).  Because leaf functions don't have to
      save their return address (LR value) and don't have to establish a
      stack frame, it's possible for either or both of LR and the second
      stack frame's LR save area to have valid return addresses in them.
      This is basically impossible to disambiguate without either reading
      the code or looking at auxiliary information such as CFI tables.
      Since we don't want to do either of those things at interrupt time,
      we store both LR and the second stack frame's LR save area.
      
      Once we get past the second stack frame, there is no ambiguity; all
      return addresses we get are reliable.
      
      For kernel traces, we check whether they are valid kernel instruction
      addresses and store zero instead if they are not (rather than
      omitting them, which would make it impossible for userspace to know
      which was which).  We also store zero instead of the second stack
      frame's LR save area value if it is the same as LR.
      
      For kernel traces, we check for interrupt frames, and for user traces,
      we check for signal frames.  In each case, since we're starting a new
      trace, we store a PERF_CONTEXT_KERNEL/USER marker so that userspace
      knows that the next three entries are NIP, LR and the second stack frame
      for the interrupted context.
      
      We read user memory with __get_user_inatomic.  On 64-bit, if this
      PMU interrupt occurred while interrupts are soft-disabled, and
      there is no MMU hash table entry for the page, we will get an
      -EFAULT return from __get_user_inatomic even if there is a valid
      Linux PTE for the page, since hash_page isn't reentrant.  Thus we
      have code here to read the Linux PTE and access the page via the
      kernel linear mapping.  Since 64-bit doesn't use (or need) highmem
      there is no need to do kmap_atomic.  On 32-bit, we don't do soft
      interrupt disabling, so this complication doesn't occur and there
      is no need to fall back to reading the Linux PTE, since hash_page
      (or the TLB miss handler) will get called automatically if necessary.
      
      Note that we cannot get PMU interrupts in the interval during
      context switch between switch_mm (which switches the user address
      space) and switch_to (which actually changes current to the new
      process).  On 64-bit this is because interrupts are hard-disabled
      in switch_mm and stay hard-disabled until they are soft-enabled
      later, after switch_to has returned.  So there is no possibility
      of trying to do a user stack trace when the user address space is
      not current's address space.
      Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      20002ded
    • Paul Mackerras's avatar
      powerpc: Allow perf_counters to access user memory at interrupt time · 9c1e1052
      Paul Mackerras authored
      This provides a mechanism to allow the perf_counters code to access
      user memory in a PMU interrupt routine.  Such an access can cause
      various kinds of interrupt: SLB miss, MMU hash table miss, segment
      table miss, or TLB miss, depending on the processor.  This commit
      only deals with 64-bit classic/server processors, which use an MMU
      hash table.  32-bit processors are already able to access user memory
      at interrupt time.  Since we don't soft-disable on 32-bit, we avoid
      the possibility of reentering hash_page or the TLB miss handlers,
      since they run with interrupts disabled.
      
      On 64-bit processors, an SLB miss interrupt on a user address will
      update the slb_cache and slb_cache_ptr fields in the paca.  This is
      OK except in the case where a PMU interrupt occurs in switch_slb,
      which also accesses those fields.  To prevent this, we hard-disable
      interrupts in switch_slb.  Interrupts are already soft-disabled at
      this point, and will get hard-enabled when they get soft-enabled
      later.
      
      This also reworks slb_flush_and_rebolt: to avoid hard-disabling twice,
      and to make sure that it clears the slb_cache_ptr when called from
      other callers than switch_slb, the existing routine is renamed to
      __slb_flush_and_rebolt, which is called by switch_slb and the new
      version of slb_flush_and_rebolt.
      
      Similarly, switch_stab (used on POWER3 and RS64 processors) gets a
      hard_irq_disable() to protect the per-cpu variables used there and
      in ste_allocate.
      
      If a MMU hashtable miss interrupt occurs, normally we would call
      hash_page to look up the Linux PTE for the address and create a HPTE.
      However, hash_page is fairly complex and takes some locks, so to
      avoid the possibility of deadlock, we check the preemption count
      to see if we are in a (pseudo-)NMI handler, and if so, we don't call
      hash_page but instead treat it like a bad access that will get
      reported up through the exception table mechanism.  An interrupt
      whose handler runs even though the interrupt occurred when
      soft-disabled (such as the PMU interrupt) is considered a pseudo-NMI
      handler, which should use nmi_enter()/nmi_exit() rather than
      irq_enter()/irq_exit().
      Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      9c1e1052
    • Paul Mackerras's avatar
      powerpc/32: Always order writes to halves of 64-bit PTEs · 1660e9d3
      Paul Mackerras authored
      On 32-bit systems with 64-bit PTEs, the PTEs have to be written in two
      32-bit halves.  On SMP we write the higher-order half and then the
      lower-order half, with a write barrier between the two halves, but on
      UP there was no particular ordering of the writes to the two halves.
      
      This extends the ordering that we already do on SMP to the UP case as
      well.  The reason is that with the perf_counter subsystem potentially
      accessing user memory at interrupt time to get stack traces, we have
      to be careful not to create an incorrect but apparently valid PTE even
      on UP.
      Acked-by: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      1660e9d3
  10. 17 Aug, 2009 10 commits
    • Frederic Weisbecker's avatar
      perf tools: Make trace event format parser aware of cast to pointers · 3f9edc23
      Frederic Weisbecker authored
      The ftrace event format parser handles the usual casts but not
      the cast to pointers. Such casts have been introduced recently
      with the module trace events and raise the following parsing
      error:
      
      	Fatal: bad op token )
      
      This is because it considers the "*" character as a binary
      operator. Make it then aware of casts to pointers.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1250543271-8383-4-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3f9edc23
    • Frederic Weisbecker's avatar
      perf tools: Record events info also when :record suffix is used. · 9df37ddd
      Frederic Weisbecker authored
      You can enable a counter's PERF_SAMPLE_RAW attribute in two
      fashions:
      
      - using the -R option (every counters get PERF_SAMPLE_RAW)
      - using the :record suffix in a trace event counter name
      
      Currently we record the events info in a trace.info file from
      perf record when the former method is used but we omit it with
      the latter.
      
      Check both situations.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1250543271-8383-3-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      9df37ddd
    • Frederic Weisbecker's avatar
      perf tools: Warn while running perf trace without sample · 4bf2364a
      Frederic Weisbecker authored
      When a user runs perf trace using an input with logged
      counters without PERF_SAMPLE_RAW attribute, warn by giving a
      nice tip.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1250543271-8383-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4bf2364a
    • Frederic Weisbecker's avatar
      perf tools: Fix spelling mistake in callchain error · 6ede59c4
      Frederic Weisbecker authored
      While running perf report -g in a perf.data file that hasn't
      been recorded in callchain mode, the error reported has a
      spelling issue:
      
      	./perf report -g
      	selected -c but no callchain data. Did you call perf record without -g?
      
      Fix it.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1250543271-8383-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6ede59c4
    • Frederic Weisbecker's avatar
      perf tools: Add perf trace · 5f9c39dc
      Frederic Weisbecker authored
      This adds perf trace into the set of perf tools.
      
      It is written to fetch the tracepoint samples from perf events
      and display them, according to the events information given by
      the debugfs files through the util/trace* tools.
      
      It is a rough first shot and doesn't yet handle the cpu,
      timestamps fields and some other things.
      
      Example:
      
       perf record -f -e workqueue:workqueue_execution:record -F 1 -a
       perf trace
      
             kblockd/0-236   [000]     0.000000: workqueue_execution: thread=:236 func=cfq_kick_queue+0x0
           kondemand/0-360   [000]     0.000000: workqueue_execution: thread=:360 func=do_dbs_timer+0x0
           kondemand/0-360   [000]     0.000000: workqueue_execution: thread=:360 func=do_dbs_timer+0x0
           kondemand/1-361   [000]     0.000000: workqueue_execution: thread=:361 func=do_dbs_timer+0x0
           kondemand/1-361   [000]     0.000000: workqueue_execution: thread=:361 func=do_dbs_timer+0x0
           kondemand/1-361   [000]     0.000000: workqueue_execution: thread=:361 func=do_dbs_timer+0x0
           kondemand/1-361   [000]     0.000000: workqueue_execution: thread=:361 func=do_dbs_timer+0x0
           kondemand/1-361   [000]     0.000000: workqueue_execution: thread=:361 func=do_dbs_timer+0x0
           kondemand/1-361   [000]     0.000000: workqueue_execution: thread=:361 func=do_dbs_timer+0x0
           kondemand/1-361   [000]     0.000000: workqueue_execution: thread=:361 func=do_dbs_timer+0x0
           kondemand/1-361   [000]     0.000000: workqueue_execution: thread=:361 func=do_dbs_timer+0x0
           kondemand/1-361   [000]     0.000000: workqueue_execution: thread=:361 func=do_dbs_timer+0x0
           kondemand/1-361   [000]     0.000000: workqueue_execution: thread=:361 func=do_dbs_timer+0x0
           kondemand/1-361   [000]     0.000000: workqueue_execution: thread=:361 func=do_dbs_timer+0x0
           kondemand/1-361   [000]     0.000000: workqueue_execution: thread=:361 func=do_dbs_timer+0x0
           kondemand/1-361   [000]     0.000000: workqueue_execution: thread=:361 func=do_dbs_timer+0x0
      
      Todo:
      
      - A lot of things!
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: "Luis Claudio R. Goncalves" <lclaudio@uudg.org>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Jon Masters <jonathan@jonmasters.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Cc: Zhaolei <zhaolei@cn.fujitsu.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: "Frank Ch. Eigler" <fche@redhat.com>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Anton Blanchard <anton@samba.org>
      LKML-Reference: <1250518688-7207-4-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5f9c39dc
    • Steven Rostedt's avatar
      perf tools: Add trace event information parser · ea4010d1
      Steven Rostedt authored
      Add util/trace-event-parse.c which provides the handlers to
      parse the ftrace events info from the stream and handles the
      ftrace perf samples event printing.
      
      This file is a rename of the parse-events.c file from the
      trace-cmd tools, written by Steven Rostedt and Josh Triplett,
      originated from the git tree:
      
        git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
      
      This is a perf tools integration.
      
      [ fweisbec@gmail.com: various changes for perf tools
                            integration. ]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: "Luis Claudio R. Goncalves" <lclaudio@uudg.org>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Jon Masters <jonathan@jonmasters.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Cc: Zhaolei <zhaolei@cn.fujitsu.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: "Frank Ch. Eigler" <fche@redhat.com>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Anton Blanchard <anton@samba.org>
      LKML-Reference: <1250518688-7207-3-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ea4010d1
    • Steven Rostedt's avatar
      perf tools: Add trace event debugfs stream reader · 538bafb5
      Steven Rostedt authored
      Add util/trace-event-read.c which handles trace events
      informations reading.
      
      This file is a rename of the trace-read.c file from the
      trace-cmd tools, written by Steven Rostedt and Josh Triplett,
      originated from the git tree:
      
         git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
      
      This is its perf tools integration.
      
      [ fweisbec@gmail.com: various changes for perf tools
                            integration. ]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: "Luis Claudio R. Goncalves" <lclaudio@uudg.org>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Jon Masters <jonathan@jonmasters.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Cc: Zhaolei <zhaolei@cn.fujitsu.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: "Frank Ch. Eigler" <fche@redhat.com>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Anton Blanchard <anton@samba.org>
      LKML-Reference: <1250518688-7207-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      538bafb5
    • Steven Rostedt's avatar
      perf tools: Add trace event debugfs IO handler · 52050943
      Steven Rostedt authored
      Add util/trace-event-info.c which handles ftrace file IO from
      debugfs and provides general helpers to fetch/save ftrace
      events informations.
      
      This file is a rename of the trace-cmd.c file from the
      trace-cmd tools, written by Steven Rostedt and Josh Triplett,
      originated from the git tree:
      
        git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git
      
      This is a perf tools integration.
      
      For now, ftrace events information is saved in a separate file
      than the standard perf.data
      
      [fweisbec@gmail.com: various changes for perf tools integration]
      Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: "Luis Claudio R. Goncalves" <lclaudio@uudg.org>
      Cc: Clark Williams <williams@redhat.com>
      Cc: Jon Masters <jonathan@jonmasters.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
      Cc: Christoph Hellwig <hch@infradead.org>
      Cc: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Cc: Zhaolei <zhaolei@cn.fujitsu.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: "Frank Ch. Eigler" <fche@redhat.com>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Jason Baron <jbaron@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Jiaying Zhang <jiayingz@google.com>
      Cc: Anton Blanchard <anton@samba.org>
      LKML-Reference: <1250518688-7207-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      52050943
    • Paul Mackerras's avatar
      perf_counter: Check task on counter read IPI · e1ac3614
      Paul Mackerras authored
      In general, code in perf_counter.c that is called through an
      IPI checks, for per-task counters, that the counter's task is
      still the current task.  This is to handle the race condition
      where the cpu switches from the task we want to another task in
      the interval between sending the IPI and the IPI arriving and
      being handled on the target CPU.
      
      For some reason, __perf_counter_read is missing this check, yet
      there is no reason why the race condition can't occur.  This
      adds a check that the current task is the one we want.  If it
      isn't, we just return.  In that case the counter->count value
      should be up to date, since it will have been updated when the
      counter was scheduled out, which must have happened since the
      IPI was sent.
      
      I don't have an example of an actual failure due to this race,
      but it seems obvious that it could occur and we need to guard
      against it.
      Signed-off-by: default avatarPaul Mackerras <paulus@samba.org>
      Acked-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <19076.63614.277861.368125@drongo.ozlabs.ibm.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e1ac3614
    • Carlos R. Mafra's avatar
      perf: Rename perf-examples.txt to examples.txt · 2932cffc
      Carlos R. Mafra authored
      Rename it to examples.txt to avoid the perf-*.txt pattern in
      the Makefile, otherwise 'make doc' fails because
      perf-examples.txt is not formatted to be a man page:
      
       ERROR: perf-examples.txt: line 1: manpage document title is mandatory
      Signed-off-by: default avatarCarlos R. Mafra <crmafra@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2932cffc
  11. 16 Aug, 2009 3 commits