Skip to content
  1. Jul 26, 2012
  2. Jul 25, 2012
    • 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.org
      
      
      Signed-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.org
      
      
      Signed-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.name
      
      
      Signed-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.com
      
      
      Signed-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.com
      
      
      Signed-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.com
      
      
      Signed-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.com
      
      
      Signed-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.com
      
      
      Signed-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.com
      
      
      Signed-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.com
      
      
      Signed-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.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      8760db72
    • David Ahern's avatar
      perf tools: Dump exclude_{guest,host}, precise_ip header info too · 78b961ff
      David Ahern authored
      
      
      Adds the attributes to the event line in the header dump.
      From:
       event : name = cycles, type = 0, config = 0x0, config1 = 0x0,
            config2 = 0x0, excl_usr = 0, excl_kern = 0, ...
      to
        event : name = cycles, type = 0, config = 0x0, config1 = 0x0,
            config2 = 0x0, excl_usr = 0, excl_kern = 0, excl_host = 0,
            excl_guest = 0, precise_ip = 0, ...
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      Link: http://lkml.kernel.org/r/1342826756-64663-8-git-send-email-dsahern@gmail.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      78b961ff
    • David Ahern's avatar
      perf kvm: Limit repetitive guestmount message to once per directory · c80c3c26
      David Ahern authored
      After 7ed97ad4
      
       use of the guestmount option without a subdir for *each*
      VM generates an error message for each sample related to that VM. Once
      per VM is enough.
      
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1342826756-64663-7-git-send-email-dsahern@gmail.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      c80c3c26
    • David Ahern's avatar
      perf kvm: Fix bug resolving guest kernel syms · adb5d2a4
      David Ahern authored
      
      
      Guest kernel symbols are not resolved despite passing the information
      needed to resolve them. e.g.,
      
      perf kvm --guest --guestmount=/tmp/guest-mount record -a -- sleep 1
      perf kvm --guest --guestmount=/tmp/guest-mount report --stdio
      
          36.55%  [guest/11399]  [unknown]         [g] 0xffffffff81600bc8
          33.19%  [guest/10474]  [unknown]         [g] 0x00000000c0116e00
          30.26%  [guest/11094]  [unknown]         [g] 0xffffffff8100a288
          43.69%  [guest/10474]  [unknown]         [g] 0x00000000c0103d90
          37.38%  [guest/11399]  [unknown]         [g] 0xffffffff81600bc8
          12.24%  [guest/11094]  [unknown]         [g] 0xffffffff810aa91d
           6.69%  [guest/11094]  [unknown]         [u] 0x00007fa784d721c3
      
      which is just pathetic.
      
      After a maddening 2 days sifting through perf minutia I found it --
      id_hdr_size is not initialized for guest machines. This shows up on the
      report side as random garbage for the cpu and timestamp, e.g.,
      
      29816 7310572949125804849 0x1ac0 [0x50]: PERF_RECORD_MMAP ...
      
      That messes up the sample sorting such that synthesized guest maps are
      processed last.
      
      With this patch you get a much more helpful report:
      
        12.11%  [guest/11399]  [guest.kernel.kallsyms.11399]  [g] irqtime_account_process_tick
        10.58%  [guest/11399]  [guest.kernel.kallsyms.11399]  [g] run_timer_softirq
         6.95%  [guest/11094]  [guest.kernel.kallsyms.11094]  [g] printk_needs_cpu
         6.50%  [guest/11094]  [guest.kernel.kallsyms.11094]  [g] do_timer
         6.45%  [guest/11399]  [guest.kernel.kallsyms.11399]  [g] idle_balance
         4.90%  [guest/11094]  [guest.kernel.kallsyms.11094]  [g] native_read_tsc
          ...
      
      v2:
      - changed rbtree walk to use rb_first per Namhyung's suggestion
      
      Tested-by: default avatarJiri Olsa <jolsa@redhat.com>
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1342826756-64663-5-git-send-email-dsahern@gmail.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      adb5d2a4
    • David Ahern's avatar
      perf kvm: Guest userspace samples should not be lumped with host uspace · 7c0f4a41
      David Ahern authored
      
      
      e.g., perf kvm --host  --guest report -i perf.data --stdio -D
      shows:
      
      1 599127912065356 0x143b8 [0x48]: PERF_RECORD_SAMPLE(IP, 5): 5671/5676: 0x7fdf95a061c0 period: 1 addr: 0
      ... chain: nr:2
      .....  0: ffffffffffffff80
      .....  1: fffffffffffffe00
       ... thread: qemu-kvm:5671
       ...... dso: <not found>
      
      (IP, 5) means sample in guest userspace. Those samples should not be lumped
      into the VMM's host thread. i.e, the report output:
      
          56.86%  qemu-kvm  [unknown]         [u] 0x00007fdf95a061c0
      
      With this patch the output emphasizes it is a guest userspace hit:
      
          56.86%  [guest/5671]  [unknown]         [u] 0x00007fdf95a061c0
      
      Looking at 3 VMs (2 64-bit, 1 32-bit) with each running a CPU bound
      process (openssl speed), perf report currently shows:
      
        93.84%  117726   qemu-kvm  [unknown]   [u] 0x00007fd7dcaea8e5
      
      which is wrong. With this patch you get:
      
        31.50%   39258   [guest/18772]  [unknown]   [u] 0x00007fd7dcaea8e5
        31.50%   39236   [guest/11230]  [unknown]   [u] 0x0000000000a57340
        30.84%   39232   [guest/18395]  [unknown]   [u] 0x00007f66f641e107
      
      Tested-by: default avatarJiri Olsa <jolsa@redhat.com>
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1342826756-64663-4-git-send-email-dsahern@gmail.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      7c0f4a41
    • David Ahern's avatar
      perf kvm: Set name for VM process in guest machine · 5cd95c2d
      David Ahern authored
      
      
      COMM events are not generated in the context of a guest machine, so the
      thread name is never set for the VMM process. For example, the qemu-kvm
      name applies to the process in the host machine, not the guest machine.
      So, samples for guest machines are currently displayed as:
      
          99.67%     :5671  [unknown]         [g] 0xffffffff81366b41
      
      where 5671 is the pid of the VMM. With this patch the samples in the guest
      machine are shown as:
      
          18.43%  [guest/5671]  [unknown]           [g] 0xffffffff810d68b7
      
      Tested-by: default avatarJiri Olsa <jolsa@redhat.com>
      Signed-off-by: default avatarDavid Ahern <dsahern@gmail.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Jiri Olsa <jolsa@redhat.com>
      Cc: Namhyung Kim <namhyung@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Link: http://lkml.kernel.org/r/1342826756-64663-3-git-send-email-dsahern@gmail.com
      
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      5cd95c2d
  3. Jul 24, 2012
  4. Jul 23, 2012
    • Linus Torvalds's avatar
      Merge branch 'x86-build-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · e2b34e31
      Linus Torvalds authored
      Pull a x86/build change from Ingo Molnar.
      
      This makes the default stack alignment on x86-64 be just 8, allowing for
      improved code generation (it can avoid some unnecessary extra alignment
      logic and use just pure push/pop sequences) and smaller stack frames.
      
      We can't generally do SSE with 16-byte alignment issues in the kernel anyway.
      
      * 'x86-build-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86-64, gcc: Use -mpreferred-stack-boundary=3 if supported
      e2b34e31
    • Linus Torvalds's avatar
      Merge branch 'x86-uv-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 2bd3488f
      Linus Torvalds authored
      Pull x86/uv changes from Ingo Molnar:
       "UV2 BAU productization fixes.
      
        The BAU (Broadcast Assist Unit) is SGI's fancy out of line way on UV
        hardware to do TLB flushes, instead of the normal APIC IPI methods.
        The commits here fix / work around hangs in their latest hardware
        iteration (UV2).
      
        My understanding is that the main purpose of the out of line
        signalling channel is to improve scalability: the UV APIC hardware
        glue does not handle broadcasting to many CPUs very well, and this
        matters most for TLB shootdowns.
      
        [ I don't agree with all aspects of the current approach: in hindsight
          it would have been better to link the BAU at the IPI/APIC driver
          level instead of the TLB shootdown level, where TLB flushes are
          really just one of the uses of broadcast SMP messages.  Doing that
          would improve scalability in some other ways and it would also
          remove a few uglies from the TLB path.  It would also be nice to
          push more is_uv_system() tests into proper x86_init or x86_platform
          callbacks.  Cliff? ]"
      
      * 'x86-uv-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/uv: Work around UV2 BAU hangs
        x86/uv: Implement UV BAU runtime enable and disable control via /proc/sgi_uv/
        x86/uv: Fix the UV BAU destination timeout period
      2bd3488f
    • Linus Torvalds's avatar
      Merge branch 'x86-reboot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · d5d96ed2
      Linus Torvalds authored
      Pull x86/reboot changes from Ingo Molnar:
       "Now that the revampted x86 real-mode trampoline code is upstream and
        seems to be working well, we can extend the 64-bit reboot code to be
        as capable as the 32-bit one."
      
      * 'x86-reboot-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86-64, reboot: Be more paranoid in 64-bit reboot=bios
        x86, reboot: Drop redundant write of reboot_mode
        x86-64, reboot: Allow reboot=bios and reboot-cpu override on x86-64
      d5d96ed2
    • Linus Torvalds's avatar
      Merge branch 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · bd3e57f9
      Linus Torvalds authored
      Pull x86 platform changes from Ingo Molnar:
       "This tree mostly involves various APIC driver cleanups/robustization,
        and vSMP motivated platform callback improvements/cleanups"
      
      Fix up trivial conflict due to printk cleanup right next to return value
      change.
      
      * 'x86-platform-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (29 commits)
        Revert "x86/early_printk: Replace obsolete simple_strtoul() usage with kstrtoint()"
        x86/apic/x2apic: Use multiple cluster members for the irq destination only with the explicit affinity
        x86/apic/x2apic: Limit the vector reservation to the user specified mask
        x86/apic: Optimize cpu traversal in __assign_irq_vector() using domain membership
        x86/vsmp: Fix vector_allocation_domain's return value
        irq/apic: Use config_enabled(CONFIG_SMP) checks to clean up irq_set_affinity() for UP
        x86/vsmp: Fix linker error when CONFIG_PROC_FS is not set
        x86/apic/es7000: Make apicid of a cluster (not CPU) from a cpumask
        x86/apic/es7000+summit: Always make valid apicid from a cpumask
        x86/apic/es7000+summit: Fix compile warning in cpu_mask_to_apicid()
        x86/apic: Fix ugly casting and branching in cpu_mask_to_apicid_and()
        x86/apic: Eliminate cpu_mask_to_apicid() operation
        x86/x2apic/cluster: Vector_allocation_domain() should return a value
        x86/apic/irq_remap: Silence a bogus pr_err()
        x86/vsmp: Ignore IOAPIC IRQ affinity if possible
        x86/apic: Make cpu_mask_to_apicid() operations check cpu_online_mask
        x86/apic: Make cpu_mask_to_apicid() operations return error code
        x86/apic: Avoid useless scanning thru a cpumask in assign_irq_vector()
        x86/apic: Try to spread IRQ vectors to different priority levels
        x86/apic: Factor out default vector_allocation_domain() operation
        ...
      bd3e57f9
    • Linus Torvalds's avatar
      Merge branch 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 3fad0953
      Linus Torvalds authored
      Pull debug-for-linus git tree from Ingo Molnar.
      
      Fix up trivial conflict in arch/x86/kernel/cpu/perf_event_intel.c due to
      a printk() having changed to a pr_info() differently in the two branches.
      
      * 'x86-debug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86: Move call to print_modules() out of show_regs()
        x86/mm: Mark free_initrd_mem() as __init
        x86/microcode: Mark microcode_id[] as __initconst
        x86/nmi: Clean up register_nmi_handler() usage
        x86: Save cr2 in NMI in case NMIs take a page fault (for i386)
        x86: Remove cmpxchg from i386 NMI nesting code
        x86: Save cr2 in NMI in case NMIs take a page fault
        x86/debug: Add KERN_<LEVEL> to bare printks, convert printks to pr_<level>
      3fad0953
    • Linus Torvalds's avatar
      Merge branch 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a065de0d
      Linus Torvalds authored
      Pull x86/asm changes from Ingo Molnar:
       "Assorted single-commit improvements, as usual"
      
      * 'x86-asm-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mm/mtrr: Slightly simplify print_mtrr_state()
        x86/mm/mtrr: Fix alignment determination in range_to_mtrr()
        x86/copy_user_generic: Optimize copy_user_generic with CPU erms feature
        x86/alternatives: Use atomic_xchg() instead atomic_dec_and_test() for stop_machine_text_poke()
      a065de0d
    • Linus Torvalds's avatar
      Merge branch 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 3992c032
      Linus Torvalds authored
      Pull timer core changes from Ingo Molnar:
       "Continued cleanups of the core time and NTP code, plus more nohz work
        preparing for tick-less userspace execution."
      
      * 'timers-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        time: Rework timekeeping functions to take timekeeper ptr as argument
        time: Move xtime_nsec adjustment underflow handling timekeeping_adjust
        time: Move arch_gettimeoffset() usage into timekeeping_get_ns()
        time: Refactor accumulation of nsecs to secs
        time: Condense timekeeper.xtime into xtime_sec
        time: Explicitly use u32 instead of int for shift values
        time: Whitespace cleanups per Ingo%27s requests
        nohz: Move next idle expiry time record into idle logic area
        nohz: Move ts->idle_calls incrementation into strict idle logic
        nohz: Rename ts->idle_tick to ts->last_tick
        nohz: Make nohz API agnostic against idle ticks cputime accounting
        nohz: Separate idle sleeping time accounting from nohz logic
        timers: Improve get_next_timer_interrupt()
        timers: Add accounting of non deferrable timers
        timers: Consolidate base->next_timer update
        timers: Create detach_if_pending() and use it
      3992c032
    • Linus Torvalds's avatar
      Merge branch 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 55acdddb
      Linus Torvalds authored
      Pull smp/hotplug changes from Ingo Molnar:
       "Various cleanups to the SMP hotplug code - a continuing effort of
        Thomas et al"
      
      * 'smp-hotplug-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        smpboot: Remove leftover declaration
        smp: Remove num_booting_cpus()
        smp: Remove ipi_call_lock[_irq]()/ipi_call_unlock[_irq]()
        POWERPC: Smp: remove call to ipi_call_lock()/ipi_call_unlock()
        SPARC: SMP: Remove call to ipi_call_lock_irq()/ipi_call_unlock_irq()
        ia64: SMP: Remove call to ipi_call_lock_irq()/ipi_call_unlock_irq()
        x86-smp-remove-call-to-ipi_call_lock-ipi_call_unlock
        tile: SMP: Remove call to ipi_call_lock()/ipi_call_unlock()
        S390: Smp: remove call to ipi_call_lock()/ipi_call_unlock()
        parisc: Smp: remove call to ipi_call_lock()/ipi_call_unlock()
        mn10300: SMP: Remove call to ipi_call_lock()/ipi_call_unlock()
        hexagon: SMP: Remove call to ipi_call_lock()/ipi_call_unlock()
      55acdddb
    • Linus Torvalds's avatar
      Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 2eafeb6a
      Linus Torvalds authored
      Pull perf events changes from Ingo Molnar:
      
       "- kernel side:
      
         - Intel uncore PMU support for Nehalem and Sandy Bridge CPUs, we
           support both the events available via the MSR and via the PCI
           access space.
      
         - various uprobes cleanups and restructurings
      
         - PMU driver quirks by microcode version and required x86 microcode
           loader cleanups/robustization
      
         - various tracing robustness updates
      
         - static keys: remove obsolete static_branch()
      
        - tooling side:
      
         - GTK browser improvements
      
         - perf report browser: support screenshots to file
      
         - more automated tests
      
         - perf kvm improvements
      
         - perf bench refinements
      
         - build environment improvements
      
         - pipe mode improvements
      
         - libtraceevent updates, we have now hopefully merged most bits with
           the out of tree forked code base
      
        ... and many other goodies."
      
      * 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (138 commits)
        tracing: Check for allocation failure in __tracing_open()
        perf/x86: Fix intel_perfmon_event_mapformatting
        jump label: Remove static_branch()
        tracepoint: Use static_key_false(), since static_branch() is deprecated
        perf/x86: Uncore filter support for SandyBridge-EP
        perf/x86: Detect number of instances of uncore CBox
        perf/x86: Fix event constraint for SandyBridge-EP C-Box
        perf/x86: Use 0xff as pseudo code for fixed uncore event
        perf/x86: Save a few bytes in 'struct x86_pmu'
        perf/x86: Add a microcode revision check for SNB-PEBS
        perf/x86: Improve debug output in check_hw_exists()
        perf/x86/amd: Unify AMD's generic and family 15h pmus
        perf/x86: Move Intel specific code to intel_pmu_init()
        perf/x86: Rename Intel specific macros
        perf/x86: Fix USER/KERNEL tagging of samples
        perf tools: Split event symbols arrays to hw and sw parts
        perf tools: Split out PE_VALUE_SYM parsing token to SW and HW tokens
        perf tools: Add empty rule for new line in event syntax parsing
        perf test: Use ARRAY_SIZE in parse events tests
        tools lib traceevent: Cleanup realloc use
        ...
      2eafeb6a
    • Linus Torvalds's avatar
      Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 16d286e6
      Linus Torvalds authored
      Pull RCU changes from Ingo Molnar:
       "Quoting from Paul, the major features of this series are:
      
        1. Preventing latency spikes of more than 200 microseconds for
           kernels built with NR_CPUS=4096, which is reportedly becoming the
           default for some distros.  This is a first step, as it does not
           help with systems that actually -have- 4096 CPUs (work on this case
           is in progress, but is not yet ready for mainline).
      
           This category also includes improving concurrency of rcu_barrier(),
           placed here due to conflicts.  Posted to LKML at:
      
            https://lkml.org/lkml/2012/6/22/381
      
           Note that patches 18-22 of that series have been defered to 3.7, as
           they have not yet proven themselves to be mainline-ready (and yes,
           these are the ones intended to get rid of RCU's latency spikes for
           systems that actually have 4096 CPUs).
      
        2. Updates to documentation and rcutorture fixes, the latter category
           including improvements to rcu_barrier() testing.  Posted to LKML at
      
            http://lkml.indiana.edu/hypermail/linux/kernel/1206.1/04094.html.
      
        3. Miscellaneous fixes posted to LKML at:
      
            https://lkml.org/lkml/2012/6/22/500
      
           with the exception of the last commit, which was posted here:
      
            http://www.gossamer-threads.com/lists/linux/kernel/1561830
      
        4. RCU_FAST_NO_HZ fixes and improvements.  Posted to LKML at:
      
            http://lkml.indiana.edu/hypermail/linux/kernel/1206.1/00006.html
            http://www.gossamer-threads.com/lists/linux/kernel/1561833
      
           The first four patches of the first series went into 3.5 to fix a
           regression.
      
        5. Code-style fixes.  These were posted to LKML at
      
            http://lkml.indiana.edu/hypermail/linux/kernel/1205.2/01180.html
            http://lkml.indiana.edu/hypermail/linux/kernel/1205.2/01181.html"
      
      * 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (48 commits)
        rcu: Fix broken strings in RCU's source code.
        rcu: Fix code-style issues involving "else"
        rcu: Introduce check for callback list/count mismatch
        rcu: Make RCU_FAST_NO_HZ respect nohz= boot parameter
        rcu: Fix qlen_lazy breakage
        rcu: Round FAST_NO_HZ lazy timeout to nearest second
        rcu: The rcu_needs_cpu() function is not a quiescent state
        rcu: Dump only the current CPU's buffers for idle-entry/exit warnings
        rcu: Add check for CPUs going offline with callbacks queued
        rcu: Disable preemption in rcu_blocking_is_gp()
        rcu: Prevent uninitialized string in RCU CPU stall info
        rcu: Fix rcu_is_cpu_idle() #ifdef in TINY_RCU
        rcu: Split RCU core processing out of __call_rcu()
        rcu: Prevent __call_rcu() from invoking RCU core on offline CPUs
        rcu: Make __call_rcu() handle invocation from idle
        rcu: Remove function versions of __kfree_rcu and __is_kfree_rcu_offset
        rcu: Consolidate tree/tiny __rcu_read_{,un}lock() implementations
        rcu: Remove return value from rcu_assign_pointer()
        key: Remove extraneous parentheses from rcu_assign_keypointer()
        rcu: Remove return value from RCU_INIT_POINTER()
        ...
      16d286e6
    • Linus Torvalds's avatar
      Merge branch 'core-iommu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ceee0e95
      Linus Torvalds authored
      Pull core/iommu changes from Ingo Molnar.
      
      * 'core-iommu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        iommu/dmar: Use pr_format() instead of PREFIX to tidy up pr_*() calls
        iommu/dmar: Reserve mmio space used by the IOMMU, if the BIOS forgets to
        iommu/dmar: Replace printks with appropriate pr_*()
      ceee0e95
  5. Jul 22, 2012