1. 03 6月, 2009 24 次提交
    • P
      perf_counter: powerpc: Fix race causing "oops trying to read PMC0" errors · dcd945e0
      Paul Mackerras 提交于
      When using interrupting counters and limited (non-interrupting)
      counters at the same time, it's possible that we get an
      interrupt in write_mmcr0() after writing MMCR0 but before we
      have set up the counters using limited PMCs.  What happens then
      is that we get into perf_counter_interrupt() with
      counter->hw.idx = 0 for the limited counters, leading to the
      "oops trying to read PMC0" error message being printed.
      
      This fixes the problem by making perf_counter_interrupt()
      robust against counter->hw.idx being zero (the counter is just
      ignored in that case) and also by changing write_mmcr0() to
      write MMCR0 initially with the counter overflow interrupt
      enable bits masked (set to 0).  If the MMCR0 value requested by
      the caller has either of those bits set, we write MMCR0 again
      with the requested value of those bits after setting up the
      limited counters properly.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Stephane Eranian <eranian@googlemail.com>
      LKML-Reference: <18982.17684.138182.954599@cargo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      dcd945e0
    • P
      perf_counter: powerpc: Fix event alternative code generation on POWER5/5+ · 6984efb6
      Paul Mackerras 提交于
      Commit ef923214 ("perf_counter: powerpc: use u64 for event
      codes internally") introduced a bug where the return value from
      function find_alternative_bdecode gets put into a u64 variable
      and later tested to see if it is < 0.  The effect is that we
      get extra, bogus event code alternatives on POWER5 and POWER5+,
      leading to error messages such as "oops compute_mmcr failed"
      being printed and counters not counting properly.
      
      This fixes it by using s64 for the return type of
      find_alternative_bdecode and for the local variable that the
      caller puts the value in.  It also makes the event argument a
      u64 on POWER5+ for consistency.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Stephane Eranian <eranian@googlemail.com>
      LKML-Reference: <18982.17586.666132.90983@cargo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      6984efb6
    • I
      perf report: Handle vDSO symbols properly · ed966aac
      Ingo Molnar 提交于
      We were not looking up vDSO symbols properly, because they
      are in the kallsyms but are user-mode entries.
      
      Pass negative addresses to the kernel dso object, this
      way we resolve them properly:
      
           0.05%  [kernel]: vread_tsc
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ed966aac
    • I
      perf report: Improve sort key recognition · 5352f35d
      Ingo Molnar 提交于
       - allow case-insensitive tokens - such as --sort Comm,Symbol
       - allow substring shortcuts: --sort sym
       - detect invalid tokens and bail out
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      5352f35d
    • I
      perf report: Print -D to stdout · 3502973d
      Ingo Molnar 提交于
      -D prints to stderr - which is a bit confusing - print to stdout
      instead.
      
      Also clean up the if (dump_trace) patterns via a dprintf helper.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3502973d
    • A
      perf_counter tools: Cover PLT symbols too · 8ce998d6
      Arnaldo Carvalho de Melo 提交于
      PLT, the Program Linking Table, is used with the dynamic linker to
      allow PIC code in executables and shared objects to figure out
      where functions are in other shared objects.
      
      It is one of the sources of unknown/unresolved symbols - this patch
      does what binutils figures out when you ask it to disassembly.
      (objdump -S)
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Stephane Eranian <eranian@googlemail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8ce998d6
    • Y
      perf_counter/x86: Remove the IRQ (non-NMI) handling bits · a3288106
      Yong Wang 提交于
      Remove the IRQ (non-NMI) handling bits as NMI will be used always.
      Signed-off-by: NYong Wang <yong.y.wang@intel.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <20090603051255.GA2791@ywang-moblin2.bj.intel.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a3288106
    • I
      perf record: Print out the number of events captured · addc2785
      Ingo Molnar 提交于
      It makes sense to inform the user about how many events
      perf record has written - so that the sufficiency of
      profiling coverage and intensity can be determined at
      a glance.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      addc2785
    • I
      perf_counter tools: Make source code headers more coherent · bf9e1876
      Ingo Molnar 提交于
      The perf commands had different ways of describing themselves,
      introduce a coherent command-file-header format taken from the
      Git project.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      bf9e1876
    • I
      perf report: Print more info instead of <unknown> entries · 0a520c63
      Ingo Molnar 提交于
      Sometimes we still fail to find a DSO or look up a symbol,
      print out the raw information in this case (which an help
      debug the problem), instead of a not very helpful <unknown>
      string.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0a520c63
    • I
      perf record: Increase mmap buffering default · 3cf165fc
      Ingo Molnar 提交于
      I've run into mmap overruns with the current 16 pages default,
      increase it to 128 pages.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3cf165fc
    • I
      perf record: Add --append option · abaff32a
      Ingo Molnar 提交于
      Allow incremental profiling via 'perf record -A' - this will append
      to an existing perf.data.
      
      Also reorder perf record options by utility / likelyhood of usage.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      abaff32a
    • I
      perf report: Fix column width/alignment of dsos · cf25c63c
      Ingo Molnar 提交于
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      cf25c63c
    • P
      perf report: Separate out idle threads · 436224a6
      Peter Zijlstra 提交于
      Introduce the special comm name [idle] for idle theads.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      436224a6
    • P
      perf_counter tools: Fix up the ABI shakeup · c70975bc
      Peter Zijlstra 提交于
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Stephane Eranian <eranian@googlemail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c70975bc
    • P
      perf_counter: Rename perf_counter_hw_event => perf_counter_attr · 0d48696f
      Peter Zijlstra 提交于
      The structure isn't hw only and when I read event, I think about those
      things that fall out the other end. Rename the thing.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      Cc: Stephane Eranian <eranian@googlemail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0d48696f
    • P
      perf_counter: Add ioctl for changing the sample period/frequency · 08247e31
      Peter Zijlstra 提交于
      Reported-by: NStephane Eranian <eranian@googlemail.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      08247e31
    • P
      perf_counter: Change data head from u32 to u64 · 8e3747c1
      Peter Zijlstra 提交于
      Since some people worried that 4G might not be a large enough
      as an mmap data window, extend it to 64 bit for capable
      platforms.
      Reported-by: NStephane Eranian <eranian@googlemail.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8e3747c1
    • P
      perf_counter: x86: Emulate longer sample periods · e4abb5d4
      Peter Zijlstra 提交于
      Do as Power already does, emulate sample periods up to 2^63-1 by
      composing them of smaller values limited by hardware capabilities.
      Only once we wrap the software period do we generate an overflow
      event.
      
      Just 10 lines of new code.
      Reported-by: NStephane Eranian <eranian@googlemail.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e4abb5d4
    • P
      perf_counter: Remove the last nmi/irq bits · 8a016db3
      Peter Zijlstra 提交于
      IRQ (non-NMI) sampling is not used anymore - remove the last few bits.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8a016db3
    • P
      perf_counter: Rename various fields · b23f3325
      Peter Zijlstra 提交于
      A few renames:
      
        s/irq_period/sample_period/
        s/irq_freq/sample_freq/
        s/PERF_RECORD_/PERF_SAMPLE_/
        s/record_type/sample_type/
      
      And change both the new sample_type and read_format to u64.
      Reported-by: NStephane Eranian <eranian@googlemail.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b23f3325
    • P
      perf_counter: Add unique counter id · 8e5799b1
      Peter Zijlstra 提交于
      Stephan raised the issue that we currently cannot distinguish between
      similar counters within a group (PERF_RECORD_GROUP uses the config
      value as identifier).
      
      Therefore, generate a new ID for each counter using a global u64
      sequence counter.
      Reported-by: NStephane Eranian <eranian@googlemail.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8e5799b1
    • P
      x86: Fix atomic_long_xchg() on 64bit · 53e111a7
      Peter Zijlstra 提交于
      Apparently I'm the first to use it :-)
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      53e111a7
    • P
      perf_counter tools: Remove the last nmi bits · 29c28102
      Peter Zijlstra 提交于
      Everything is nmi these days, remove the userspace bits so that
      the kernel can drop the interface.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      29c28102
  2. 02 6月, 2009 15 次提交
    • I
      perf report: Clean up the default output · 4593bba8
      Ingo Molnar 提交于
       - extra space between columns
       - left-aligned the symbol column
       - moved the no-symbols printout to -v
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4593bba8
    • P
      perf_counter: tools: Better handle existing data files · 97124d5e
      Peter Zijlstra 提交于
      Provide an argument (-f) to overwrite existing data files.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      97124d5e
    • P
      perf_counter: tools: Expand the COMM,MMAP event synthesizer · f70e87d7
      Peter Zijlstra 提交于
      Include code to pre-construct mappings based on /proc,
      on system wide recording.
      
      Fix the existing code to properly fill out ->pid and ->tid.
      
      The PID should be the Thread Group ID (PIDTYPE_PID of task->group_leader)
      The TID should be the Thread ID (PIDTYPE_PID of task)
      
      Furthermore, change the default sorting of report to comm,dso for a
      better quick overview.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f70e87d7
    • P
      perf_counter: Use PID namespaces properly · 709e50cf
      Peter Zijlstra 提交于
      Stop using task_struct::pid and start using PID namespaces.
      
      PIDs will be reported in the PID namespace of the monitoring
      task at the moment of counter creation.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Eric W. Biederman <ebiederm@xmission.com>
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      709e50cf
    • P
      perf_counter: Remove unused prev_state field · bf4e0ed3
      Paul Mackerras 提交于
      This removes the prev_state field of struct perf_counter since
      it is now unused.  It was only used by the cpu migration
      counter, which doesn't use it any more.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <18979.35052.915728.626374@cargo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      bf4e0ed3
    • P
      perf_counter: Fix cpu migration counter · 3f731ca6
      Paul Mackerras 提交于
      This fixes the cpu migration software counter to count
      correctly even when contexts get swapped from one task to
      another.  Previously the cpu migration counts reported by perf
      stat were bogus, ranging from negative to several thousand for
      a single "lat_ctx 2 8 32" run.  With this patch the cpu
      migration count reported for "lat_ctx 2 8 32" is almost always
      between 35 and 44.
      
      This fixes the problem by adding a call into the perf_counter
      code from set_task_cpu when tasks are migrated.  This enables
      us to use the generic swcounter code (with some modifications)
      for the cpu migration counter.
      
      This modifies the swcounter code to allow a NULL regs pointer
      to be passed in to perf_swcounter_ctx_event() etc.  The cpu
      migration counter does this because there isn't necessarily a
      pt_regs struct for the task available.  In this case, the
      counter will not have interrupt capability - but the migration
      counter didn't have interrupt capability before, so this is no
      loss.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <18979.35006.819769.416327@cargo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      3f731ca6
    • P
      perf_counter: Initialize per-cpu context earlier on cpu up · f38b0820
      Paul Mackerras 提交于
      This arranges for perf_counter's notifier for cpu hotplug
      operations to be called earlier than the migration notifier in
      sched.c by increasing its priority to 20, compared to the 10
      for the migration notifier.  The reason for doing this is that
      a subsequent commit to convert the cpu migration counter to use
      the generic swcounter infrastructure will add a call into the
      perf_counter subsystem when tasks get migrated.  Therefore the
      perf_counter subsystem needs a chance to initialize its per-cpu
      data for the new cpu before it can get called from the
      migration code.
      
      This also adds a comment to the migration notifier noting that
      its priority needs to be lower than that of the perf_counter
      notifier.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <18981.1900.792795.836858@cargo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      f38b0820
    • M
      perf_counter tools: Fix uninitialized variable in perf-report.c · 10a28255
      Mike Galbraith 提交于
      # make prefix=/usr/local V=1
      gcc -o builtin-report.o -c -O2 -ggdb3 -Wall -Werror -Wstrict-prototypes -Wmissing-declarations -Wmissing-prototypes -std=gnu99 -Wdeclaration-after-statement   -DSHA1_HEADER='<openssl/sha.h>'  builtin-report.c
      cc1: warnings being treated as errors
      builtin-report.c: In function ‘__cmd_report’:
      builtin-report.c:626: error: ‘cwdlen’ may be used uninitialized in this function
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      LKML-Reference: <new-submission>
      10a28255
    • M
      perf_counter tools: Cleanup Makefile · c1079abd
      Mike Galbraith 提交于
      We currently build perf-stat/record etc, only to do nothing
      with them.  We also install the perf binary in two places,
      $prefix/bin and $perfexec_instdir, which appears to be for
      binaries which perf would exec were a command not linked in.
      Correct this, and comment out broken/incomplete targets dist
      and coverage.
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c1079abd
    • M
      perf_counter tools: Make .gitignore reflect perf_counter tools files · c25486c5
      Mike Galbraith 提交于
      Make .gitignore reflect perf_counter tools files so
      git status doesn't gripe about untracked files.
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c25486c5
    • A
      perf_counter tools: Add missing rb_erase in dso__delete_symbols · c8c96525
      Arnaldo Carvalho de Melo 提交于
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090601205057.GB7805@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      c8c96525
    • A
      perf_counter tools: Use hex2u64 in more places · a0055ae2
      Arnaldo Carvalho de Melo 提交于
      This has also a nice side effect, tools built on newer systems such as
      fedora 10 again work on systems with older versions of glibc:
      
      My workstation:
      
      [acme@doppio ~]$ rpm -q glibc.x86_64
      glibc-2.9-3.x86_64
      
      Test machine:
      
      [acme@emilia ~]$ rpm -q glibc.x86_64
      glibc-2.5-24
      
      Before:
      
      [acme@emilia ~]$ perf
      perf: /lib64/libc.so.6: version `GLIBC_2.7' not found (required by perf)
      [acme@emilia ~]$ nm `which perf` | grep GLIBC_2\.7
                       U __isoc99_sscanf@@GLIBC_2.7
      [acme@emilia ~]$
      
      After:
      [acme@emilia ~]$ perf
      usage: perf [--version] [--help] COMMAND [ARGS]
      
      The most commonly used perf commands are:
         record   Run a command and record its profile into perf.data
         report   Read perf.data (created by perf record) and display the
      profile
         stat     Run a command and gather performance counter statistics
         top      Run a command and profile it
      
      See 'perf help COMMAND' for more information on a specific command.
      [acme@emilia ~]$ nm `which perf` | grep GLIBC_2\.7
      [acme@emilia ~]$
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <20090601205019.GA7805@ghostprotocols.net>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a0055ae2
    • A
      perf_counter tools: Add string.[ch] · ea5cc87c
      Arnaldo Carvalho de Melo 提交于
      Add hex conversion libraries. We are going to replace sscanf()
      uses with them.
      Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      ea5cc87c
    • M
      perf_counter tools: Guard against record damaging existing files · 229c4eed
      Mike Galbraith 提交于
      Signed-off-by: NMike Galbraith <efault@gmx.de>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      229c4eed
    • I
      perf_counter: Tidy up style details · 22a4f650
      Ingo Molnar 提交于
       - whitespace fixlets
       - make local variable definitions more consistent
      
      [ Impact: cleanup ]
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      22a4f650
  3. 01 6月, 2009 1 次提交
    • P
      perf_counter: Allow software counters to count while task is not running · 880ca15a
      Paul Mackerras 提交于
      This changes perf_swcounter_match() so that per-task software
      counters can count events that occur while their associated
      task is not running.  This will allow us to use the generic
      software counter code for counting task migrations, which can
      occur while the task is not scheduled in.
      
      To do this, we have to distinguish between the situations where
      the counter is inactive because its task has been scheduled
      out, and those where the counter is inactive because it is part
      of a group that was not able to go on the PMU.  In the former
      case we want the counter to count, but not in the latter case.
      If the context is active, we have the latter case.  If the
      context is inactive then we need to know whether the counter
      was counting when the context was last active, which we can
      determine by comparing its ->tstamp_stopped timestamp with the
      context's timestamp.
      
      This also folds three checks in perf_swcounter_match, checking
      perf_event_raw(), perf_event_type() and perf_event_id()
      individually, into a single 64-bit comparison on
      counter->hw_event.config, as an optimization.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
      Cc: Marcelo Tosatti <mtosatti@redhat.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: John Kacur <jkacur@redhat.com>
      LKML-Reference: <18979.34810.259718.955621@cargo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      880ca15a