Skip to content
  1. Feb 27, 2010
  2. Feb 26, 2010
    • David S. Miller's avatar
      perf tools: Flush maps on COMM events · 4385d580
      David S. Miller authored
      
      
      Even though we don't register the counters until the child is right about
      to exec(), we're still going to get at least a few events while the
      fork()'d child is still executing 'perf' and in particular we're going to
      get the MMAP events.
      
      We can't distinguish the ones in the newly executed process because the
      PID will be the same.
      
      One way to solve this would be to have a PERF_RECORD_EXEC event, and when
      this is seen 'perf' can flush it's map cache.  We can't use
      PERF_RECORD_COMM since that's generated by other things, not just exec().
      
      Actually, thinking about it some more, using PERF_RECORD_COMM might be a
      good enough approximation.
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1267196914-16238-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4385d580
    • Peter Zijlstra's avatar
      perf_events, x86: Split PMU definitions into separate files · f22f54f4
      Peter Zijlstra authored
      
      
      Split amd,p6,intel into separate files so that we can easily deal with
      CONFIG_CPU_SUP_* things, needed to make things build now that perf_event.c
      relies on symbols from amd.c
      
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f22f54f4
    • Arnaldo Carvalho de Melo's avatar
      perf annotate: Handle samples not at objdump output addr boundaries · 48fb4fdd
      Arnaldo Carvalho de Melo authored
      
      
      Without this patch we get this for need_resched:
      
      [root@mica ~]# perf annotate need_resched
      
      ------------------------------------------------
       Percent |      Source code & Disassembly of vmlinux
      ------------------------------------------------
               :
               :
               :      Disassembly of section .text:
               :
               :      ffffffff810095ed <need_resched>:
               :              return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
               :      }
               :
               :      static inline int need_resched(void)
               :      {
          0.00 :      ffffffff810095ed:       55                      push   %rbp
               :              return unlikely(test_thread_flag(TIF_NEED_RESCHED));
          0.00 :      ffffffff810095ee:       be 03 00 00 00          mov    $0x3,%esi
               :
               :      static inline struct thread_info *current_thread_info(void)
               :      {
               :              struct thread_info *ti;
               :              ti = (void *)(percpu_read_stable(kernel_stack) +
          0.00 :      ffffffff810095f3:       65 48 8b 3c 25 48 b5    mov    %gs:0xb548,%rdi
          0.00 :      ffffffff810095fa:       00 00
               :              return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
               :      }
               :
               :      static inline int need_resched(void)
               :      {
          0.00 :      ffffffff810095fc:       48 89 e5                mov    %rsp,%rbp
               :              return unlikely(test_thread_flag(TIF_NEED_RESCHED));
          0.00 :      ffffffff810095ff:       48 81 ef d8 1f 00 00    sub    $0x1fd8,%rdi
          0.00 :      ffffffff81009606:       e8 9d ff ff ff          callq  ffffffff810095a8 <test_ti_thread_flag>
               :      }
          0.00 :      ffffffff8100960b:       c9                      leaveq
          0.00 :      ffffffff8100960c:       85 c0                   test   %eax,%eax
          0.00 :      ffffffff8100960e:       0f 95 c0                setne  %al
          0.00 :      ffffffff81009611:       0f b6 c0                movzbl %al,%eax
               :      Disassembly of section .vsyscall_0:
               :      Disassembly of section .vsyscall_fn:
               :      Disassembly of section .vsyscall_1:
               :      Disassembly of section .vsyscall_2:
               :      Disassembly of section .init.text:
               :      Disassembly of section .altinstr_replacement:
               :      Disassembly of section .exit.text:
      [root@mica ~]#
      
      But from the 'perf report' result we know that there are hits
      for need_resched on a 4 way machine mostly doing nothing, so
      after adding code to show what is in each hist offset and
      collapsing IP hits for what happens between objdump lines we
      get, for the same perf.data file:
      
      [root@mica ~]# perf annotate -v need_resched
      
      ------------------------------------------------
       Percent |      Source code & Disassembly of vmlinux
      ------------------------------------------------
               :
               :
               :      Disassembly of section .text:
               :
               :      ffffffff810095ed <need_resched>:
               :              return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
               :      }
               :
               :      static inline int need_resched(void)
               :      {
          0.00 :      ffffffff810095ed:       55                      push   %rbp
               :              return unlikely(test_thread_flag(TIF_NEED_RESCHED));
         52.78 :      ffffffff810095ee:       be 03 00 00 00          mov    $0x3,%esi
               :
               :      static inline struct thread_info *current_thread_info(void)
               :      {
               :              struct thread_info *ti;
               :              ti = (void *)(percpu_read_stable(kernel_stack) +
          0.00 :      ffffffff810095f3:       65 48 8b 3c 25 48 b5    mov    %gs:0xb548,%rdi
          0.00 :      ffffffff810095fa:       00 00
               :              return (state & TASK_INTERRUPTIBLE) || __fatal_signal_pending(p);
               :      }
               :
               :      static inline int need_resched(void)
               :      {
          0.00 :      ffffffff810095fc:       48 89 e5                mov    %rsp,%rbp
               :              return unlikely(test_thread_flag(TIF_NEED_RESCHED));
          9.72 :      ffffffff810095ff:       48 81 ef d8 1f 00 00    sub    $0x1fd8,%rdi
          0.00 :      ffffffff81009606:       e8 9d ff ff ff          callq  ffffffff810095a8 <test_ti_thread_flag>
               :      }
          0.00 :      ffffffff8100960b:       c9                      leaveq
          0.00 :      ffffffff8100960c:       85 c0                   test   %eax,%eax
         37.50 :      ffffffff8100960e:       0f 95 c0                setne  %al
          0.00 :      ffffffff81009611:       0f b6 c0                movzbl %al,%eax
               :      Disassembly of section .vsyscall_0:
               :      Disassembly of section .vsyscall_fn:
               :      Disassembly of section .vsyscall_1:
               :      Disassembly of section .vsyscall_2:
               :      Disassembly of section .init.text:
               :      Disassembly of section .altinstr_replacement:
               :      Disassembly of section .exit.text:
      [root@mica ~]#
      
      And now 'perf annotate -v', verbose mode, will show the hits per
      precise IP, so that one can make sense of the attribution to
      each objdumop line:
      
      [root@mica ~]# perf annotate -v need_resched
      Looking at the vmlinux_path (5 entries long)
      Using /lib/modules/2.6.33-rc8-tip-00784-g3471df5-dirty/build/vmlinux
      for symbols annotate_sym: filename=/lib/modules/2.6.33-rc8-tip-00784-g3471df5-dirty/build/vmlinux, sym=need_resched, start=0xffffffff810095ed, end=0xffffffff81009614
      
      ------------------------------------------------
       Percent |      Source code & Disassembly of vmlinux
      ------------------------------------------------
                      ffffffff810095f1: 152
                      ffffffff81009603: 28
                      ffffffff8100960f: 55
                      ffffffff81009610: 53
                                h->sum: 288
      <SNIP same annotation>
      
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: David Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <1267194194-15670-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      48fb4fdd
    • Peter Zijlstra's avatar
      perf_events, x86: Remove superflous MSR writes · 6667661d
      Peter Zijlstra authored
      
      
      We re-program the event control register every time we reset the count,
      this appears to be superflous, hence remove it.
      
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6667661d
    • Peter Zijlstra's avatar
      perf_events: Simplify code by removing cpu argument to hw_perf_group_sched_in() · 6e37738a
      Peter Zijlstra authored
      
      
      Since the cpu argument to hw_perf_group_sched_in() is always
      smp_processor_id(), simplify the code a little by removing this argument
      and using the current cpu where needed.
      
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: David Miller <davem@davemloft.net>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1265890918.5396.3.camel@laptop>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6e37738a
    • Stephane Eranian's avatar
      perf_events, x86: AMD event scheduling · 38331f62
      Stephane Eranian authored
      
      
      This patch adds correct AMD NorthBridge event scheduling.
      
      NB events are events measuring L3 cache, Hypertransport traffic. They are
      identified by an event code >= 0xe0. They measure events on the
      Northbride which is shared by all cores on a package. NB events are
      counted on a shared set of counters. When a NB event is programmed in a
      counter, the data actually comes from a shared counter. Thus, access to
      those counters needs to be synchronized.
      
      We implement the synchronization such that no two cores can be measuring
      NB events using the same counters. Thus, we maintain a per-NB allocation
      table. The available slot is propagated using the event_constraint
      structure.
      
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <4b703957.0702d00a.6bf2.7b7d@mx.google.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      38331f62
    • Stephane Eranian's avatar
      perf_events: Add new start/stop PMU callbacks · d76a0812
      Stephane Eranian authored
      
      
      In certain situations, the kernel may need to stop and start the same
      event rapidly. The current PMU callbacks do not distinguish between stop
      and release (i.e., stop + free the resource). Thus, a counter may be
      released, then it will be immediately re-acquired. Event scheduling will
      again take place with no guarantee to assign the same counter. On some
      processors, this may event yield to failure to assign the event back due
      to competion between cores.
      
      This patch is adding a new pair of callback to stop and restart a counter
      without actually release the underlying counter resource. On stop, the
      counter is stopped, its values saved and that's it. On start, the value
      is reloaded and counter is restarted (on x86, actual restart is delayed
      until perf_enable()).
      
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      [ added fallback to ->enable/->disable for all other PMUs
        fixed x86_pmu_start() to call x86_pmu.enable()
        merged __x86_pmu_disable into x86_pmu_stop() ]
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <4b703875.0a04d00a.7896.ffffb824@mx.google.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      d76a0812
    • Peter Zijlstra's avatar
      perf_events: Report the MMAP pgoff value in bytes · 3a0304e9
      Peter Zijlstra authored
      
      
      DaveM reported that currently perf interprets the pgoff value reported by
      the MMAP events as a byte range, but the kernel reports it as a page
      offset.
      
      Since its broken (and unusable) anyway, change the kernel behaviour (ABI)
      to report bytes indeed, avoiding the need for userspace to deal with
      PAGE_SIZE things.
      
      Reported-by: default avatarDavid Miller <davem@davemloft.net>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3a0304e9
    • Arnaldo Carvalho de Melo's avatar
      perf annotate: Defer allocating sym_priv->hist array · 628ada0c
      Arnaldo Carvalho de Melo authored
      
      
      Because symbol->end is not fixed up at symbol_filter time, only
      after all symbols for a DSO are loaded, and that, for asm
      symbols, may be bogus, causing segfaults when hits happen in
      these symbols.
      
      Reported-by: default avatarDavid Miller <davem@davemloft.net>
      Reported-by: default avatarAnton Blanchard <anton@samba.org>
      Acked-by: default avatarDavid Miller <davem@davemloft.net>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: <stable@kernel.org> # for .33.x. Does not apply cleanly, needs backport.
      LKML-Reference: <20100225155740.GB8553@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      628ada0c
  3. Feb 25, 2010
  4. Feb 24, 2010
  5. Feb 23, 2010