1. 13 Aug, 2009 9 commits
    • Peter Zijlstra's avatar
      perf_counter: Report the cloning task as parent on perf_counter_fork() · 94d5d1b2
      Peter Zijlstra authored
      A bug in (9f498cc5: perf_counter: Full task tracing) makes
      profiling multi-threaded apps it go belly up.
      
      [ output as: (PID:TID):(PPID:PTID) ]
      
       # ./perf report -D | grep FORK
      0x4b0 [0x18]: PERF_EVENT_FORK: (3237:3237):(3236:3236)
      0xa10 [0x18]: PERF_EVENT_FORK: (3237:3238):(3236:3236)
      0xa70 [0x18]: PERF_EVENT_FORK: (3237:3239):(3236:3236)
      0xad0 [0x18]: PERF_EVENT_FORK: (3237:3240):(3236:3236)
      0xb18 [0x18]: PERF_EVENT_FORK: (3237:3241):(3236:3236)
      
      Shows us that the test (27d028de perf report: Update for the new
      FORK/EXIT events) in builtin-report.c:
      
              /*
               * A thread clone will have the same PID for both
               * parent and child.
               */
              if (thread == parent)
                      return 0;
      
      Will clearly fail.
      
      The problem is that perf_counter_fork() reports the actual
      parent, instead of the cloning thread.
      
      Fixing that (with the below patch), yields:
      
       # ./perf report -D | grep FORK
      0x4c8 [0x18]: PERF_EVENT_FORK: (1590:1590):(1589:1589)
      0xbd8 [0x18]: PERF_EVENT_FORK: (1590:1591):(1590:1590)
      0xc80 [0x18]: PERF_EVENT_FORK: (1590:1592):(1590:1590)
      0x3338 [0x18]: PERF_EVENT_FORK: (1590:1593):(1590:1590)
      0x66b0 [0x18]: PERF_EVENT_FORK: (1590:1594):(1590:1590)
      
      Which both makes more sense and doesn't confuse perf report
      anymore.
      Reported-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: paulus@samba.org
      Cc: Anton Blanchard <anton@samba.org>
      Cc: Arjan van de Ven <arjan@infradead.org>
      LKML-Reference: <1250172882.5241.62.camel@twins>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      94d5d1b2
    • Peter Zijlstra's avatar
      perf_counter: Fix an ipi-deadlock · 970892a9
      Peter Zijlstra authored
      perf_pending_counter() is called from IRQ context and will call
      perf_counter_disable(), however perf_counter_disable() uses
      smp_call_function_single() which doesn't fancy being used with
      IRQs disabled due to IPI deadlocks.
      
      Fix this by making it use the local __perf_counter_disable()
      call and teaching the counter_sched_out() code about pending
      disables as well.
      
      This should cover the case where a counter migrates before the
      pending queue gets processed.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Corey J Ashford <cjashfor@us.ibm.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: stephane eranian <eranian@googlemail.com>
      LKML-Reference: <20090813103655.244097721@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      970892a9
    • Peter Zijlstra's avatar
      perf: Rework/fix the whole read vs group stuff · 3dab77fb
      Peter Zijlstra authored
      Replace PERF_SAMPLE_GROUP with PERF_SAMPLE_READ and introduce
      PERF_FORMAT_GROUP to deal with group reads in a more generic
      way.
      
      This allows you to get group reads out of read() as well.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Corey J Ashford <cjashfor@us.ibm.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: stephane eranian <eranian@googlemail.com>
      LKML-Reference: <20090813103655.117411814@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3dab77fb
    • Peter Zijlstra's avatar
      perf_counter: Fix swcounter context invariance · bcfc2602
      Peter Zijlstra authored
      perf_swcounter_is_counting() uses a lock, which means we cannot
      use swcounters from NMI or when holding that particular lock,
      this is unintended.
      
      The below removes the lock, this opens up race window, but not
      worse than the swcounters already experience due to RCU
      traversal of the context in perf_swcounter_ctx_event().
      
      This also fixes the hard lockups while opening a lockdep
      tracepoint counter.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: stephane eranian <eranian@googlemail.com>
      Cc: Corey J Ashford <cjashfor@us.ibm.com>
      LKML-Reference: <1250149915.10001.66.camel@twins>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      bcfc2602
    • Arnaldo Carvalho de Melo's avatar
      perf report: Don't show unresolved DSOs and symbols when -S/-d is used · 8fd101f2
      Arnaldo Carvalho de Melo authored
      We're interested in just those symbols/DSOs, so filter out the
      unresolved ones.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <20090812211957.GE3495@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8fd101f2
    • Frederic Weisbecker's avatar
      perf tools: Add a general option to enable raw sample records · daac07b2
      Frederic Weisbecker authored
      While we can enable the perf sample records per tracepoint
      counter, we may also want to enable this option for every
      tracepoint counters to open, so that we don't need to add a
      :record flag for all of them.
      
      Add the -R, --raw-samples options for this purpose.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1250152039-7284-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      daac07b2
    • Frederic Weisbecker's avatar
      perf tools: Add a per tracepoint counter attribute to get raw sample · 3a9f131f
      Frederic Weisbecker authored
      Add a new flag field while opening a tracepoint perf counter:
      
      	-e tracepoint_subsystem:tracepoint_name:flags
      
      This is intended to be generic although for now it only supports the
      r[e[c[o[r[d]]]]] flag:
      
      	./perf record -e workqueue:workqueue_insertion:record
      	./perf record -e workqueue:workqueue_insertion:r
      
      will have the same effect: enabling the raw samples record for
      the given tracepoint counter.
      
      In the future, we may want to support further flags, separated
      by commas.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <1250152039-7284-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3a9f131f
    • Ingo Molnar's avatar
      perf_counter: Provide hw_perf_counter_setup_online() APIs · 28402971
      Ingo Molnar authored
      Provide weak aliases for hw_perf_counter_setup_online(). This is
      used by the BTS patches (for v2.6.32), but it interacts with
      fixes so propagate this upstream. (it has no effect as of yet)
      
      Also export perf_counter_output() to architecture code.
      
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      28402971
    • Arnaldo Carvalho de Melo's avatar
      perf list: Fix large list output by using the pager · 8f7a0dc5
      Arnaldo Carvalho de Melo authored
      When /sys/kernel/debug is mounted the list can be imense, so
      use the pager like the other tools.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Acked-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <20090812174459.GB3495@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      8f7a0dc5
  2. 12 Aug, 2009 6 commits
    • Ingo Molnar's avatar
      perf_counter, x86: Fix/improve apic fallback · 04da8a43
      Ingo Molnar authored
      Johannes Stezenbach reported that his Pentium-M based
      laptop does not have the local APIC enabled by default,
      and hence perfcounters do not get initialized.
      
      Add a fallback for this case: allow non-sampled counters
      and return with an error on sampled counters. This allows
      'perf stat' to work out of box - and allows 'perf top'
      and 'perf record' to fall back on a hrtimer based sampling
      method.
      
      ( Passing 'lapic' on the boot line will allow hardware
        sampling to occur - but if the APIC is disabled
        permanently by the hardware then this fallback still
        allows more systems to use perfcounters. )
      
      Also decouple perfcounter support from X86_LOCAL_APIC.
      
      -v2: fix typo breaking counters on all other systems ...
      Reported-by: default avatarJohannes Stezenbach <js@sig21.net>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      04da8a43
    • Jens Axboe's avatar
      perf record: Add missing -C option support for specifying profile cpu · 0a5ac846
      Jens Axboe authored
      perf top supports a -C for setting the profile CPU, but perf
      record does not. This adds the same option for perf record,
      allowing the user to specify a specific target profile CPU.
      Signed-off-by: default avatarJens Axboe <jens.axboe@oracle.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20090812091801.GC12579@kernel.dk>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      0a5ac846
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Fix dso__new handle() to handle deleted DSOs · 1340e6bb
      Arnaldo Carvalho de Melo authored
      It is better than showing the map addr, this way at least we
      know that we can't get the symtabs because the DSO was deleted
      (system update) while an app still used such DSO.
      
      Yeah, don't do that, but if you do, you'll figure it out
      quicker this way.
      
      [acme@doppio linux-2.6-tip]$ perf report | head -15
       # Samples: 3796
       #
       # Overhead  Command                                                        Shared Object  Symbol
       # ........  .......  ...................................................................  ......
       #
          23.55%   pidgin  /lib64/libglib-2.0.so.0.2000.4.#prelink#.Pd98lu (deleted)            [.] 0x00000000038844
          21.55%   pidgin  /lib64/libpthread-2.10.1.so.#prelink#.AFwK8Q (deleted)               [.] 0x0000000000a42d
          10.85%   pidgin  [kernel]                                                             [.] vread_hpet
           7.85%   pidgin  /lib64/libgobject-2.0.so.0.2000.4.#prelink#.o1vpU7 (deleted)         [.] 0x00000000014de8
           3.35%   pidgin  /lib64/libc-2.10.1.so (deleted)                                      [.] 0x0000000007a875
           3.19%   pidgin  /lib64/libdbus-1.so.3.4.0.#prelink#.6mwgZP (deleted)                 [.] 0x0000000001d254
           3.06%   pidgin  /usr/lib64/libgtk-x11-2.0.so.0.1600.5.#prelink#.511hAl (deleted)     [.] 0x000000002334e7
           2.90%   pidgin  /usr/lib64/libgdk-x11-2.0.so.0.1600.5.#prelink#.5qlMo1 (deleted)     [.] 0x00000000037b2d
           1.84%   pidgin  [kernel]                                                             [k] do_sys_poll
           1.45%   pidgin  /usr/lib64/libX11.so.6.2.0.#prelink#.iR59Rx (deleted)                [.] 0x0000000004c751
      [acme@doppio linux-2.6-tip]$
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Luis Claudio R. Gonçalves <lclaudio@redhat.com>
      Cc: Clark Williams <williams@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20090811200436.GA3478@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      1340e6bb
    • Arnaldo Carvalho de Melo's avatar
      perf tools: Fix fallback to cplus_demangle() when bfd_demangle() is not available · 247648e3
      Arnaldo Carvalho de Melo authored
      In old binutils we can't access bfd_demangle(), use
      cplus_demangle() just like oprofile.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Luis Claudio R. Gonçalves <lclaudio@redhat.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20090811192211.GG18061@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      247648e3
    • Arnaldo Carvalho de Melo's avatar
      perf report: Show the tid too in -D · 94a24752
      Arnaldo Carvalho de Melo authored
      This made it easier to find the firefox threading related
      bug.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20090811192138.GE18061@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      94a24752
    • Arnaldo Carvalho de Melo's avatar
      perf record: Fix .tid and .pid fill-in when synthesizing events · 2a8083f0
      Arnaldo Carvalho de Melo authored
      Noticed when trying to record events for a firefox thread. We
      were synthesizing both .tid and .pid with the pid passed via
      --pid.
      
      Fix it by reading /proc/PID/status and getting the tgid
      to use in .pid, .tid gets the specified "pid".
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: "H. Peter Anvin" <hpa@zytor.com>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Mike Galbraith <efault@gmx.de>
      LKML-Reference: <20090811192200.GF18061@ghostprotocols.net>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2a8083f0
  3. 11 Aug, 2009 2 commits
    • Ingo Molnar's avatar
      perf_counter, x86: Fix generic cache events on P6-mobile CPUs · f64ccccb
      Ingo Molnar authored
      Johannes Stezenbach reported that 'perf stat' does not count
      cache-miss and cache-references events on his Pentium-M based
      laptop.
      
      This is because we left them blank in p6_perfmon_event_map[],
      fill them in.
      Reported-by: default avatarJohannes Stezenbach <js@sig21.net>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f64ccccb
    • Ingo Molnar's avatar
      perf_counter, x86: Fix lapic printk message · 3c581a7f
      Ingo Molnar authored
      Instead of this garbled bootup on UP Pentium-M systems:
      
      [    0.015048] Performance Counters:
      [    0.016004] no Local APIC, try rebooting with lapicno PMU driver, software counters only.
      
      Print:
      
      [    0.015050] Performance Counters:
      [    0.016004] no APIC, boot with the "lapic" boot parameter to force-enable it.
      [    0.017003] no PMU driver, software counters only.
      
      Cf: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <new-submission>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3c581a7f
  4. 10 Aug, 2009 19 commits
  5. 09 Aug, 2009 4 commits