1. 24 10月, 2013 1 次提交
    • J
      perf script python: Fix mem leak due to missing Py_DECREFs on dict entries · c0268e8d
      Joseph Schuchart 提交于
      We are using the Python scripting interface in perf to extract kernel
      events relevant for performance analysis of HPC codes. We noticed that
      the "perf script" call allocates a significant amount of memory (in the
      order of several 100 MiB) during it's run, e.g. 125 MiB for a 25 MiB
      input file:
      
        $> perf record -o perf.data -a -R -g fp \
             -e power:cpu_frequency -e sched:sched_switch \
             -e sched:sched_migrate_task -e sched:sched_process_exit \
             -e sched:sched_process_fork -e sched:sched_process_exec \
             -e cycles  -m 4096 --freq 4000
        $> /usr/bin/time perf script -i perf.data -s dummy_script.py
        0.84user 0.13system 0:01.92elapsed 51%CPU (0avgtext+0avgdata
        125532maxresident)k
        73072inputs+0outputs (57major+33086minor)pagefaults 0swaps
      
      Upon further investigation using the valgrind massif tool, we noticed
      that Python objects that are created in trace-event-python.c via
      PyString_FromString*() (and their Integer and Long counterparts) are
      never free'd.
      
      The reason for this seem to be missing Py_DECREF calls on the objects
      that are returned by these functions and stored in the Python
      dictionaries. The Python dictionaries do not steal references (as
      opposed to Python tuples and lists) but instead add their own reference.
      
      Hence, the reference that is returned by these object creation functions
      is never released and the memory is leaked. (see [1,2])
      
      The attached patch fixes this by wrapping all relevant calls to
      PyDict_SetItemString() and decrementing the reference counter
      immediately after the Python function call.
      
      This reduces the allocated memory to a reasonable amount:
      
        $> /usr/bin/time perf script -i perf.data -s dummy_script.py
        0.73user 0.05system 0:00.79elapsed 99%CPU (0avgtext+0avgdata
        49132maxresident)k
        0inputs+0outputs (0major+14045minor)pagefaults 0swaps
      
      For comparison, with a 120 MiB input file the memory consumption
      reported by time drops from almost 600 MiB to 146 MiB.
      
      The patch has been tested using Linux 3.8.2 with Python 2.7.4 and Linux
      3.11.6 with Python 2.7.5.
      
      Please let me know if you need any further information.
      
      [1] http://docs.python.org/2/c-api/tuple.html#PyTuple_SetItem
      [2] http://docs.python.org/2/c-api/dict.html#PyDict_SetItemStringSigned-off-by: NJoseph Schuchart <joseph.schuchart@tu-dresden.de>
      Reviewed-by: NTom Zanussi <tom.zanussi@linux.intel.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Tom Zanussi <tom.zanussi@linux.intel.com>
      Link: http://lkml.kernel.org/r/1381468543-25334-4-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      c0268e8d
  2. 18 10月, 2013 2 次提交
    • S
      perf: Disable PERF_RECORD_MMAP2 support · 3090ffb5
      Stephane Eranian 提交于
      For now, we disable the extended MMAP record support (MMAP2).
      
      We have identified cases where it would not report the correct mapping
      information, clone(VM_CLONE) but with separate pids.  We will revisit
      the support once we find a solution for this case.
      
      The patch changes the kernel to return EINVAL if attr->mmap2 is set. The
      patch also modifies the perf tool to use regular PERF_RECORD_MMAP for
      synthetic events and it also prevents the tool from requesting
      attr->mmap2 mode because the kernel would reject it.
      
      The support will be revisited once the kenrel interface is updated.
      
      In V2, we reduce the patch to the strict minimum.
      
      In V3, we avoid calling perf_event_open() with mmap2 set because we know
      it will fail and require fallback retry.
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/20131017173215.GA8820@quadSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3090ffb5
    • A
      perf scripting perl: Fix build error on Fedora 12 · 3b16ff89
      Arnaldo Carvalho de Melo 提交于
      Cast __u64 to u64 to silence this warning on older distros, such as
      Fedora 12:
      
          CC       /tmp/build/perf/util/scripting-engines/trace-event-perl.o
        cc1: warnings being treated as errors
        util/scripting-engines/trace-event-perl.c: In function ‘perl_process_tracepoint’:
        util/scripting-engines/trace-event-perl.c:285: error: format ‘%lu’ expects type ‘long unsigned int’, but argument 2 has type ‘__u64’
        make[1]: *** [/tmp/build/perf/util/scripting-engines/trace-event-perl.o] Error 1
        make: *** [install] Error 2
        make: Leaving directory `/home/acme/git/linux/tools/perf'
        [acme@fedora12 linux]$
      Reported-by: NWaiman Long <Waiman.Long@hp.com>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.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: Tom Zanussi <tom.zanussi@linux.intel.com>
      Cc: Waiman Long <Waiman.Long@hp.com>
      Link: http://lkml.kernel.org/n/tip-nlxofdqcdjfm0w9o6bgq4kqv@git.kernel.org
      Link: http://lkml.kernel.org/r/1381265120-58532-1-git-send-email-Waiman.Long@hp.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      3b16ff89
  3. 17 10月, 2013 1 次提交
  4. 16 10月, 2013 1 次提交
  5. 05 10月, 2013 6 次提交
    • N
      perf session: Fix infinite loop on invalid perf.data file · b314e5cf
      Namhyung Kim 提交于
      perf-record updates the header in the perf.data file at termination.
      Without this update perf-report (and other processing built-ins) it
      caused an infinite loop when perf report (or something like) called.
      
      This is because the algorithm in __perf_session__process_events()
      depends on the data_size which is read from file header.  Use file size
      directly instead in this case to do the best-effort processing.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Tested-by: NDavid Ahern <dsahern@gmail.com>
      Tested-by: NSonny Rao <sonnyrao@chromium.org>
      Acked-by: NIngo Molnar <mingo@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Sonny Rao <sonnyrao@chromium.org>
      Link: http://lkml.kernel.org/r/1380529188-27193-1-git-send-email-namhyung@kernel.orgSigned-off-by: NDavid Ahern <dsahern@gmail.com>
      [ Reworded warning as per Ingo Molnar suggestion, replaces 'perf.data'
        with session->filename, to precisely identify the data file involved ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      b314e5cf
    • A
      perf tools: Fix installation of libexec components · 027a7e86
      Arnaldo Carvalho de Melo 提交于
      Doing a fresh install on a user home directory needs to first make sure
      that the ~/libexec/perf-core/ directory is present so that
      'perf-archive' like scripts, 'perf test' attr config files and 'perf
      script' scripts can be installed.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.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>
      Link: http://lkml.kernel.org/n/tip-z7ryi3r1b9dn9smbfnab0fdc@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      027a7e86
    • M
      perf probe: Fix to find line information for probe list · e08cfd4b
      Masami Hiramatsu 提交于
      Fix to find the correct (as much as possible) line information for
      listing probes. Without this fix, perf probe --list action will show
      incorrect line information as below;
      
        probe:getname_flags  (on getname_flags@ksrc/linux-3/fs/namei.c)
        probe:getname_flags_1 (on getname:-89@x86/include/asm/current.h)
        probe:getname_flags_2 (on user_path_at_empty:-2054@x86/include/asm/current.h)
      
      The minus line number is obviously wrong, and current.h is not related
      to the probe point. Deeper investigation discovered that there were 2
      issues related to this bug, and minor typos too.
      
      The 1st issue is the rack of considering about nested inlined functions,
      which causes the wrong (relative) line number.
      
      The 2nd issue is that the dwarf line info is not correct at those
      points. It points 14th line of current.h.
      
      Since it seems that the line info includes somewhat unreliable
      information, this fixes perf to try to find correct line information
      from both of debuginfo and line info as below.
      
      1) Probe address is the entry of a function instance
      
        In this case, the line is set as the function declared line.
      
      2) Probe address is the entry of an expanded inline function block
      
        In this case, the line is set as the function call-site line.
        This means that the line number is relative from the entry line
        of caller function (which can be an inlined function if nested)
      
      3) Probe address is inside a function instance or an expanded
         inline function block
      
        In this case, perf probe queries the line number from lineinfo
        and verify the function declared file is same as the file name
        queried from lineinfo.
      
        If the file name is different, it is a failure case. The probe
        address is shown as symbol+offset.
      
      4) Probe address is not in the any function instance
      
        This is a failure case, the probe address is shown as
        symbol+offset.
      
      With this fix, perf probe -l shows correct probe lines as below;
      
        probe:getname_flags  (on getname_flags@ksrc/linux-3/fs/namei.c)
        probe:getname_flags_1 (on getname:2@ksrc/linux-3/fs/namei.c)
        probe:getname_flags_2 (on user_path_at_empty:4@ksrc/linux-3/fs/namei.c)
      
      Changes at v2:
       - Fix typos in the function comments. (Thanks to Namhyung Kim)
       - Use die_find_top_inlinefunc instead of die_find_inlinefunc_next.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/20130930092144.1693.11058.stgit@udc4-manage.rcp.hitachi.co.jpSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e08cfd4b
    • A
      perf tools: Fix libaudit test · 47a92b82
      Arnaldo Carvalho de Melo 提交于
      In ubuntu systems the libaudit test was always failing due to the
      newline in the printf call not being escaped, which somehow didn't
      prevented the test from working as expected on other systems, such
      as fedora18.
      
      Fix it by removing the newline, as this is just a test, that program is
      just a compile test.
      
      The error messages, obtained using 'make V=1':
      
          CHK libaudit
      <stdin>: In function ‘main’:
      <stdin>:5:9: error: missing terminating " character [-Werror]
      <stdin>:5:2: error: missing terminating " character
      <stdin>:6:1: error: missing terminating " character [-Werror]
      <stdin>:6:1: error: missing terminating " character
      <stdin>:7:2: error: expected expression before ‘return’
      <stdin>:8:1: error: expected ‘;’ before ‘}’ token
      cc1: all warnings being treated as errors
      config/Makefile:241: No libaudit.h found, disables 'trace' tool, please install audit-libs-devel or libaudit-dev
      
      After this change the test works as expected in all systems tested and the
      'trace' tool is built when the needed devel packages are installed.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.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>
      Link: http://lkml.kernel.org/n/tip-0trw8qs9hafeopc0vj1sicay@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      47a92b82
    • N
      perf stat: Set child_pid after perf_evlist__prepare_workload() · d20a47e7
      Namhyung Kim 提交于
      The commit acf28922 ("perf stat: Use perf_evlist__prepare/
      start_workload()") converted to use the function but forgot to update
      child_pid.  Fix it.
      Signed-off-by: NNamhyung Kim <namhyung@kernel.org>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1380531671-28076-1-git-send-email-namhyung@kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      d20a47e7
    • D
      perf tools: Add default handler for mmap2 events · 6adb0b0a
      David Ahern 提交于
      Commands that do not implement an mmap2 handler should at least not die
      with a segfault when processing files with MMAP2 events.
      Signed-off-by: NDavid Ahern <dsahern@gmail.com>
      Link: http://lkml.kernel.org/r/1379900700-5186-5-git-send-email-dsahern@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      6adb0b0a
  6. 29 9月, 2013 1 次提交
    • I
      Revert "perf symbols: Demangle cloned functions" · 14951f22
      Ingo Molnar 提交于
      This reverts commit de95ab53.
      
      Markus Trippelsdorf reported that this commit broke 'perf top':
      
       > I just see a gray screen with no text at all. Sometimes the
       > following error messages are printed:
       >
       >  *** Error in `perf': invalid fastbin entry (free): 0x00000000029b18c0
       >  ***
       >  *** Error in `perf': malloc(): memory corruption (fast): 0x0000000000ee0b10 ***
      
      While this code is fixable, the commit itself fails on several levels:
      
       - it should have been a separate helper function
       - why the heck does it do strchr() twice
       - it casts a const char * over into char *
       - sloppy style
       - it's not even a regression fix!
      
      So lets revert it and re-try the patch in v3.13.
      Reported-by: NMarkus Trippelsdorf <markus@trippelsdorf.de>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      14951f22
  7. 25 9月, 2013 6 次提交
  8. 20 9月, 2013 3 次提交
    • P
      perf: Fix capabilities bitfield compatibility in 'struct perf_event_mmap_page' · fa731587
      Peter Zijlstra 提交于
      Solve the problems around the broken definition of perf_event_mmap_page::
      cap_usr_time and cap_usr_rdpmc fields which used to overlap, partially
      fixed by:
      
        860f085b ("perf: Fix broken union in 'struct perf_event_mmap_page'")
      
      The problem with the fix (merged in v3.12-rc1 and not yet released
      officially), noticed by Vince Weaver is that the new behavior is
      not detectable by new user-space, and that due to the reuse of the
      field names it's easy to mis-compile a binary if old headers are used
      on a new kernel or new headers are used on an old kernel.
      
      To solve all that make this change explicit, detectable and self-contained,
      by iterating the ABI the following way:
      
       - Always clear bit 0, and rename it to usrpage->cap_bit0, to at least not
         confuse old user-space binaries. RDPMC will be marked as unavailable
         to old binaries but that's within the ABI, this is a capability bit.
      
       - Rename bit 1 to ->cap_bit0_is_deprecated and always set it to 1, so new
         libraries can reliably detect that bit 0 is deprecated and perma-zero
         without having to check the kernel version.
      
       - Use bits 2, 3, 4 for the newly defined, correct functionality:
      
      	cap_user_rdpmc		: 1, /* The RDPMC instruction can be used to read counts */
      	cap_user_time		: 1, /* The time_* fields are used */
      	cap_user_time_zero	: 1, /* The time_zero field is used */
      
       - Rename all the bitfield names in perf_event.h to be different from the
         old names, to make sure it's not possible to mis-compile it
         accidentally with old assumptions.
      
      The 'size' field can then be used in the future to add new fields and it
      will act as a natural ABI version indicator as well.
      
      Also adjust tools/perf/ userspace for the new definitions, noticed by
      Adrian Hunter.
      Reported-by: NVince Weaver <vincent.weaver@maine.edu>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Also-Fixed-by: NAdrian Hunter <adrian.hunter@intel.com>
      Link: http://lkml.kernel.org/n/tip-zr03yxjrpXesOzzupszqglbv@git.kernel.orgSigned-off-by: NIngo Molnar <mingo@kernel.org>
      fa731587
    • V
      tools lib lk: Uninclude linux/magic.h in debugfs.c · ce7eebe5
      Vinson Lee 提交于
      The compilation only looks for linux/magic.h from the default include
      paths, which does not include the source tree. This results in a build
      error if linux/magic.h is not available or not installed.
      
      For example, this build error occurs on CentOS 5.
      
      $ make -C tools/lib/lk V=1
      [...]
      gcc -o debugfs.o -c -ggdb3 -Wall -Wextra -std=gnu99 -Werror -O6
      -D_FORTIFY_SOURCE=2 -Wbad-function-cast -Wdeclaration-after-statement
      -Wformat-security -Wformat-y2k -Winit-self -Wmissing-declarations
      -Wmissing-prototypes -Wnested-externs -Wno-system-headers
      -Wold-style-definition -Wpacked -Wredundant-decls -Wshadow
      -Wstrict-aliasing=3 -Wstrict-prototypes -Wswitch-default -Wswitch-enum
      -Wundef -Wwrite-strings -Wformat  -fPIC  -D_LARGEFILE64_SOURCE
      -D_FILE_OFFSET_BITS=64 debugfs.c
      debugfs.c:8:25: error: linux/magic.h: No such file or directory
      
      The only symbol from linux/magic.h needed by debugfs.c is DEBUGFS_MAGIC,
      and that is already defined in debugfs.h. linux/magic.h isn't providing
      any extra symbols and can unincluded. This is similar to the approach by
      perf, which has its own magic.h wrapper at
      tools/perf/util/include/linux/magic.h
      Signed-off-by: NVinson Lee <vlee@twitter.com>
      Acked-by: NBorislav Petkov <bp@suse.de>
      Cc: Borislav Petkov <bp@suse.de>
      Cc: Vinson Lee <vlee@freedesktop.org>
      Cc: stable@vger.kernel.org
      Link: http://lkml.kernel.org/r/1379546200-17028-1-git-send-email-vlee@freedesktop.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      ce7eebe5
    • I
      perf tools: Fix old GCC build error in trace-event-parse.c:parse_proc_kallsyms() · 0f965429
      Ingo Molnar 提交于
      Old GCC (4.1) does not see through the code flow of parse_proc_kallsyms()
      and gets confused about the status of 'fmt':
      
       util/trace-event-parse.c: In function ‘parse_proc_kallsyms’:
       util/trace-event-parse.c:189: warning: ‘fmt’ may be used uninitialized in this function
       make: *** [util/trace-event-parse.o] Error 1
      
      Help out GCC by initializing 'fmt' to NULL.
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20130912131649.GC23826@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0f965429
  9. 19 9月, 2013 7 次提交
    • M
      perf probe: Fix finder to find lines of given function · 0dbb1cac
      Masami Hiramatsu 提交于
      The commit ba28c59b fixed a declaration
      entry bug in probe_point_search_cb().  There are same bugs in line
      finder and call_probe_finder().  This introduces a new dwarf utility
      function to determine given DIE is a function definition, not
      declaration.
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Prashanth Nageshappa <prashanth@linux.vnet.ibm.com>
      Cc: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: yrl.pp-manager.tt@hitachi.com
      Link: http://lkml.kernel.org/r/20120423032435.8737.80064.stgit@localhost.localdomainSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      0dbb1cac
    • A
      perf session: Check for SIGINT in more loops · 33e940a2
      Arnaldo Carvalho de Melo 提交于
      When processing big files we were not checking if session_done was set
      by the SIGINT signal handler, for instance in 'perf report'. Fix it.
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.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>
      Link: http://lkml.kernel.org/n/tip-pyad42lgrtq7xhg2dpsoauq7@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      33e940a2
    • A
      perf tools: Fix compile with libelf without get_phdrnum · e955d5c4
      Adrian Hunter 提交于
      Add a feature check for get_phdrnum() and implement a replacement if it
      is not present.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1379080170-6608-1-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      e955d5c4
    • A
      perf tools: Fix buildid cache handling of kallsyms with kcore · 5b6a42fc
      Adrian Hunter 提交于
      When kallsyms is used with kcore the dso long_name becomes the kcore
      file name.  That prevents the buildid cache from caching kallsyms.
      (There is no support at present for caching kcore).  Fix by changing it
      so that the kallsyms name is used in that case instead.
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1379009959-28046-1-git-send-email-adrian.hunter@intel.com
      [ Kept 'struct foo' pointer as first parameter of foo__ prefixed functions ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5b6a42fc
    • A
      perf annotate: Fix objdump line parsing offset validation · 886b37ba
      Adrian Hunter 提交于
      When parsing lines from objdump a line containing source code starting
      with a numeric label is mistaken for a line of disassembly starting with
      a memory address.
      
      Current validation fails to recognise that the "memory address" is out
      of range and calculates an invalid offset which later causes this
      segfault:
      
      Program received signal SIGSEGV, Segmentation fault.
      0x0000000000457315 in disasm__calc_percent (notes=0xc98970, evidx=0, offset=143705, end=2127526177, path=0x7fffffffbf50)
          at util/annotate.c:631
      631				hits += h->addr[offset++];
      (gdb) bt
       #0  0x0000000000457315 in disasm__calc_percent (notes=0xc98970, evidx=0, offset=143705, end=2127526177, path=0x7fffffffbf50)
          at util/annotate.c:631
       #1  0x00000000004d65e3 in annotate_browser__calc_percent (browser=0x7fffffffd130, evsel=0xa01da0) at ui/browsers/annotate.c:364
       #2  0x00000000004d7433 in annotate_browser__run (browser=0x7fffffffd130, evsel=0xa01da0, hbt=0x0) at ui/browsers/annotate.c:672
       #3  0x00000000004d80c9 in symbol__tui_annotate (sym=0xc989a0, map=0xa02660, evsel=0xa01da0, hbt=0x0) at ui/browsers/annotate.c:962
       #4  0x00000000004d7aa0 in hist_entry__tui_annotate (he=0xdf73f0, evsel=0xa01da0, hbt=0x0) at ui/browsers/annotate.c:823
       #5  0x00000000004dd648 in perf_evsel__hists_browse (evsel=0xa01da0, nr_events=1, helpline=
          0x58b768 "For a higher level overview, try: perf report --sort comm,dso", ev_name=0xa02cd0 "cycles", left_exits=false, hbt=
          0x0, min_pcnt=0, env=0xa011e0) at ui/browsers/hists.c:1659
       #6  0x00000000004de372 in perf_evlist__tui_browse_hists (evlist=0xa01520, help=
          0x58b768 "For a higher level overview, try: perf report --sort comm,dso", hbt=0x0, min_pcnt=0, env=0xa011e0)
          at ui/browsers/hists.c:1950
       #7  0x000000000042cf6b in __cmd_report (rep=0x7fffffffd6c0) at builtin-report.c:581
       #8  0x000000000042e25d in cmd_report (argc=0, argv=0x7fffffffe4b0, prefix=0x0) at builtin-report.c:965
       #9  0x000000000041a0e1 in run_builtin (p=0x801548, argc=1, argv=0x7fffffffe4b0) at perf.c:319
       #10 0x000000000041a319 in handle_internal_command (argc=1, argv=0x7fffffffe4b0) at perf.c:376
       #11 0x000000000041a465 in run_argv (argcp=0x7fffffffe38c, argv=0x7fffffffe380) at perf.c:420
       #12 0x000000000041a707 in main (argc=1, argv=0x7fffffffe4b0) at perf.c:521
      
      After the fix is applied the symbol can be annotated showing the
      problematic line "1:      rep"
      
      copy_user_generic_string  /usr/lib/debug/lib/modules/3.9.10-100.fc17.x86_64/vmlinux
                   */
                  ENTRY(copy_user_generic_string)
                          CFI_STARTPROC
                          ASM_STAC
                          andl %edx,%edx
                    and    %edx,%edx
                          jz 4f
                    je     37
                          cmpl $8,%edx
                    cmp    $0x8,%edx
                          jb 2f           /* less than 8 bytes, go to byte copy loop */
                    jb     33
                          ALIGN_DESTINATION
                    mov    %edi,%ecx
                    and    $0x7,%ecx
                    je     28
                    sub    $0x8,%ecx
                    neg    %ecx
                    sub    %ecx,%edx
              1a:   mov    (%rsi),%al
                    mov    %al,(%rdi)
                    inc    %rsi
                    inc    %rdi
                    dec    %ecx
                    jne    1a
                          movl %edx,%ecx
              28:   mov    %edx,%ecx
                          shrl $3,%ecx
                    shr    $0x3,%ecx
                          andl $7,%edx
                    and    $0x7,%edx
                  1:      rep
      100.00        rep    movsq %ds:(%rsi),%es:(%rdi)
                          movsq
                  2:      movl %edx,%ecx
              33:   mov    %edx,%ecx
                  3:      rep
                    rep    movsb %ds:(%rsi),%es:(%rdi)
                          movsb
                  4:      xorl %eax,%eax
              37:   xor    %eax,%eax
                    data32 xchg %ax,%ax
                          ASM_CLAC
                          ret
                    retq
      Signed-off-by: NAdrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1379009721-27667-1-git-send-email-adrian.hunter@intel.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      886b37ba
    • I
      perf tools: Fill in new definitions for madvise()/mmap() flags · 456857bd
      Ingo Molnar 提交于
      builtin-trace.c started using various new syscall features not defined
      in the header files of older distros - resulting in build failures.
      
      Fill in the (ABI) constants if they are not defined.
      
      (There might be a better place to put this than builtin-trace.c, into a
      compat header or so.)
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.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: Thomas Gleixner <tglx@linutronix.de>
      Cc: linux-tip-commits@vger.kernel.org
      Link: http://lkml.kernel.org/r/20130912132900.GE23826@gmail.comSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      456857bd
    • I
      perf tools: Sharpen the libaudit dependencies test · 33cbbdcc
      Ingo Molnar 提交于
      There are older libaudit versions that don't have an
      audit_errno_to_name() method, resulting in a builtin-trace.c build
      error:
      
        builtin-trace.c: In function ‘trace__sys_exit’:
        builtin-trace.c:794: warning: implicit declaration of function ‘audit_errno_to_name’
      
      Expand the libaudit test to detect this.
      Signed-off-by: NIngo Molnar <mingo@kernel.org>
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: H. Peter Anvin <hpa@zytor.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: Thomas Gleixner <tglx@linutronix.de>
      Link: http://lkml.kernel.org/r/20130912132706.GD23826@gmail.com
      [ Fix the test by escaping the double quotes ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      33cbbdcc
  10. 11 9月, 2013 1 次提交
    • S
      perf tools: Add attr->mmap2 support · 5c5e854b
      Stephane Eranian 提交于
      This patch adds support for the new PERF_RECORD_MMAP2 record type
      exposed by the kernel. This is an extended PERF_RECORD_MMAP record.
      
      It adds for each file-backed mapping the device major, minor number and
      the inode number and generation.
      
      This triplet uniquely identifies the source of a file-backed mapping. It
      can be used to detect identical virtual mappings between processes, for
      instance.
      
      The patch will prefer MMAP2 over MMAP.
      Signed-off-by: NStephane Eranian <eranian@google.com>
      Cc: Andi Kleen <ak@linux.intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung.kim@lge.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1377079825-19057-3-git-send-email-eranian@google.com
      [ Cope with 314add6b "Change machine__findnew_thread() to set thread pid",
        fix 'perf test' regression test entry affected,
        use perf_missing_features.mmap2 to fallback to not using .mmap2 in older kernels,
        so that new tools can work with kernels where this feature is not present ]
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      5c5e854b
  11. 10 9月, 2013 3 次提交
  12. 06 9月, 2013 6 次提交
  13. 03 9月, 2013 2 次提交
    • A
      perf trace: Tell arg formatters the arg index · 31cd3855
      Arnaldo Carvalho de Melo 提交于
      ... so that it can mask args relative to its position, like the 'mode' arg
      that may or not be printed according to the 'flags' (O_CREAT) value.
      
       [root@zoo ~]# perf trace -a -e openat,open_by_handle_at | head -1
          469.754 ( 0.034 ms): 1183 openat(dfd: -100, filename: 0x7fbde40014b0, flags: CLOEXEC|DIRECTORY|NONBLOCK) = 23
       [root@zoo ~]#
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.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>
      Link: http://lkml.kernel.org/n/tip-bgokqpkufd4sio7ixxknf1ux@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      31cd3855
    • A
      perf trace: Add beautifier for open's flags arg · be65a89a
      Arnaldo Carvalho de Melo 提交于
      Suppressing the mode when O_CREAT not present, needs improvements on the
      arg masking mechanism to be reused in openat, open_by_handle_at,
      mq_open:
      
      [root@zoo ~]# perf trace -a -e open | grep -v 'flags: RDONLY' | head -5
         147.541 ( 0.028 ms): 1188 open(filename: 0x33c17782fb, flags: CLOEXEC   ) = 23
         229.898 ( 0.020 ms): 2071 open(filename: 0x3d93c80, flags: NOATIME      ) = -1 EPERM Operation not permitted
      
      [root@zoo ~]# perf trace -a -e open | grep CREAT
        1406.697 ( 0.024 ms): 616 open(filename: 0x7fffc3a0f910, flags: CREAT|TRUNC|WRONLY, mode: 438 ) = -1 ENOENT No such file or directory
        2032.770 ( 0.804 ms): 4354 open(filename: 0x7f33ac814368, flags: CREAT|EXCL|RDWR, mode: 384   ) = 115
      ^C[root@zoo ~]#
      
      Cc: Adrian Hunter <adrian.hunter@intel.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.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>
      Link: http://lkml.kernel.org/n/tip-c7vm6klaf995qw1vqdih5t7q@git.kernel.orgSigned-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      be65a89a