1. 25 Feb, 2010 9 commits
    • Arnaldo Carvalho de Melo's avatar
      perf annotate: Defer allocating sym_priv->hist array · 628ada0c
      Arnaldo Carvalho de Melo authored
      Because symbol->end is not fixed up at symbol_filter time, only
      after all symbols for a DSO are loaded, and that, for asm
      symbols, may be bogus, causing segfaults when hits happen in
      these symbols.
      Reported-by: default avatarDavid Miller <davem@davemloft.net>
      Reported-by: default avatarAnton Blanchard <anton@samba.org>
      Acked-by: default avatarDavid Miller <davem@davemloft.net>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: <stable@kernel.org> # for .33.x. Does not apply cleanly, needs backport.
      LKML-Reference: <20100225155740.GB8553@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      628ada0c
    • Arnaldo Carvalho de Melo's avatar
      perf symbols: Improve debugging information about symtab origins · 3846df2e
      Arnaldo Carvalho de Melo authored
      Be more clear about DSO long names and tell from which file
      kernel symbols were obtained, all in --verbose mode:
      
          [root@mica ~]# perf report -v > /dev/null
          Looking at the vmlinux_path (5 entries long)
          Using /lib/modules/2.6.33-rc8-tip-00777-g0918527-dirty/build/vmlinux for symbols
          [root@mica ~]# mv /lib/modules/2.6.33-rc8-tip-00777-g0918527-dirty/build/vmlinux /tmp/dd
          [root@mica ~]# perf report -v > /dev/null
          Looking at the vmlinux_path (5 entries long)
          Using /proc/kallsyms for symbols
          [root@mica ~]#
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1266866139-6361-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3846df2e
    • Arnaldo Carvalho de Melo's avatar
      perf top: Use a macro instead of a constant variable · c7ad21af
      Arnaldo Carvalho de Melo authored
      To overcome a silly gcc warning:
      
       cc1: warnings being treated as errors
       builtin-top.c: In function ‘lookup_sym_source’:
       builtin-top.c:291: warning: not protecting local variables:
       variable length buffer make: *** [builtin-top.o] Error 1
       make: *** Waiting for unfinished jobs....
      
      That is emitted for this:
      
      	const size_t pattern_len = BITS_PER_LONG / 4 + 2;
      	char pattern[pattern_len + 1];
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1266866062-6287-1-git-send-email-acme@infradead.org>
      [ -v2: macroify the naming style ]
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c7ad21af
    • Zhang, Yanmin's avatar
      perf symbols: Check the right return variable · 37fe5fcb
      Zhang, Yanmin authored
      In function dso__split_kallsyms(), curr_map saves the return value
      of map__new2. So check it instead of var map after the call returns.
      Signed-off-by: default avatarZhang Yanmin <yanmin_zhang@linux.intel.com>
      Acked-by: default avatarDavid S. Miller <davem@davemloft.net>
      Cc: <stable@kernel.org> # for .33.x
      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: <1267066851.1726.9.camel@localhost>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      37fe5fcb
    • Frederic Weisbecker's avatar
      perf/scripts: Tag syscall_name helper as not yet available · c2fbaa4b
      Frederic Weisbecker authored
      syscall_name() helper, which resolves a syscall arch number to
      its name, is not yet available as we first need to implement
      event injection for it to work.
      
      Remove it from the documentation or tag its references as
      unavailable yet. Once it's implemented, we can just revert
      the current patch.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Keiichi KII <k-keiichi@bx.jp.nec.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      c2fbaa4b
    • Tom Zanussi's avatar
      perf/scripts: Add perf-trace-python Documentation · cff68e58
      Tom Zanussi authored
      Also small update to perf-trace-perl and perf-trace docs.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Keiichi KII <k-keiichi@bx.jp.nec.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1264580883-15324-13-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      cff68e58
    • Tom Zanussi's avatar
      perf/scripts: Remove unnecessary PyTuple resizes · 44ad9cd8
      Tom Zanussi authored
      If we know the size of a tuple in advance, there's no need to resize
      it - start out with the known size in the first place.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Keiichi KII <k-keiichi@bx.jp.nec.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1266822779.6426.4.camel@tropicana>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      44ad9cd8
    • Tom Zanussi's avatar
      perf/scripts: Add syscall tracing scripts · 4d161f03
      Tom Zanussi authored
      Adds a set of scripts that aggregate system call totals and system
      call errors.  Most are Python scripts that also test basic
      functionality of the new Python engine, but there's also one Perl
      script added for comparison and for reference in some new
      Documentation contained in a later patch.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Keiichi KII <k-keiichi@bx.jp.nec.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1264580883-15324-8-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      4d161f03
    • Tom Zanussi's avatar
      perf/scripts: Add Python scripting engine · 7e4b21b8
      Tom Zanussi authored
      Add base support for Python scripting to perf trace.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Keiichi KII <k-keiichi@bx.jp.nec.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1264580883-15324-6-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      7e4b21b8
  2. 23 Feb, 2010 5 commits
    • Tom Zanussi's avatar
      perf/scripts: Remove check-perf-trace from listed scripts · 266fe2f2
      Tom Zanussi authored
      The check-perf-trace script only checks Perl functionality, and
      doesn't really need to be listed as as user script anyway.
      
      This only removes the '-report' shell script, so although it doesn't
      appear in the listing, the '-record' shell script and the check perf
      trace perl script itself is still available and can still be run
      manually as such:
      
      $ libexec/perf-core/scripts/perl/bin/check-perf-trace-record
      $ perf trace -s libexec/perf-core/scripts/perl/check-perf-trace.pl
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Keiichi KII <k-keiichi@bx.jp.nec.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1264580883-15324-6-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      266fe2f2
    • Tom Zanussi's avatar
      perf/scripts: Move Perl scripting files to scripting-engines dir · 82d156cd
      Tom Zanussi authored
      Create a scripting-engines directory to contain scripting engine
      implementation code, in anticipation of the addition of new scripting
      support.  Also removes trace-event-perl.h.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Keiichi KII <k-keiichi@bx.jp.nec.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1264580883-15324-5-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      82d156cd
    • Tom Zanussi's avatar
      perf/scripts: Move common code out of Perl-specific files · 7397d80d
      Tom Zanussi authored
      This stuff is needed by all scripting engines; move it from the Perl
      engine source to a more common place.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Keiichi KII <k-keiichi@bx.jp.nec.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1264580883-15324-4-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      7397d80d
    • Tom Zanussi's avatar
      perf/scripts: Fix bug in Util.pm · e26207a3
      Tom Zanussi authored
      Fix bogus calculation.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Keiichi KII <k-keiichi@bx.jp.nec.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1264580883-15324-3-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      e26207a3
    • Tom Zanussi's avatar
      perf/scripts: Fix supported language listing option · f526d68b
      Tom Zanussi authored
      'perf trace -s list' prints a list of the supported scripting
      languages.  One problem with it is that it falls through and prints
      the trace as well.  The use of 'list' for this also makes it easy to
      confuse with 'perf trace -l', used for listing available scripts.  So
      change 'perf trace -s list' to 'perf trace -s lang' and fixes the
      fall-through problem.
      Signed-off-by: default avatarTom Zanussi <tzanussi@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Keiichi KII <k-keiichi@bx.jp.nec.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <1264580883-15324-2-git-send-email-tzanussi@gmail.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      f526d68b
  3. 21 Feb, 2010 2 commits
  4. 08 Feb, 2010 1 commit
    • austin_zhang@linux.intel.com's avatar
      perf record: Fix existing process callgraph symbol · f7e7ee36
      austin_zhang@linux.intel.com authored
      When 'perf record -g' a existing process, even with debuginfo
      packages, still cannnot get symbol from 'perf report'.
      
      try:
      
       perf record -g -p `pidof xxx` -f
       perf report
      
          68.26%    :1181           b74870f2  [.] 0x000000b74870f2
                    |
                    |--32.09%-- 0xb73b5b44
                    |          0xb7487102
                    |          0xb748a4e2
                    |          0xb748633d
                    |          0xb73b41cd
                    |          0xb73b4467
                    |          0xb747d531
      
      The reason is: for existing process, in __cmd_record(),
      the pid is 0 rather than the existing process id.
      Signed-off-by: default avatarAustin Zhang <austin_zhang@linux.intel.com>
      Acked-by: default avatarPeter 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: <4710.10.255.24.35.1265389362.squirrel@linux.intel.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f7e7ee36
  5. 07 Feb, 2010 3 commits
    • Masami Hiramatsu's avatar
      x86/alternatives: Fix build warning · 076dc4a6
      Masami Hiramatsu authored
      Fixes these warnings:
      
       arch/x86/kernel/alternative.c: In function 'alternatives_text_reserved':
       arch/x86/kernel/alternative.c:402: warning: comparison of distinct pointer types lacks a cast
       arch/x86/kernel/alternative.c:402: warning: comparison of distinct pointer types lacks a cast
       arch/x86/kernel/alternative.c:405: warning: comparison of distinct pointer types lacks a cast
       arch/x86/kernel/alternative.c:405: warning: comparison of distinct pointer types lacks a cast
      
      Caused by:
      
        2cfa1978: ftrace/alternatives: Introducing *_text_reserved functions
      
      Changes in v2:
        - Use local variables to compare, instead of type casts.
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
      Cc: systemtap <systemtap@sources.redhat.com>
      Cc: DLE <dle-develop@lists.sourceforge.net>
      LKML-Reference: <20100205171647.15750.37221.stgit@dhcp-100-2-132.bos.redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      076dc4a6
    • Arnaldo Carvalho de Melo's avatar
      perf top: Use address pattern in lookup_sym_source · 5f485364
      Arnaldo Carvalho de Melo authored
      Because we may have aliases, like __GI___strcoll_l in
      /lib64/libc-2.10.2.so that appears in objdump as:
      
      $ objdump --start-address=0x0000003715a86420 \
                 --stop-address=0x0000003715a872dc -dS /lib64/libc-2.10.2.so
      
      0000003715a86420 <__strcoll_l>:
        3715a86420:	55                   	push   %rbp
        3715a86421:	48 89 e5             	mov    %rsp,%rbp
        3715a86424:	41 57                	push   %r15
      [root@doppio linux-2.6-tip]#
      
      So look for the address exactly at the start of the line instead
      so that annotation can work for in these cases.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Kirill Smelkov <kirr@landau.phys.spbu.ru>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1265550376-12665-2-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5f485364
    • Kirill Smelkov's avatar
      perf top: Fix annotate for userspace · ee11b90b
      Kirill Smelkov authored
      First, for programs and prelinked libraries, annotate code was
      fooled by objdump output IPs (src->eip in the code) being
      wrongly converted to absolute IPs. In such case there were no
      conversion needed, but in
      
         src->eip = strtoull(src->line, NULL, 16);
         src->eip = map->unmap_ip(map, src->eip); // = eip + map->start - map->pgoff
      
      we were reading absolute address from objdump (e.g. 8048604) and
      then almost doubling it, because eip & map->start are
      approximately close for small programs.
      
      Needless to say, that later, in record_precise_ip() there was no
      matching with real runtime IPs.
      
      And second, like with `perf annotate` the problem with
      non-prelinked *.so was that we were doing rip -> objdump address
      conversion wrong.
      
      Also, because unlike `perf annotate`, `perf top` code does
      annotation based on absolute IPs for performance reasons(*), new
      helper for mapping objdump addresse to IP is introduced.
      
      (*) we get samples info in absolute IPs, and since we do lots of
          hit-testing on absolute IPs at runtime in record_precise_ip(), it's
          better to convert objdump addresses to IPs once and do no conversion
          at runtime.
      
      I also had to fix how objdump output is parsed (with hardcoded
      8/16 characters format, which was inappropriate for ET_DYN dsos
      with small addresses like '4ac')
      
      Also note, that not all objdump output lines has associtated
      IPs, e.g. look at source lines here:
      
          000004ac <my_strlen>:
          extern "C"
          int my_strlen(const char *s)
           4ac:   55                      push   %ebp
           4ad:   89 e5                   mov    %esp,%ebp
           4af:   83 ec 10                sub    $0x10,%esp
          {
              int len = 0;
           4b2:   c7 45 fc 00 00 00 00    movl   $0x0,-0x4(%ebp)
           4b9:   eb 08                   jmp    4c3 <my_strlen+0x17>
      
              while (*s) {
                  ++len;
           4bb:   83 45 fc 01             addl   $0x1,-0x4(%ebp)
                  ++s;
           4bf:   83 45 08 01             addl   $0x1,0x8(%ebp)
      
      So we mark them with eip=0, and ignore such lines in annotate
      lookup code.
      Signed-off-by: default avatarKirill Smelkov <kirr@landau.phys.spbu.ru>
      [ Note: one hunk of this patch was applied by Mike in 57d81889 ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1265550376-12665-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ee11b90b
  6. 05 Feb, 2010 1 commit
    • Masami Hiramatsu's avatar
      kprobes: Add mcount to the kprobes blacklist · 5ecaafdb
      Masami Hiramatsu authored
      Since mcount function can be called from everywhere,
      it should be blacklisted. Moreover, the "mcount" symbol
      is a special symbol name. So, it is better to put it in
      the generic blacklist.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
      Cc: systemtap <systemtap@sources.redhat.com>
      Cc: DLE <dle-develop@lists.sourceforge.net>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20100205062433.3745.36726.stgit@dhcp-100-2-132.bos.redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5ecaafdb
  7. 04 Feb, 2010 19 commits
    • Ingo Molnar's avatar
      perf tools: Fix session init on non-modular kernels · 2161db96
      Ingo Molnar authored
      perf top and perf record refuses to initialize on non-modular kernels:
      refuse to initialize:
      
       $ perf top -v
        map_groups__set_modules_path_dir: cannot open /lib/modules/2.6.33-rc6-tip-00586-g398dde3-dirty/
      
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1265223128-11786-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2161db96
    • Xiao Guangrong's avatar
      perf tools: Clean up O_LARGEFILE et al usage · f887f301
      Xiao Guangrong authored
      Setting _FILE_OFFSET_BITS and using O_LARGEFILE, lseek64, etc,
      is redundant. Thanks H. Peter Anvin for pointing it out.
      
      So, this patch removes O_LARGEFILE, lseek64, etc.
      Suggested-by: default avatar"H. Peter Anvin" <hpa@zytor.com>
      Signed-off-by: default avatarXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <4B6A8972.3070605@cn.fujitsu.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f887f301
    • Stephane Eranian's avatar
      perf_events, x86: Fix bug in hw_perf_enable() · 447a194b
      Stephane Eranian authored
      We cannot assume that because hwc->idx == assign[i], we can avoid
      reprogramming the counter in hw_perf_enable().
      
      The event may have been scheduled out and another event may have been
      programmed into this counter. Thus, we need a more robust way of
      verifying if the counter still contains config/data related to an event.
      
      This patch adds a generation number to each counter on each cpu. Using
      this mechanism we can verify reliabilty whether the content of a counter
      corresponds to an event.
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarPeter 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: <4b66dc67.0b38560a.1635.ffffae18@mx.google.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      447a194b
    • Peter Zijlstra's avatar
      bitops: Ensure the compile time HWEIGHT is only used for such · fce877e3
      Peter Zijlstra authored
      Avoid accidental misuse by failing to compile things
      Suggested-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      fce877e3
    • Peter Zijlstra's avatar
      perf_events, x86: Implement intel core solo/duo support · 8c48e444
      Peter Zijlstra authored
      Implement Intel Core Solo/Duo, aka.
      Intel Architectural Performance Monitoring Version 1.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      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>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8c48e444
    • Peter Zijlstra's avatar
      perf_events: Optimize perf_event_task_tick() · 9717e6cd
      Peter Zijlstra authored
      Pretty much all of the calls do perf_disable/perf_enable cycles, pull
      that out to cut back on hardware programming.
      Signed-off-by: default avatarPeter 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>
      9717e6cd
    • Masami Hiramatsu's avatar
      ftrace: Remove record freezing · f24bb999
      Masami Hiramatsu authored
      Remove record freezing. Because kprobes never puts probe on
      ftrace's mcount call anymore, it doesn't need ftrace to check
      whether kprobes on it.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
      Cc: systemtap <systemtap@sources.redhat.com>
      Cc: DLE <dle-develop@lists.sourceforge.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: przemyslaw@pawelczyk.it
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20100202214925.4694.73469.stgit@dhcp-100-2-132.bos.redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f24bb999
    • Masami Hiramatsu's avatar
      kprobes: Check probe address is reserved · 4554dbcb
      Masami Hiramatsu authored
      Check whether the address of new probe is already reserved by
      ftrace or alternatives (on x86) when registering new probe.
      If reserved, it returns an error and not register the probe.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
      Cc: systemtap <systemtap@sources.redhat.com>
      Cc: DLE <dle-develop@lists.sourceforge.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: przemyslaw@pawelczyk.it
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Jim Keniston <jkenisto@us.ibm.com>
      Cc: Mathieu Desnoyers <compudj@krystal.dyndns.org>
      Cc: Jason Baron <jbaron@redhat.com>
      LKML-Reference: <20100202214918.4694.94179.stgit@dhcp-100-2-132.bos.redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4554dbcb
    • Masami Hiramatsu's avatar
      ftrace/alternatives: Introducing *_text_reserved functions · 2cfa1978
      Masami Hiramatsu authored
      Introducing *_text_reserved functions for checking the text
      address range is partially reserved or not. This patch provides
      checking routines for x86 smp alternatives and dynamic ftrace.
      Since both functions modify fixed pieces of kernel text, they
      should reserve and protect those from other dynamic text
      modifier, like kprobes.
      
      This will also be extended when introducing other subsystems
      which modify fixed pieces of kernel text. Dynamic text modifiers
      should avoid those.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
      Cc: systemtap <systemtap@sources.redhat.com>
      Cc: DLE <dle-develop@lists.sourceforge.net>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: przemyslaw@pawelczyk.it
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Jim Keniston <jkenisto@us.ibm.com>
      Cc: Mathieu Desnoyers <compudj@krystal.dyndns.org>
      Cc: Jason Baron <jbaron@redhat.com>
      LKML-Reference: <20100202214911.4694.16587.stgit@dhcp-100-2-132.bos.redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2cfa1978
    • Masami Hiramatsu's avatar
      kprobes: Disable booster when CONFIG_PREEMPT=y · 615d0ebb
      Masami Hiramatsu authored
      Disable kprobe booster when CONFIG_PREEMPT=y at this time,
      because it can't ensure that all kernel threads preempted on
      kprobe's boosted slot run out from the slot even using
      freeze_processes().
      
      The booster on preemptive kernel will be resumed if
      synchronize_tasks() or something like that is introduced.
      Signed-off-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
      Cc: systemtap <systemtap@sources.redhat.com>
      Cc: DLE <dle-develop@lists.sourceforge.net>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jim Keniston <jkenisto@us.ibm.com>
      Cc: Mathieu Desnoyers <compudj@krystal.dyndns.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20100202214904.4694.24330.stgit@dhcp-100-2-132.bos.redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      615d0ebb
    • Mike Galbraith's avatar
      perf annotate: Fix perf top module symbol annotation · 57d81889
      Mike Galbraith authored
      Signed-off-by: default avatarMike Galbraith <efault@gmx.de>
      Cc: Kirill Smelkov <kirr@landau.phys.spbu.ru>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@infradead.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1265265106.6364.5.camel@marge.simson.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      57d81889
    • Kirill Smelkov's avatar
      perf top: Teach it to autolocate vmlinux · 6cff0e8d
      Kirill Smelkov authored
      By relying on logic in dso__load_kernel_sym(), we can
      automatically load vmlinux.
      
      The only thing which needs to be adjusted, is how --sym-annotate
      option is handled - now we can't rely on vmlinux been loaded
      until full successful pass of dso__load_vmlinux(), but that's
      not the case if we'll do sym_filter_entry setup in
      symbol_filter().
      
      So move this step right after event__process_sample() where we
      know the whole dso__load_kernel_sym() pass is done.
      
      By the way, though conceptually similar `perf top` still can't
      annotate userspace - see next patches with fixes.
      Signed-off-by: default avatarKirill Smelkov <kirr@landau.phys.spbu.ru>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1265223128-11786-9-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6cff0e8d
    • Kirill Smelkov's avatar
      perf annotate: Fix it for non-prelinked *.so · 7a2b6209
      Kirill Smelkov authored
      The problem was we were incorrectly calculating objdump
      addresses for sym->start and sym->end, look:
      
      For simple ET_DYN type DSO (*.so) with one function, objdump -dS
      output is something like this:
      
          000004ac <my_strlen>:
          int my_strlen(const char *s)
           4ac:   55                      push   %ebp
           4ad:   89 e5                   mov    %esp,%ebp
           4af:   83 ec 10                sub    $0x10,%esp
          {
      
      i.e. we have relative-to-dso-mapping IPs (=RIP) there.
      
      For ET_EXEC type and probably for prelinked libs as well (sorry
      can't test - I don't use prelink) objdump outputs absolute IPs,
      e.g.
      
          08048604 <zz_strlen>:
          extern "C"
          int zz_strlen(const char *s)
           8048604:       55                      push   %ebp
           8048605:       89 e5                   mov    %esp,%ebp
           8048607:       83 ec 10                sub    $0x10,%esp
          {
      
      So, if sym->start is always relative to dso mapping(*), we'll
      have to unmap it for ET_EXEC like cases, and leave as is for
      ET_DYN cases.
      
      (*) and it is - we've explicitely made it relative. Look for
          adjust_symbols handling in dso__load_sym()
      
      Previously we were always unmapping sym->start and for ET_DYN
      dsos resulting addresses were wrong, and so objdump output was
      empty.
      
      The end result was that perf annotate output for symbols from
      non-prelinked *.so had always 0.00% percents only, which is
      wrong.
      
      To fix it, let's introduce a helper for converting rip to
      objdump address, and also let's document what map_ip() and
      unmap_ip() do -- I had to study sources for several hours to
      understand it.
      Signed-off-by: default avatarKirill Smelkov <kirr@landau.phys.spbu.ru>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1265223128-11786-8-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      7a2b6209
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Adjust some verbosity levels · 29a9f66d
      Arnaldo Carvalho de Melo authored
      Not to pollute too much 'perf annotate' debugging sessions.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1265223128-11786-7-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      29a9f66d
    • Arnaldo Carvalho de Melo's avatar
      perf record: Stop intercepting events, use postprocessing to get build-ids · 6122e4e4
      Arnaldo Carvalho de Melo authored
      We want to stream events as fast as possible to perf.data, and
      also in the future we want to have splice working, when no
      interception will be possible.
      
      Using build_id__mark_dso_hit_ops to create the list of DSOs that
      back MMAPs we also optimize disk usage in the build-id cache by
      only caching DSOs that had hits.
      Suggested-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Xiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1265223128-11786-6-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6122e4e4
    • Arnaldo Carvalho de Melo's avatar
      perf build-id: Move the routine to find DSOs with hits to the lib · 7b2567c1
      Arnaldo Carvalho de Melo authored
      Because 'perf record' will have to find the build-ids in after
      we stop recording, so as to reduce even more the impact in the
      workload while we do the measurement.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1265223128-11786-5-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      7b2567c1
    • Arnaldo Carvalho de Melo's avatar
      perf probe: Don't use a perf_session instance just to resolve symbols · 8ad94c60
      Arnaldo Carvalho de Melo authored
      With the recent modifications done to untie the session and
      symbol layers, 'perf probe' now can use just the symbols layer.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarMasami Hiramatsu <mhiramat@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8ad94c60
    • Arnaldo Carvalho de Melo's avatar
      perf symbols: Ditch vdso global variable · 8d92c02a
      Arnaldo Carvalho de Melo authored
      We can check using strcmp, most DSOs don't start with '[' so the
      test is cheap enough and we had to test it there anyway since
      when reading perf.data files we weren't calling the routine that
      created this global variable and thus weren't setting it as
      "loaded", which was causing a bogus:
      
        Failed to open [vdso], continuing without symbols
      
      Message as the first line of 'perf report'.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric 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: <1265223128-11786-3-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8d92c02a
    • Arnaldo Carvalho de Melo's avatar
      perf symbols: Fixup vsyscall maps · 6275ce2d
      Arnaldo Carvalho de Melo authored
      While debugging a problem reported by Pekka Enberg by printing
      the IP and all the maps for a thread when we don't find a map
      for an IP I noticed that dso__load_sym needs to fixup these
      extra maps it creates to hold symbols in different ELF sections
      than the main kernel one.
      
      Now we're back showing things like:
      
      [root@doppio linux-2.6-tip]# perf report | grep vsyscall
           0.02%             mutt  [kernel.kallsyms].vsyscall_fn  [.] vread_hpet
           0.01%            named  [kernel.kallsyms].vsyscall_fn  [.] vread_hpet
           0.01%   NetworkManager  [kernel.kallsyms].vsyscall_fn  [.] vread_hpet
           0.01%         gconfd-2  [kernel.kallsyms].vsyscall_0   [.] vgettimeofday
           0.01%  hald-addon-rfki  [kernel.kallsyms].vsyscall_fn  [.] vread_hpet
           0.00%      dbus-daemon  [kernel.kallsyms].vsyscall_fn  [.] vread_hpet
      [root@doppio linux-2.6-tip]#
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Pekka Enberg <penberg@cs.helsinki.fi>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1265223128-11786-2-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6275ce2d