1. 14 3月, 2012 4 次提交
    • I
      perf tools, x86: Build perf on older user-space as well · eae7a755
      Ingo Molnar 提交于
      On ancient systems I get this build failure:
      
        util/../../../arch/x86/include/asm/unistd.h:67:29: error: asm/unistd_64.h: No such file or directory
        In file included from util/cache.h:7,
                         from builtin-test.c:8:
        util/../perf.h: In function ‘sys_perf_event_open’:In file included from util/../perf.h:16
        perf.h:170: error: ‘__NR_perf_event_open’ undeclared (first use in this function)
      
      The reason is that this old system does not have the split
      unistd.h headers yet, from which to pick up the syscall
      definitions.
      
      Add the syscall numbers to the already existing i386 and x86_64
      blocks in perf.h, and also provide empty include file stubs.
      
      With this patch perf builds and works fine on 5 years old
      user-space as well.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Link: http://lkml.kernel.org/n/tip-jctwg64le1w47tuaoeyftsg9@git.kernel.orgSigned-off-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      eae7a755
    • A
      perf tools: Use scnprintf where applicable · e7f01d1e
      Arnaldo Carvalho de Melo 提交于
      Several places were expecting that the value returned was the number of
      characters printed, not what would be printed if there was space.
      
      Fix it by using the scnprintf and vscnprintf variants we inherited from
      the kernel sources.
      
      Some corner cases where the number of printed characters were not
      accounted were fixed too.
      Reported-by: NAnton Blanchard <anton@samba.org>
      Cc: Anton Blanchard <anton@samba.org>
      Cc: Eric B Munson <emunson@mgebm.net>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Yanmin Zhang <yanmin_zhang@linux.intel.com>
      Cc: stable@kernel.org
      Link: http://lkml.kernel.org/n/tip-kwxo2eh29cxmd8ilixi2005x@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e7f01d1e
    • A
      perf tools: Incorrect use of snprintf results in SEGV · b832796c
      Anton Blanchard 提交于
      I have a workload where perf top scribbles over the stack and we SEGV.
      What makes it interesting is that an snprintf is causing this.
      
      The workload is a c++ gem that has method names over 3000 characters
      long, but snprintf is designed to avoid overrunning buffers. So what
      went wrong?
      
      The problem is we assume snprintf returns the number of characters
      written:
      
          ret += repsep_snprintf(bf + ret, size - ret, "[%c] ", self->level);
      ...
          ret += repsep_snprintf(bf + ret, size - ret, "%s", self->ms.sym->name);
      
      Unfortunately this is not how snprintf works. snprintf returns the
      number of characters that would have been written if there was enough
      space. In the above case, if the first snprintf returns a value larger
      than size, we pass a negative size into the second snprintf and happily
      scribble over the stack. If you have 3000 character c++ methods thats a
      lot of stack to trample.
      
      This patch fixes repsep_snprintf by clamping the value at size - 1 which
      is the maximum snprintf can write before adding the NULL terminator.
      
      I get the sinking feeling that there are a lot of other uses of snprintf
      that have this same bug, we should audit them all.
      
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Eric B Munson <emunson@mgebm.net>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Yanmin Zhang <yanmin_zhang@linux.intel.com>
      Cc: stable@kernel.org
      Link: http://lkml.kernel.org/r/20120307114249.44275ca3@krytenSigned-off-by: NAnton Blanchard <anton@samba.org>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b832796c
    • S
      perf record: Fix buffer overrun bug in tracepoint_id_to_path() · 8aa8a7c8
      Stephane Eranian 提交于
      This patch fixes a buffer overrun bug in
      tracepoint_id_to_path(). The bug manisfested itself as a memory
      error reported by perf record. I ran into it with perf sched:
      
       $ perf sched rec noploop 2 noploop for 2 seconds
       [ perf record: Woken up 14 times to write data ]
       [ perf record: Captured and wrote 42.701 MB perf.data (~1865622 samples) ]
       Fatal: No memory to alloc tracepoints list
      
      It turned out that tracepoint_id_to_path() was reading the
      tracepoint id using read() but the buffer was not large enough
      to include the \n terminator for id with 4 digits or more.
      
      The patch fixes the problem by extending the buffer to a more
      reasonable size covering all possible id length include \n
      terminator. Note that atoll() stops at the first non digit
      character, thus it is not necessary to clear the buffer between
      each read.
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Acked-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: fweisbec@gmail.com
      Cc: dsahern@gmail.com
      Link: http://lkml.kernel.org/r/20120313155102.GA6465@quadSigned-off-by: NIngo Molnar <mingo@elte.hu>
      8aa8a7c8
  2. 03 3月, 2012 2 次提交
  3. 01 3月, 2012 4 次提交
  4. 07 2月, 2012 2 次提交
    • N
      perf evsel: Fix an issue where perf report fails to show the proper percentage · a4a03fc7
      Naveen N. Rao 提交于
      This patch fixes an issue where perf report shows nan% for certain
      perf.data files. The below is from a report for a do_fork probe:
      
         -nan%           sshd  [kernel.kallsyms]  [k] do_fork
         -nan%    packagekitd  [kernel.kallsyms]  [k] do_fork
         -nan%    dbus-daemon  [kernel.kallsyms]  [k] do_fork
         -nan%           bash  [kernel.kallsyms]  [k] do_fork
      
      A git bisect shows commit f3bda2c9 as the cause. However, looking back
      through the git history, I saw commit 640c03ce which seems to have
      removed the required initialization for perf_sample->period. The problem
      only started showing after commit f3bda2c9. The below patch re-introduces
      the initialization and it fixes the problem for me.
      
      With the below patch, for the same perf.data:
      
        73.08%             bash  [kernel.kallsyms]  [k] do_fork
         8.97%      11-dhclient  [kernel.kallsyms]  [k] do_fork
         6.41%             sshd  [kernel.kallsyms]  [k] do_fork
         3.85%        20-chrony  [kernel.kallsyms]  [k] do_fork
         2.56%         sendmail  [kernel.kallsyms]  [k] do_fork
      
      This patch applies over current linux-tip commit 9949284.
      
      Problem introduced in:
      
      $ git describe 640c03ce
      v2.6.37-rc3-83-g640c03ce
      
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: stable@kernel.org
      Link: http://lkml.kernel.org/r/20120203170113.5190.25558.stgit@localhost6.localdomain6Signed-off-by: NNaveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      a4a03fc7
    • J
      perf tools: Fix prefix matching for kernel maps · bf32c9eb
      Jiri Olsa 提交于
      In some perf ancient versions we used '[kernel.kallsyms._text]' as the
      name for the kernel map.
      
      This got changed with commit:
        perf: 'perf kvm' tool for monitoring guest performance from host
        commit a1645ce1
        Author: Zhang, Yanmin <yanmin_zhang@linux.intel.com>
      
      and we started to use following name '[kernel.kallsyms]_text'.
      
      This name change is important for the report code dealing with ancient
      perf data. When processing the kernel map event, we need to recognize
      the old naming (dont match the last ']') and initialize the kernel map
      correctly.
      
      The subsequent call to maps__set_kallsyms_ref_reloc_sym deals with the
      superfluous ']' to get correct symbol name.
      
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1328461865-6127-1-git-send-email-jolsa@redhat.comSigned-off-by: NJiri Olsa <jolsa@redhat.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      bf32c9eb
  5. 31 1月, 2012 2 次提交
    • S
      perf tools: Fix strlen() bug in perf_event__synthesize_event_type() · d8d9c282
      Stephane Eranian 提交于
      The event_type record has a max length for the event name.
      
      It's called MAX_EVENT_NAME.
      
      The name may be truncated to fit the max length. But the header.size still
      reflects the original name length. If that length is > MAX_EVENT_NAME, then the
      header.size field is bogus. Fix this by using the length of the name after the
      potential truncation.
      
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20120120094912.GA4882@quadSigned-off-by: NStephane Eranian <eranian@google.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d8d9c282
    • D
      perf tools: Fix broken build by defining _GNU_SOURCE in Makefile · 0a84f007
      David Daney 提交于
      When building on my Debian/mips system, util/util.c fails to build
      because commit 1aed2671 (perf kvm: Do
      guest-only counting by default) indirectly includes stdio.h before the
      feature selection in util.h is done.  This prevents _GNU_SOURCE in
      util.h from enabling the declaration of getline(), from now second
      inclusion of stdio.h, and the build is broken.
      
      There is another breakage in util/evsel.c caused by include ordering,
      but I didn't fully track down the commit that caused it.
      
      The root cause of all this is an inconsistent definition of _GNU_SOURCE,
      so I move the definition into the Makefile so that it is passed to all
      invocations of the compiler and used uniformly for all system header
      files.  All other #define and #undef of _GNU_SOURCE are removed as they
      cause conflicts with the definition passed to the compiler.
      
      All the features.h definitions (_LARGEFILE64_SOURCE _FILE_OFFSET_BITS=64
      and _GNU_SOURCE) are needed by the python glue code too, so they are
      moved to BASIC_CFLAGS, and the misleading comments about BASIC_CFLAGS
      are removed.
      
      This gives me a clean build on x86_64 (fc12) and mips (Debian).
      
      Cc: David Daney <david.daney@cavium.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Joerg Roedel <joerg.roedel@amd.com>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1326836461-11952-1-git-send-email-ddaney.cavm@gmail.comSigned-off-by: NDavid Daney <david.daney@cavium.com>
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0a84f007
  6. 08 1月, 2012 2 次提交
  7. 07 1月, 2012 4 次提交
  8. 04 1月, 2012 1 次提交
  9. 30 12月, 2011 1 次提交
  10. 24 12月, 2011 12 次提交
  11. 21 12月, 2011 1 次提交
  12. 20 12月, 2011 5 次提交