1. 25 8月, 2009 2 次提交
    • P
      perf_counter: Allow sharing of output channels · a4be7c27
      Peter Zijlstra 提交于
      Provide the ability to configure a counter to send its output
      to another (already existing) counter's output stream.
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: stephane eranian <eranian@googlemail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20090819092023.980284148@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      a4be7c27
    • P
      perf_counter: Start counting time enabled when group leader gets enabled · fa289bec
      Paul Mackerras 提交于
      Currently, if a group is created where the group leader is
      initially disabled but a non-leader member is initially
      enabled, and then the leader is subsequently enabled some time
      later, the time_enabled for the non-leader member will reflect
      the whole time since it was created, not just the time since
      the leader was enabled.
      
      This is incorrect, because all of the members are effectively
      disabled while the leader is disabled, since none of the
      members can go on the PMU if the leader can't.
      
      Thus we have to update the ->tstamp_enabled for all the enabled
      group members when a group leader is enabled, so that the
      time_enabled computation only counts the time since the leader
      was enabled.
      
      Similarly, when disabling a group leader we have to update the
      time_enabled and time_running for all of the group members.
      
      Also, in update_counter_times, we have to treat a counter whose
      group leader is disabled as being disabled.
      Reported-by: NStephane Eranian <eranian@googlemail.com>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: <stable@kernel.org>
      LKML-Reference: <19091.29664.342227.445006@drongo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      fa289bec
  2. 24 8月, 2009 1 次提交
  3. 22 8月, 2009 1 次提交
    • P
      perf_counter: Fix typo in read() output generation · 4464fcaa
      Peter Zijlstra 提交于
      When you iterate a list, using the iterator is useful.
      
      Before:
      
         ID: 5
         ID: 5
         ID: 5
         ID: 5
         EVNT: 0x40088b scale: nan ID: 5 CNT: 1006252 ID: 6 CNT: 1011090 ID: 7 CNT: 1011196 ID: 8 CNT: 1011095
         EVNT: 0x40088c scale: 1.000000 ID: 5 CNT: 2003065 ID: 6 CNT: 2011671 ID: 7 CNT: 2012620 ID: 8 CNT: 2013479
         EVNT: 0x40088c scale: 1.000000 ID: 5 CNT: 3002390 ID: 6 CNT: 3015996 ID: 7 CNT: 3018019 ID: 8 CNT: 3020006
         EVNT: 0x40088b scale: 1.000000 ID: 5 CNT: 4002406 ID: 6 CNT: 4021120 ID: 7 CNT: 4024241 ID: 8 CNT: 4027059
      
      After:
      
         ID: 1
         ID: 2
         ID: 3
         ID: 4
         EVNT: 0x400889 scale: nan ID: 1 CNT: 1005270 ID: 2 CNT: 1009833 ID: 3 CNT: 1010065 ID: 4 CNT: 1010088
         EVNT: 0x400898 scale: nan ID: 1 CNT: 2001531 ID: 2 CNT: 2022309 ID: 3 CNT: 2022470 ID: 4 CNT: 2022627
         EVNT: 0x400888 scale: 0.489467 ID: 1 CNT: 3001261 ID: 2 CNT: 3027088 ID: 3 CNT: 3027941 ID: 4 CNT: 3028762
      Reported-by: Nstephane eranian <eranian@googlemail.com>
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Corey J Ashford <cjashfor@us.ibm.com>
      Cc: perfmon2-devel <perfmon2-devel@lists.sourceforge.net>
      LKML-Reference: <1250867976.7538.73.camel@twins>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4464fcaa
  4. 19 8月, 2009 2 次提交
    • P
      perf tools: Check perf.data owner · fa6963b2
      Peter Zijlstra 提交于
      Add an owner check to opening perf.data files and a switch to
      silence it.
      
      Because perf-report/perf-annotate are binary parsers reading
      another users' perf.data file could be a security risk if the
      file were explicitly engineered to trigger bugs in the parser
      (we hope of course there are non such bugs, but you never
      know).
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic 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: <20090819092023.896648538@chello.nl>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      fa6963b2
    • K
      perf tools: Make 'make html' work · b395cd8a
      Kyle McMartin 提交于
      pushd tools/perf/Documentation
      make html
      popd
      
      is failing for me...
      
          ASCIIDOC perf-annotate.html
      ERROR: unsafe: include file: /etc/asciidoc/./stylesheets/xhtml11.css
      ERROR: unsafe: include file:
      /etc/asciidoc/./stylesheets/xhtml11-manpage.css
      ERROR: unsafe: include file:
      /etc/asciidoc/./stylesheets/xhtml11-quirks.css
      make: *** [perf-annotate.html] Error 1
      
      Apparently asciidoc "unsafe" is the default mode of operation
      in practice.
      
      https://bugzilla.redhat.com/show_bug.cgi?id=506953
      
      Works tidily now.
      Signed-off-by: NKyle McMartin <kyle@redhat.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: <20090818164125.GM25206@bombadil.infradead.org>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      b395cd8a
  5. 18 8月, 2009 9 次提交
    • F
      perf tools: Save partial non-overlapping map · 6e086437
      Frederic Weisbecker 提交于
      The librarization of the thread helpers between annotate and
      report lost some perf report specifics.
      
      thread__insert_map() had its most uptodate version in perf
      report which cared about partial map overlapping. In case of
      overlap between two maps, perf annotate's version removes the
      whole old map without considering if it partially or
      absolutely overlaps the new map.
      
      We exported the odd version, change it by using the perf
      report version.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Frederic 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: <1250607843-7395-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      6e086437
    • F
      perf tools: Fix comm column adjusting · 4273b005
      Frederic Weisbecker 提交于
      The librarization of the thread helpers between annotate and
      report lost some perf report specifics.
      
      This patch fixes the thread comm column adjusting that has
      been omitted during this export.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Frederic 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: <1250604226-6852-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      4273b005
    • I
      perf annotate: Fix segmentation fault · 15f3fa4e
      Ingo Molnar 提交于
      Linus reported this perf annotate segfault:
      
              [torvalds@nehalem git]$ perf annotate unmap_vmas
              Segmentation fault
      
             	#0  map__clone (self=<value optimized out>) at builtin-annotate.c:236
             	#1  thread__fork (self=<value optimized out>) at builtin-annotate.c:372
      
      The bug here was that builtin-annotate.c was a copy of
      builtin-report.c and a threading related fix to builtin-report.c
      didnt get propagated to builtin-annotate.c ...
      Reported-by: NLinus Torvalds <torvalds@linux-foundation.org>
      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: NIngo Molnar <mingo@elte.hu>
      15f3fa4e
    • I
      perf_counter: Fix the PARISC build · f738eb1b
      Ingo Molnar 提交于
      PARISC does not build:
      
      /home/mingo/tip/kernel/perf_counter.c: In function 'perf_counter_index':
      /home/mingo/tip/kernel/perf_counter.c:2016: error: 'PERF_COUNTER_INDEX_OFFSET' undeclared (first use in this function)
      /home/mingo/tip/kernel/perf_counter.c:2016: error: (Each undeclared identifier is reported only once
      /home/mingo/tip/kernel/perf_counter.c:2016: error: for each function it appears in.)
      
      As PERF_COUNTER_INDEX_OFFSET is not defined.
      
      Now, we could define it in the architecture - but lets also provide
      a core default of 0 (which happens to be what all but one
      architecture uses at the moment).
      
      Architectures that need a different index offset should set this
      value in their asm/perf_counter.h files.
      
      Cc: Kyle McMartin <kyle@mcmartin.ca>
      Cc: Helge Deller <deller@gmx.de>
      Cc: linux-parisc@vger.kernel.org
      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: NIngo Molnar <mingo@elte.hu>
      f738eb1b
    • I
      perf tools: Remove obsolete defines · 1f18345b
      Ingo Molnar 提交于
      The _XOPEN_SOURCE* defines are not really needed on Linux and
      it's not like we'll port this to AIX ;-)
      
      The define also broke the build with gcc 4.4.1:
      
       CC util/trace-event-parse.o
       In file included from util/trace-event-parse.c:32:
       util/util.h:43:1: error: "_XOPEN_SOURCE" redefined
      
      So remove them.
      
      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: NIngo Molnar <mingo@elte.hu>
      1f18345b
    • I
      Merge branch 'master' of... · 8178d000
      Ingo Molnar 提交于
      Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/perfcounters into perfcounters/core
      8178d000
    • P
      perf_counter: powerpc: Add callchain support · 20002ded
      Paul Mackerras 提交于
      This adds support for tracing callchains for powerpc, both 32-bit
      and 64-bit, and both in the kernel and userspace, from PMU interrupt
      context.
      
      The first three entries stored for each callchain are the NIP (next
      instruction pointer), LR (link register), and the contents of the LR
      save area in the second stack frame (the first is ignored because the
      ABI convention on powerpc is that functions save their return address
      in their caller's stack frame).  Because leaf functions don't have to
      save their return address (LR value) and don't have to establish a
      stack frame, it's possible for either or both of LR and the second
      stack frame's LR save area to have valid return addresses in them.
      This is basically impossible to disambiguate without either reading
      the code or looking at auxiliary information such as CFI tables.
      Since we don't want to do either of those things at interrupt time,
      we store both LR and the second stack frame's LR save area.
      
      Once we get past the second stack frame, there is no ambiguity; all
      return addresses we get are reliable.
      
      For kernel traces, we check whether they are valid kernel instruction
      addresses and store zero instead if they are not (rather than
      omitting them, which would make it impossible for userspace to know
      which was which).  We also store zero instead of the second stack
      frame's LR save area value if it is the same as LR.
      
      For kernel traces, we check for interrupt frames, and for user traces,
      we check for signal frames.  In each case, since we're starting a new
      trace, we store a PERF_CONTEXT_KERNEL/USER marker so that userspace
      knows that the next three entries are NIP, LR and the second stack frame
      for the interrupted context.
      
      We read user memory with __get_user_inatomic.  On 64-bit, if this
      PMU interrupt occurred while interrupts are soft-disabled, and
      there is no MMU hash table entry for the page, we will get an
      -EFAULT return from __get_user_inatomic even if there is a valid
      Linux PTE for the page, since hash_page isn't reentrant.  Thus we
      have code here to read the Linux PTE and access the page via the
      kernel linear mapping.  Since 64-bit doesn't use (or need) highmem
      there is no need to do kmap_atomic.  On 32-bit, we don't do soft
      interrupt disabling, so this complication doesn't occur and there
      is no need to fall back to reading the Linux PTE, since hash_page
      (or the TLB miss handler) will get called automatically if necessary.
      
      Note that we cannot get PMU interrupts in the interval during
      context switch between switch_mm (which switches the user address
      space) and switch_to (which actually changes current to the new
      process).  On 64-bit this is because interrupts are hard-disabled
      in switch_mm and stay hard-disabled until they are soft-enabled
      later, after switch_to has returned.  So there is no possibility
      of trying to do a user stack trace when the user address space is
      not current's address space.
      Acked-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      20002ded
    • P
      powerpc: Allow perf_counters to access user memory at interrupt time · 9c1e1052
      Paul Mackerras 提交于
      This provides a mechanism to allow the perf_counters code to access
      user memory in a PMU interrupt routine.  Such an access can cause
      various kinds of interrupt: SLB miss, MMU hash table miss, segment
      table miss, or TLB miss, depending on the processor.  This commit
      only deals with 64-bit classic/server processors, which use an MMU
      hash table.  32-bit processors are already able to access user memory
      at interrupt time.  Since we don't soft-disable on 32-bit, we avoid
      the possibility of reentering hash_page or the TLB miss handlers,
      since they run with interrupts disabled.
      
      On 64-bit processors, an SLB miss interrupt on a user address will
      update the slb_cache and slb_cache_ptr fields in the paca.  This is
      OK except in the case where a PMU interrupt occurs in switch_slb,
      which also accesses those fields.  To prevent this, we hard-disable
      interrupts in switch_slb.  Interrupts are already soft-disabled at
      this point, and will get hard-enabled when they get soft-enabled
      later.
      
      This also reworks slb_flush_and_rebolt: to avoid hard-disabling twice,
      and to make sure that it clears the slb_cache_ptr when called from
      other callers than switch_slb, the existing routine is renamed to
      __slb_flush_and_rebolt, which is called by switch_slb and the new
      version of slb_flush_and_rebolt.
      
      Similarly, switch_stab (used on POWER3 and RS64 processors) gets a
      hard_irq_disable() to protect the per-cpu variables used there and
      in ste_allocate.
      
      If a MMU hashtable miss interrupt occurs, normally we would call
      hash_page to look up the Linux PTE for the address and create a HPTE.
      However, hash_page is fairly complex and takes some locks, so to
      avoid the possibility of deadlock, we check the preemption count
      to see if we are in a (pseudo-)NMI handler, and if so, we don't call
      hash_page but instead treat it like a bad access that will get
      reported up through the exception table mechanism.  An interrupt
      whose handler runs even though the interrupt occurred when
      soft-disabled (such as the PMU interrupt) is considered a pseudo-NMI
      handler, which should use nmi_enter()/nmi_exit() rather than
      irq_enter()/irq_exit().
      Acked-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      9c1e1052
    • P
      powerpc/32: Always order writes to halves of 64-bit PTEs · 1660e9d3
      Paul Mackerras 提交于
      On 32-bit systems with 64-bit PTEs, the PTEs have to be written in two
      32-bit halves.  On SMP we write the higher-order half and then the
      lower-order half, with a write barrier between the two halves, but on
      UP there was no particular ordering of the writes to the two halves.
      
      This extends the ordering that we already do on SMP to the UP case as
      well.  The reason is that with the perf_counter subsystem potentially
      accessing user memory at interrupt time to get stack traces, we have
      to be careful not to create an incorrect but apparently valid PTE even
      on UP.
      Acked-by: NBenjamin Herrenschmidt <benh@kernel.crashing.org>
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      1660e9d3
  6. 17 8月, 2009 6 次提交
    • P
      perf_counter: Check task on counter read IPI · e1ac3614
      Paul Mackerras 提交于
      In general, code in perf_counter.c that is called through an
      IPI checks, for per-task counters, that the counter's task is
      still the current task.  This is to handle the race condition
      where the cpu switches from the task we want to another task in
      the interval between sending the IPI and the IPI arriving and
      being handled on the target CPU.
      
      For some reason, __perf_counter_read is missing this check, yet
      there is no reason why the race condition can't occur.  This
      adds a check that the current task is the one we want.  If it
      isn't, we just return.  In that case the counter->count value
      should be up to date, since it will have been updated when the
      counter was scheduled out, which must have happened since the
      IPI was sent.
      
      I don't have an example of an actual failure due to this race,
      but it seems obvious that it could occur and we need to guard
      against it.
      Signed-off-by: NPaul Mackerras <paulus@samba.org>
      Acked-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      LKML-Reference: <19076.63614.277861.368125@drongo.ozlabs.ibm.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      e1ac3614
    • C
      perf: Rename perf-examples.txt to examples.txt · 2932cffc
      Carlos R. Mafra 提交于
      Rename it to examples.txt to avoid the perf-*.txt pattern in
      the Makefile, otherwise 'make doc' fails because
      perf-examples.txt is not formatted to be a man page:
      
       ERROR: perf-examples.txt: line 1: manpage document title is mandatory
      Signed-off-by: NCarlos R. Mafra <crmafra@gmail.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <new-submission>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2932cffc
    • F
      perf tools: Librarize trace_event() helper · 8f28827a
      Frederic Weisbecker 提交于
      Librarize trace_event() helper so that perf trace can use it
      too. Also clean up the debug.h includes a bit.
      
      It's not good to have it included in perf.h because it doesn't
      make it flexible against other headers it may need (headers
      that can also depend on perf.h and then create a recursive
      header dependency).
      Signed-off-by: NFrederic 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: <1250453149-664-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      8f28827a
    • F
      perf tools: Librarize sample type and attr finding from headers · 0d3a5c88
      Frederic Weisbecker 提交于
      Librarize the sample type and attr fetching from perf data file
      headers so that we can also use it from perf trace.
      Signed-off-by: NFrederic 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: <1250448997-30715-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0d3a5c88
    • F
      perf tools: Put the show mode into the event headers files · 0f25bfc8
      Frederic Weisbecker 提交于
      Annotate and report share the same flags to filter events
      considering their context (kernel, user, hypervisor).
      
      Both tools have their own definitions of these flags. Factorize
      them out into the event headers file.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Frederic 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: <1250445414-29237-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0f25bfc8
    • F
      perf tools: Factorize the dprintf definition · 2cec19d9
      Frederic Weisbecker 提交于
      We have two users of dprintf: report and annotate. Another one
      is coming with perf trace. Then factorize it into the debug
      file.
      
      While at it, rename dprintf() to dump_printf() so that it
      doesn't conflicts with its libc homograph.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Frederic 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: <1250443461-28130-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      2cec19d9
  7. 16 8月, 2009 3 次提交
    • F
      perf tools: Substract -Wformat-nonliteral from Wformat=2 in extra flags · 0d31b82d
      Frederic Weisbecker 提交于
      The soon coming perf trace needs to use printf with dynamically
      built formats.
      
      But we are using -Wformat=2 which is a shortcut for the
      following set: -Wformat -Wformat-security -Wformat-y2k
      -Wformat-nonliteral
      
      -Wformat-nonliteral warns when it can't check formats because
      they are not builtin constant strings, but we want to feature
      dynamic formats. What we want instead is Wformat=2 minus
      -Wformat-nonliteral, which is what this patch does.
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Frederic 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: <1250437927-25490-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      0d31b82d
    • I
      perf: Build with stack-protector and with -D_FORTIFY_SOURCE=2 · 35ba15b7
      Ingo Molnar 提交于
      Up our defences a bit.
      Suggested-by: NArjan van de Ven <arjan@infradead.org>
      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: NIngo Molnar <mingo@elte.hu>
      35ba15b7
    • I
      perf: Enable more compiler warnings · 83a0944f
      Ingo Molnar 提交于
      Related to a shadowed variable bug fix Valdis Kletnieks noticed
      that perf does not get built with -Wshadow, which could have
      helped us avoid the bug.
      
      So enable -Wshadow and also enable the following warnings on
      perf builds, in addition to the already enabled -Wall -Wextra
      -std=gnu99 warnings:
      
       -Wcast-align
       -Wformat=2
       -Wshadow
       -Winit-self
       -Wpacked
       -Wredundant-decls
       -Wstack-protector
       -Wstrict-aliasing=3
       -Wswitch-default
       -Wswitch-enum
       -Wno-system-headers
       -Wundef
       -Wvolatile-register-var
       -Wwrite-strings
       -Wbad-function-cast
       -Wmissing-declarations
       -Wmissing-prototypes
       -Wnested-externs
       -Wold-style-definition
       -Wstrict-prototypes
       -Wdeclaration-after-statement
      
      And change/fix the perf code to build cleanly under GCC 4.3.2.
      
      The list of warnings enablement is rather arbitrary: it's based
      on my (quick) reading of the GCC manpages and trying them on
      perf.
      
      I categorized the warnings based on individually enabling them
      and looking whether they trigger something in the perf build.
      If i liked those warnings (i.e. if they trigger for something
      that arguably could be improved) i enabled the warning.
      
      If the warnings seemed to come from language laywers spamming
      the build with tons of nuisance warnings i generally kept them
      off. Most of the sign conversion related warnings were in
      this category. (A second patch enabling some of the sign
      warnings might be welcome - sign bugs can be nasty.)
      
      I also kept warnings that seem to make sense from their manpage
      description and which produced no actual warnings on our code
      base. These warnings might still be turned off if they end up
      being a nuisance.
      
      I also left out a few warnings that are not supported in older
      compilers.
      
      [ Note that these changes might break the build on older
        compilers i did not test, or on non-x86 architectures that
        produce different warnings, so more testing would be welcome. ]
      
      Reported-by: Valdis.Kletnieks@vt.edu
      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: NIngo Molnar <mingo@elte.hu>
      83a0944f
  8. 15 8月, 2009 4 次提交
  9. 14 8月, 2009 9 次提交
  10. 13 8月, 2009 3 次提交
    • P
      perf_counter: Report the cloning task as parent on perf_counter_fork() · 94d5d1b2
      Peter Zijlstra 提交于
      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: NPekka Enberg <penberg@cs.helsinki.fi>
      Signed-off-by: NPeter 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: NIngo Molnar <mingo@elte.hu>
      94d5d1b2
    • P
      perf_counter: Fix an ipi-deadlock · 970892a9
      Peter Zijlstra 提交于
      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: NPeter 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: NIngo Molnar <mingo@elte.hu>
      970892a9
    • P
      perf: Rework/fix the whole read vs group stuff · 3dab77fb
      Peter Zijlstra 提交于
      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: NPeter 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: NIngo Molnar <mingo@elte.hu>
      3dab77fb