1. 01 Aug, 2012 5 commits
  2. 30 Jul, 2012 14 commits
  3. 26 Jul, 2012 7 commits
  4. 25 Jul, 2012 14 commits
    • Ingo Molnar's avatar
      Merge tag 'perf-core-for-mingo' of... · 045e7e60
      Ingo Molnar authored
      Merge tag 'perf-core-for-mingo' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux into perf/core
      
      Pull perf/core fixes and improvements from Arnaldo Carvalho de Melo:
      
       * libtraceevent build fixes from Namhyung Kim
      
       * Prevent overflow when calculating annotation buckets size, from Cody Schafer
      
       * Set breakpoint events sample period to 1, just like trace events, from Jovi Zhang
      
       * Fix strerror_r usage, from Kirill Shutemov
      
       * Fix duplicate function declaration problems with bison 2.6, from Kirill Shutemov
      
       * Add DSO caching facility (and perf test entry) to speed up binary file
         reading, will be used by the DWARF unwind code, from Jiri Olsa
      
       * Fix trace event storms by setting PERF_SAMPLE_PERIOD, from Frederic Weisbecker
      
       * perf kvm fixes from David Ahern
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@kernel.org>
      045e7e60
    • Cody Schafer's avatar
      perf annotate: Prevent overflow in size calculation · 8696329b
      Cody Schafer authored
      A large enough symbol size causes an overflow in the size parameter to
      the histogram allocation, leading to a segfault in
      symbol__inc_addr_samples later on when this histogram is accessed.
      
      In the case of being called via perf-report, this returns back and
      gracefully ignores the sample, eventually ignoring the chained return
      value of perf_session_deliver_event in flush_sample_queue.
      Signed-off-by: default avatarCody Schafer <cody@linux.vnet.ibm.com>
      Acked-by: default avatarNamhyung Kim <namhyung@kernel.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>
      Link: http://lkml.kernel.org/r/1342753525-4521-1-git-send-email-cody@linux.vnet.ibm.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8696329b
    • Namhyung Kim's avatar
      tools lib traceevent: Ignore TRACEEVENT-CFLAGS file · 52f18a2f
      Namhyung Kim authored
      The TRACEEVENT-CFLAGS file is used to detect any change on compiler
      flags. Just ignore it.
      Signed-off-by: default avatarNamhyung 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>
      Link: http://lkml.kernel.org/r/1341559297-25725-3-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      52f18a2f
    • Namhyung Kim's avatar
      tools lib traceevent: Detect build environment changes · 52b5c0d4
      Namhyung Kim authored
      Cross compiling perf requires setting ARCH and CROSS_COMPILE variables,
      but libtraceevent couldn't detect the changes so it ends up believing no
      recompiling is required. Thus the linker failed like:
      
           LINK perf
       ../lib/traceevent//libtraceevent.a: member ../lib/traceevent//libtraceevent.a(event-parse.o) in archive is not an object
       collect2: ld returned 1 exit status
       make: *** [perf] Error 1
      
      This patch fixes this by adding TRACEEVENT-CFLAGS file like
      PERF-CFLAGS to track those changes.
      Signed-off-by: default avatarNamhyung 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>
      Link: http://lkml.kernel.org/r/1341559297-25725-2-git-send-email-namhyung@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      52b5c0d4
    • Kirill A. Shutemov's avatar
      perf tools: Fix build error with bison 2.6 · 043d1a5c
      Kirill A. Shutemov authored
      Bison 2.6 started to generate parse_events_parse() declaration in header. In
      this case we have redundant redeclaration:
      
      util/parse-events.c:29:5: error: redundant redeclaration of ‘parse_events_parse’ [-Werror=redundant-decls]
      In file included from util/parse-events.c:14:0:
      util/parse-events-bison.h:99:5: note: previous declaration of ‘parse_events_parse’ was here
      cc1: all warnings being treated as errors
      
      Let's disable -Wredundant-decls for util/parse-events.c since it includes
      header we can't control.
      Signed-off-by: default avatarKirill A. Shutemov <kirill@shutemov.name>
      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/20120723210407.GA25186@shutemov.nameSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      043d1a5c
    • Kirill A. Shutemov's avatar
      perf tools: use XSI-complaint version of strerror_r() instead of GNU-specific · 4cc49d4d
      Kirill A. Shutemov authored
      Perf uses GNU-specific version of strerror_r(). The GNU-specific strerror_r()
      returns a pointer to a string containing the error message.  This may be either
      a pointer to a string that the function stores in buf, or a pointer to some
      (immutable) static string (in which case buf is unused).
      
      In glibc-2.16 GNU version was marked with attribute warn_unused_result.  It
      triggers few warnings in perf:
      
      util/target.c: In function ‘perf_target__strerror’:
      util/target.c:114:13: error: ignoring return value of ‘strerror_r’, declared with attribute warn_unused_result [-Werror=unused-result]
      ui/browsers/hists.c: In function ‘hist_browser__dump’:
      ui/browsers/hists.c:981:13: error: ignoring return value of ‘strerror_r’, declared with attribute warn_unused_result [-Werror=unused-result]
      
      They are bugs.
      
      Let's fix strerror_r() usage.
      Signed-off-by: default avatarKirill A. Shutemov <kirill@shutemov.name>
      Acked-by: default avatarUlrich Drepper <drepper@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Ulrich Drepper <drepper@gmail.com>
      Link: http://lkml.kernel.org/r/20120723210654.GA25248@shutemov.name
      [ committer note: s/assert/BUG_ON/g ]
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4cc49d4d
    • Jovi Zhang's avatar
      perf tools: Make the breakpoint events sample period default to 1 · 4a841d65
      Jovi Zhang authored
      There have one problem about hw_breakpoint perf event, as watched, the
      events reported to userspace is not correctly, sometime one trigger
      bp_event report several events, sometime bp_event cannot go through to
      user.
      
      The root cause is attr->freq is 1 passed to kernel defaultly in bp
      events, this make kernel calculate event period not as expect, make
      sample period to 1 will change attr->freq to 0, to fix this problem.
      
      This patch is similar with commit f92128 about tracepoint events:
          perf: Make the trace events sample period default to 1
      Signed-off-by: default avatarJovi Zhang <bookjovi@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/CACV3sbLF8taiCq_VYW-sgRJyupeMzg58C7ZXfMe3xZUiH_Mx6w@mail.gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4a841d65
    • Jiri Olsa's avatar
      perf test: Add dso data caching tests · f7add556
      Jiri Olsa authored
      Adding automated test for DSO data reading. Testing raw/cached reads
      from different file/cache locations.
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Arun Sharma <asharma@fb.com>
      Cc: Benjamin Redelings <benjamin.redelings@nescent.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Cyrill Gorcunov <gorcunov@openvz.org>
      Cc: Frank Ch. Eigler <fche@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Ulrich Drepper <drepper@gmail.com>
      Link: http://lkml.kernel.org/r/1342959280-5361-18-git-send-email-jolsa@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      f7add556
    • Jiri Olsa's avatar
      perf symbols: Add dso data caching · 4dff624a
      Jiri Olsa authored
      Adding dso data caching so we don't need to open/read/close, each time
      we want dso data.
      
      The DSO data caching affects following functions:
        dso__data_read_offset
        dso__data_read_addr
      
      Each DSO read tries to find the data (based on offset) inside the cache.
      If it's not present it fills the cache from file, and returns the data.
      If it is present, data are returned with no file read.
      
      Each data read is cached by reading cache page sized/aligned amount of
      DSO data. The cache page size is hardcoded to 4096.  The cache is using
      RB tree with file offset as a sort key.
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Arun Sharma <asharma@fb.com>
      Cc: Benjamin Redelings <benjamin.redelings@nescent.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Cyrill Gorcunov <gorcunov@openvz.org>
      Cc: Frank Ch. Eigler <fche@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Ulrich Drepper <drepper@gmail.com>
      Link: http://lkml.kernel.org/r/1342959280-5361-17-git-send-email-jolsa@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      4dff624a
    • Jiri Olsa's avatar
      perf symbols: Add interface to read DSO image data · 949d160b
      Jiri Olsa authored
      Adding following interface for DSO object to allow
      reading of DSO image data:
      
        dso__data_fd
          - opens DSO and returns file descriptor
            Binary types are used to locate/open DSO in following order:
              DSO_BINARY_TYPE__BUILD_ID_CACHE
              DSO_BINARY_TYPE__SYSTEM_PATH_DSO
            In other word we first try to open DSO build-id path,
            and if that fails we try to open DSO system path.
      
        dso__data_read_offset
          - reads DSO data from specified offset
      
        dso__data_read_addr
          - reads DSO data from specified address/map.
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Arun Sharma <asharma@fb.com>
      Cc: Benjamin Redelings <benjamin.redelings@nescent.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Cyrill Gorcunov <gorcunov@openvz.org>
      Cc: Frank Ch. Eigler <fche@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Ulrich Drepper <drepper@gmail.com>
      Link: http://lkml.kernel.org/r/1342959280-5361-11-git-send-email-jolsa@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      949d160b
    • Jiri Olsa's avatar
      perf symbols: Factor DSO symtab types to generic binary types · 44f24cb3
      Jiri Olsa authored
      Adding interface to access DSOs so it could be used
      from another place.
      
      New DSO binary type is added - making current SYMTAB__*
      types more general:
         DSO_BINARY_TYPE__* = SYMTAB__*
      
      Following function is added to return path based on the specified
      binary type:
         dso__binary_type_file
      Signed-off-by: default avatarJiri Olsa <jolsa@redhat.com>
      Cc: Arun Sharma <asharma@fb.com>
      Cc: Benjamin Redelings <benjamin.redelings@nescent.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Cyrill Gorcunov <gorcunov@openvz.org>
      Cc: Frank Ch. Eigler <fche@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Robert Richter <robert.richter@amd.com>
      Cc: Stephane Eranian <eranian@google.com>
      Cc: Tom Zanussi <tzanussi@gmail.com>
      Cc: Ulrich Drepper <drepper@gmail.com>
      Link: http://lkml.kernel.org/r/1342959280-5361-10-git-send-email-jolsa@redhat.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      44f24cb3
    • Frederic Weisbecker's avatar
      perf hists: Print newline between hists callchains · 6654f5d8
      Frederic Weisbecker authored
      Tiny cosmetic fix. The lack of a newline between hists callchains was
      looking slightly messy.
      
      Before:
      
           0.24%      swapper  [kernel.kallsyms]  [k] _raw_spin_lock_irq
                      |
                      --- _raw_spin_lock_irq
                          run_timer_softirq
                          __do_softirq
                          call_softirq
                          do_softirq
                          irq_exit
                          smp_apic_timer_interrupt
                          apic_timer_interrupt
                          default_idle
                          amd_e400_idle
                          cpu_idle
                          start_secondary
           0.10%         perf  [kernel.kallsyms]  [k] lock_is_held
                         |
                         --- lock_is_held
                             __might_sleep
                             mutex_lock_nested
                             perf_event_for_each_child
                             perf_ioctl
                             do_vfs_ioctl
                             sys_ioctl
                             system_call_fastpath
                             ioctl
                             cmd_record
                             run_builtin
                             main
                             __libc_start_main
      
      After:
      
           0.24%      swapper  [kernel.kallsyms]  [k] _raw_spin_lock_irq
                      |
                      --- _raw_spin_lock_irq
                          run_timer_softirq
                          __do_softirq
                          call_softirq
                          do_softirq
                          irq_exit
                          smp_apic_timer_interrupt
                          apic_timer_interrupt
                          default_idle
                          amd_e400_idle
                          cpu_idle
                          start_secondary
      
           0.10%         perf  [kernel.kallsyms]  [k] lock_is_held
                         |
                         --- lock_is_held
                             __might_sleep
                             mutex_lock_nested
                             perf_event_for_each_child
                             perf_ioctl
                             do_vfs_ioctl
                             sys_ioctl
                             system_call_fastpath
                             ioctl
                             cmd_record
                             run_builtin
                             main
                             __libc_start_main
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1342631456-7233-3-git-send-email-fweisbec@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      6654f5d8
    • Frederic Weisbecker's avatar
      perf tools: Fix trace events storms due to weight demux · 0983cc0d
      Frederic Weisbecker authored
      Trace events have a period (weight) of 1 by default. This can be
      overriden on events definition by using the __perf_count() macro.
      
      For example, the sched_stat_runtime() is weighted with the runtime of
      the task that fired the event.
      
      By default, perf handles such weighted event by dividing it into
      individual events carrying a weight of 1. For example if
      sched_stat_runtime is fired and the task has run 5000000 nsecs, perf
      divides it into 5000000 events in the buffer.
      
      This behaviour makes weighted events unusable because they quickly
      fullfill the buffers and we lose most events.
      
      The commit 5d81e5cf ("events: Don't
      divide events if it has field period") solves this problem by sending
      only one event when PERF_SAMPLE_PERIOD flag is set. The weight is
      carried in the sample itself such that we don't need to demultiplex it
      anymore.
      
      This patch provides the last missing piece to use this feature by
      setting PERF_SAMPLE_PERIOD from perf tools when we deal with trace
      events.
      
      Before:
      	$ ./perf record -e sched:* -a sleep 1
      	[ perf record: Woken up 3 times to write data ]
      	[ perf record: Captured and wrote 1.619 MB perf.data (~70749 samples) ]
      	Warning:
      	Processed 16909 events and lost 1 chunks!
      
      	Check IO/CPU overload!
      
      	$ ./perf script
      	perf  1894 [003]   824.898327: sched_migrate_task: comm=perf pid=1898 prio=120 orig_cpu=2 dest_cpu=0
      	perf  1894 [003]   824.898335: sched_stat_sleep: comm=perf pid=1898 delay=113179500 [ns]
      	perf  1894 [003]   824.898336: sched_stat_sleep: comm=perf pid=1898 delay=113179500 [ns]
      	perf  1894 [003]   824.898337: sched_stat_sleep: comm=perf pid=1898 delay=113179500 [ns]
      	perf  1894 [003]   824.898338: sched_stat_sleep: comm=perf pid=1898 delay=113179500 [ns]
      	perf  1894 [003]   824.898339: sched_stat_sleep: comm=perf pid=1898 delay=113179500 [ns]
      	perf  1894 [003]   824.898340: sched_stat_sleep: comm=perf pid=1898 delay=113179500 [ns]
      	perf  1894 [003]   824.898341: sched_stat_sleep: comm=perf pid=1898 delay=113179500 [ns]
      	[...]
      
      After:
      	$ ./perf record -e sched:* -a sleep 1
      	[ perf record: Woken up 1 times to write data ]
      	[ perf record: Captured and wrote 0.074 MB perf.data (~3228 samples) ]
      
      	$ ./perf script
      
      	perf  1461 [000]   554.286957: sched_migrate_task: comm=perf pid=1465 prio=120 orig_cpu=3 dest_cpu=1
      	perf  1461 [000]   554.286964: sched_stat_sleep: comm=perf pid=1465 delay=133047190 [ns]
      	perf  1461 [000]   554.286967: sched_wakeup: comm=perf pid=1465 prio=120 success=1 target_cpu=001
      	swapper     0 [001]   554.286976: sched_stat_wait: comm=perf pid=1465 delay=0 [ns]
      	swapper     0 [001]   554.286983: sched_switch: prev_comm=swapper/1 prev_pid=0 prev_prio=120 prev_state=R ==> next_comm=perf
      	[...]
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1342631456-7233-1-git-send-email-fweisbec@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0983cc0d
    • Frederic Weisbecker's avatar
      perf hists: Return correct number of characters printed in callchain · 8760db72
      Frederic Weisbecker authored
      Include the omitted number of characters printed for the first entry.
      
      Not that it really matters because nobody seem to care about the number
      of printed characters for now. But just in case.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: David Ahern <dsahern@gmail.com>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Link: http://lkml.kernel.org/r/1342631456-7233-2-git-send-email-fweisbec@gmail.comSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8760db72