1. 23 Nov, 2009 15 commits
    • Frederic Weisbecker's avatar
      perf: Add kernel side syscall events support for breakpoints · f5ffe02e
      Frederic Weisbecker authored
      Add the remaining necessary bits to support breakpoints created
      through perf syscall.
      
      We don't use the software counter interface as:
      
      - We don't need to check against recursion, this is already done
        in hardware breakpoints arch level.
      
      - We already know the perf event we are dealing with when the
        event is to be committed.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Prasad <prasad@linux.vnet.ibm.com>
      LKML-Reference: <1258987355-8751-3-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f5ffe02e
    • Frederic Weisbecker's avatar
      hw-breakpoints: Check the breakpoint params from perf tools · fdf6bc95
      Frederic Weisbecker authored
      Perf tools create perf events as disabled in the beginning.
      Breakpoints are then considered like ptrace temporary
      breakpoints, only meant to reserve a breakpoint slot until we
      get all the necessary informations from the user.
      
      In this case, we don't check the address that is breakpointed as
      it is NULL in the ptrace case.
      
      But perf tools don't have the same purpose, events are created
      disabled to wait for all events to be created before enabling
      all of them. We want to check the breakpoint parameters in this
      case.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Prasad <prasad@linux.vnet.ibm.com>
      LKML-Reference: <1258987355-8751-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      fdf6bc95
    • Frederic Weisbecker's avatar
      hw-breakpoints: Include only linux/perf_event.h from kernel part of bp headers · e6db4876
      Frederic Weisbecker authored
      As userspace only needs the breakpoints enum types from the
      breakpoints headers.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Prasad <prasad@linux.vnet.ibm.com>
      LKML-Reference: <1258987355-8751-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e6db4876
    • K.Prasad's avatar
      hw-breakpoint: Attribute authorship of hw-breakpoint related files · ba6909b7
      K.Prasad authored
      Attribute authorship to developers of hw-breakpoint related
      files.
      Signed-off-by: default avatarK.Prasad <prasad@linux.vnet.ibm.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20091123154713.GA5593@in.ibm.com>
      [ v2: moved it to latest -tip ]
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ba6909b7
    • Peter Zijlstra's avatar
      perf_events: Restore sanity to scaling land · acd1d7c1
      Peter Zijlstra authored
      It is quite possible to call update_event_times() on a context
      that isn't actually running and thereby confuse the thing.
      
      perf stat was reporting !100% scale values for software counters
      (2e2af50b perf_events: Disable events when we detach them,
      solved the worst of that, but there was still some left).
      
      The thing that happens is that because we are not self-reaping
      (we have a caring parent) there is a time between the last
      schedule (out) and having do_exit() called which will detach the
      events.
      
      This period would be accounted as enabled,!running because the
      event->state==INACTIVE, even though !event->ctx->is_active.
      
      Similar issues could have been observed by calling read() on a
      event while the attached task was not scheduled in.
      
      Solve this by teaching update_event_times() about
      ctx->is_active.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <1258984836.4531.480.camel@laptop>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      acd1d7c1
    • Peter Zijlstra's avatar
      perf_events: Undo some recursion damage · 4ed7c92d
      Peter Zijlstra authored
      Make perf_swevent_get_recursion_context return a context number
      and disable preemption.
      
      This could be used to remove the IRQ disable from the trace bit
      and index the per-cpu buffer with.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20091123103819.993226816@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      4ed7c92d
    • Peter Zijlstra's avatar
      perf_events: Fix __perf_event_exit_task() vs. update_event_times() locking · f67218c3
      Peter Zijlstra authored
      Move the update_event_times() call in __perf_event_exit_task()
      into list_del_event() because that holds the proper lock
      (ctx->lock) and seems a more natural place to do the last time
      update.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20091123103819.842455480@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f67218c3
    • Peter Zijlstra's avatar
      perf_events: Update the context time on exit · 5e942bb3
      Peter Zijlstra authored
      It appeared we did call update_event_times() on exit, but we
      failed to update the context time, which renders the former
      moot.
      
      Locking is a bit iffy, we call update_event_times under
      ctx->mutex instead of ctx->lock - the next patch fixes this.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20091123103819.764207355@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5e942bb3
    • Peter Zijlstra's avatar
      perf_events: Disable events when we detach them · 2e2af50b
      Peter Zijlstra authored
      If we leave the event in STATE_INACTIVE, any read of the event
      after the detach will increase the running count but not the
      enabled count and cause funny scaling artefacts.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20091123103819.689055515@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2e2af50b
    • Peter Zijlstra's avatar
      perf_events: Fix style nits · 6c2bfcbe
      Peter Zijlstra authored
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      LKML-Reference: <20091123103819.613427378@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6c2bfcbe
    • Peter Zijlstra's avatar
      perf_events: Undo copy/paste damage · a66a3052
      Peter Zijlstra authored
      We had two almost identical functions, avoid the duplication.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091123103819.537537928@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      a66a3052
    • Ingo Molnar's avatar
      perf_events: Optimize the swcounter hotpath · a4234bfc
      Ingo Molnar authored
      The structure init creates a bit memcpy, which shows
      up big time in perf annotate output:
      
                :      ffffffff810a859d <__perf_sw_event>:
           1.68 :      ffffffff810a859d:       55                      push   %rbp
           1.69 :      ffffffff810a859e:       41 89 fa                mov    %edi,%r10d
           0.01 :      ffffffff810a85a1:       49 89 c9                mov    %rcx,%r9
           0.00 :      ffffffff810a85a4:       31 c0                   xor    %eax,%eax
           1.71 :      ffffffff810a85a6:       b9 16 00 00 00          mov    $0x16,%ecx
           0.00 :      ffffffff810a85ab:       48 89 e5                mov    %rsp,%rbp
           0.00 :      ffffffff810a85ae:       48 83 ec 60             sub    $0x60,%rsp
           1.52 :      ffffffff810a85b2:       48 8d 7d a0             lea    -0x60(%rbp),%rdi
          85.20 :      ffffffff810a85b6:       f3 ab                   rep stos %eax,%es:(%rdi)
      
      None of the callees depends on the structure being pre-initialized,
      so only initialize ->addr. This gets rid of the memcpy overhead.
      
      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>
      a4234bfc
    • Ingo Molnar's avatar
      perf events: Do not generate function trace entries in perf code · 6e3d8330
      Ingo Molnar authored
      Decreases perf overhead when function tracing is enabled,
      by about 50%.
      
      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>
      6e3d8330
    • Simon Kaempflein's avatar
      perf record, x86: Print more intelligent error message when sampling fails · bfd45118
      Simon Kaempflein authored
      Print more accurate error message when "perf record" fails because
      there is no APIC support, on x86.
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      bfd45118
    • Michael S. Tsirkin's avatar
      perf: Use default compiler mode by default · 81516c5f
      Michael S. Tsirkin authored
      gcc with no flags typically is a sane default for systems to
      use, and looking at the running kernel is probably broken for
      cross-builds anyway, so let's not do this.  Add EXTRA_CFLAGS so
      that users can override default gcc mode if they want to.
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Acked-by: default avatarArjan van de Ven <arjan@infradead.org>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091122121335.GA24254@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      81516c5f
  2. 22 Nov, 2009 12 commits
    • Arnaldo Carvalho de Melo's avatar
      perf report: Do map lookups in resolve_callchain() · 50e5095a
      Arnaldo Carvalho de Melo authored
      Bug introduced in 439d473b,
      making the initial map be used for all IPs, so that symbols
      outside this initial map would either be erroneously resolved or
      not resolve at all.
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      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: <1258909162-28496-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      50e5095a
    • Arnaldo Carvalho de Melo's avatar
      perf symbols: Show messages about module loading only if verbose >= 1 · 87f8ea4c
      Arnaldo Carvalho de Melo authored
      Suggested-by: default avatarIngo Molnar <mingo@elte.hu>
      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: <1258903301-20584-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      87f8ea4c
    • Michael S. Tsirkin's avatar
      perf tools: Suggest static libraries as well · b197c7ef
      Michael S. Tsirkin authored
      On error, suggest installing static libraries
      along with shared libraries.
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091122131311.GA24318@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b197c7ef
    • Michael S. Tsirkin's avatar
      perf tools: Add V=2 option to help debug config issues · 7baed9af
      Michael S. Tsirkin authored
      Make standard error show up on console when V=2 is set.
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <20091122112726.GC13644@redhat.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      7baed9af
    • Ingo Molnar's avatar
      perf_events: Fix modular build · 645e8cc0
      Ingo Molnar authored
      Fix:
      
        ERROR: "perf_swevent_put_recursion_context" [fs/ext4/ext4.ko] undefined!
        ERROR: "perf_swevent_get_recursion_context" [fs/ext4/ext4.ko] undefined!
      
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Jason Baron <jbaron@redhat.com>
      LKML-Reference: <1258864015-10579-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      645e8cc0
    • Pekka Enberg's avatar
      perf symbols: Fix ELF header errors during "perf kmem record" · e57cfcda
      Pekka Enberg authored
      The write_event() function in builtin-record.c writes out all
      mmap()'d DSOs including non-ELF files like GNOME resource files
      and such.
      
      Therefore, check for ELF_K_ELF in filename__read_build_id()
      before attempting to read the ELF header with gelf_getehdr().
      
      Fixes the following error messages when running "perf kmem
      record":
      
        penberg@penberg-laptop:~/src/linux/tools/perf$ perf kmem record
        ^C[ perf record: Woken up 2 times to write data ]
        [ perf record: Captured and wrote 0.753 MB perf.data (~32885 samples) ]
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
        filename__read_build_id: cannot get elf header.
      Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      LKML-Reference: <1258885784-11709-1-git-send-email-penberg@cs.helsinki.fi>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e57cfcda
    • Pekka Enberg's avatar
      perf kmem: Add --sort hit and --sort frag · f3ced7cd
      Pekka Enberg authored
      This patch adds support for "--sort hit" and "--sort frag" to
      the "perf kmem" tool. The former was already mentioned in the
      help text and the latter is useful for finding call-sites that
      exhibit worst case behavior for SLAB allocators.
      Signed-off-by: default avatarPekka Enberg <penberg@cs.helsinki.fi>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Frederic Weisbecker <fweisbec@gmail.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Eduard - Gabriel Munteanu <eduard.munteanu@linux360.ro>
      Cc: linux-mm@kvack.org <linux-mm@kvack.org>
      LKML-Reference: <1258883880-7149-1-git-send-email-penberg@cs.helsinki.fi>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f3ced7cd
    • Márton Németh's avatar
      perf_event: Remove redundant zero fill · 96b02d78
      Márton Németh authored
      The buffer is first zeroed out by memset(). Then strncpy() is
      used to fill the content. The strncpy() function also pads the
      string till the end of the specified length, which is redundant.
      The strncpy() does not ensures that the string will be properly
      closed with 0. Use strlcpy() instead.
      
      The semantic match that finds this kind of pattern is as
      follows: (http://coccinelle.lip6.fr/)
      
      // <smpl>
      @@
      expression buffer;
      expression size;
      expression str;
      @@
      	memset(buffer, 0, size);
      	...
      -	strncpy(
      +	strlcpy(
      	buffer, str, sizeof(buffer)
      	);
      @@
      expression buffer;
      expression size;
      expression str;
      @@
      	memset(&buffer, 0, size);
      	...
      -	strncpy(
      +	strlcpy(
      	&buffer, str, sizeof(buffer));
      @@
      expression buffer;
      identifier field;
      expression size;
      expression str;
      @@
      	memset(buffer, 0, size);
      	...
      -	strncpy(
      +	strlcpy(
      	buffer->field, str, sizeof(buffer->field)
      	);
      @@
      expression buffer;
      identifier field;
      expression size;
      expression str;
      @@
      	memset(&buffer, 0, size);
      	...
      -	strncpy(
      +	strlcpy(
      	buffer.field, str, sizeof(buffer.field));
      // </smpl>
      
      On strncpy() vs strlcpy() see
      http://www.gratisoft.us/todd/papers/strlcpy.html .
      Signed-off-by: default avatarMárton Németh <nm127@freemail.hu>
      Cc: Julia Lawall <julia@diku.dk>
      Cc: cocci@diku.dk
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <4B086547.5040100@freemail.hu>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      96b02d78
    • Frederic Weisbecker's avatar
      hw-breakpoints: Separate the kernel part from breakpoint headers · 5093ebad
      Frederic Weisbecker authored
      So that we can include this header from userspace tools, like
      perf tools, to get the breakpoint types and len definitions.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Prasad <prasad@linux.vnet.ibm.com>
      LKML-Reference: <1258863695-10464-4-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      5093ebad
    • Frederic Weisbecker's avatar
      hw-breakpoints: Remove x86 specific headers from core file · b3a75542
      Frederic Weisbecker authored
      Remove asm/processor.h and asm/debugreg.h as these headers are
      not used anymore in the hw-breakpoints core file.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Prasad <prasad@linux.vnet.ibm.com>
      LKML-Reference: <1258863695-10464-3-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      b3a75542
    • Frederic Weisbecker's avatar
      tracing: Forget about the NMI buffer for syscall events · 28889bf9
      Frederic Weisbecker authored
      We are never in an NMI context when we commit a syscall trace to
      perf. So just forget about the nmi buffer there.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Jason Baron <jbaron@redhat.com>
      LKML-Reference: <1258863695-10464-2-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      28889bf9
    • Frederic Weisbecker's avatar
      tracing: Use the perf recursion protection from trace event · ce71b9df
      Frederic Weisbecker authored
      When we commit a trace to perf, we first check if we are
      recursing in the same buffer so that we don't mess-up the buffer
      with a recursing trace. But later on, we do the same check from
      perf to avoid commit recursion. The recursion check is desired
      early before we touch the buffer but we want to do this check
      only once.
      
      Then export the recursion protection from perf and use it from
      the trace events before submitting a trace.
      
      v2: Put appropriate Reported-by tag
      Reported-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Jason Baron <jbaron@redhat.com>
      LKML-Reference: <1258864015-10579-1-git-send-email-fweisbec@gmail.com>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      ce71b9df
  3. 21 Nov, 2009 13 commits
    • Arnaldo Carvalho de Melo's avatar
      perf trace: Read_tracing_data should die() another day · e2561368
      Arnaldo Carvalho de Melo authored
      It better propagate errors, also if we do a simple:
      
      [root@doppio linux-2.6-tip]# perf record -R -a -f sleep 3s ;
      perf trace [ perf record: Woken up 1 times to write data ]
      [ perf record: Captured and wrote 0.182 MB perf.data (~7972 samples) ]
      Fatal: not an trace data file
      [root@doppio linux-2.6-tip]#
      
      That is what is expected, right? I.e. as we didn't specify any
      tracepoint event via -e, it should gracefully bail out and not
      SEGFAULT.
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      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: <1258821086-11521-3-git-send-email-acme@infradead.org>
      [ Fixed the error messages some more ]
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      e2561368
    • Arnaldo Carvalho de Melo's avatar
      perf symbols: Old versions of elf.h don't have NT_GNU_BUILD_ID · c12e15e7
      Arnaldo Carvalho de Melo authored
      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: <1258821086-11521-2-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      c12e15e7
    • Arnaldo Carvalho de Melo's avatar
      perf symbols: Fixup kernel_maps__fixup_end end map · 90c83218
      Arnaldo Carvalho de Melo authored
      We better call this routine after both the kernel and modules
      are loaded, because as it was if there weren't modules it would not
      be called, resulting in kernel_map->end remaining at zero, so no
      map would be found and consequently the kernel symtab wouldn't
      get loaded, i.e. no kernel symbols would be resolved.
      
      Also this fixes another case, that is when we _have_ modules,
      but the last map would have its ->end address not set before we
      loaded its symbols, which would never happen because ->end was
      not set.
      Reported-by: default avatarIngo Molnar <mingo@elte.hu>
      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: <1258821086-11521-1-git-send-email-acme@infradead.org>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      90c83218
    • Stephane Eranian's avatar
      perf_events: Fix default watermark calculation · 8904b180
      Stephane Eranian authored
      This patch fixes the default watermark value for the sampling
      buffer. With the existing calculation (watermark =
      max(PAGE_SIZE, max_size / 2)), no notification was ever received
      when the buffer was exactly 1 page. This was because you would
      never cross the threshold (there is no partial samples).
      
      In certain configuration, there was no possibilty detecting the
      problem because there was not enough space left to store the
      LOST record.In fact, there may be a more generic problem here.
      The kernel should ensure that there is alaways enough space to
      store one LOST record.
      
      This patch sets the default watermark to half the buffer size.
      With such limit, we are guaranteed to get a notification even
      with a single page buffer assuming no sample is bigger than a
      page.
      Signed-off-by: default avatarStephane Eranian <eranian@gmail.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20091120212509.344964101@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      LKML-Reference: <1256302576-6169-1-git-send-email-eranian@gmail.com>
      8904b180
    • Peter Zijlstra's avatar
      perf: Fix locking for PERF_FORMAT_GROUP · 6f10581a
      Peter Zijlstra authored
      We should hold event->child_mutex when iterating the inherited
      counters, we should hold ctx->mutex when iterating siblings.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20091120212509.251030114@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      6f10581a
    • Peter Zijlstra's avatar
      perf: Fix event scaling for inherited counters · 59ed446f
      Peter Zijlstra authored
      Properly account the full hierarchy of counters for both the
      count (we already did so) and the scale times (new).
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20091120212509.153379276@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      59ed446f
    • Peter Zijlstra's avatar
      perf: Fix time locking · 2b8988c9
      Peter Zijlstra authored
      Most sites updating ctx->time and event times do so under
      ctx->lock, make sure they all do.
      
      This was made possible by removing the __perf_event_read() call
      from __perf_event_sync_stat(), which already had this lock
      taken.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20091120212509.102316434@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      2b8988c9
    • Peter Zijlstra's avatar
      perf: Simplify __perf_event_read · 58e5ad1d
      Peter Zijlstra authored
      cpuctx is always active, task context is always active for
      current
      
      the previous condition verifies that if its a task context its
      for current, hence we can assume ctx->is_active.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20091120212509.000272254@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      58e5ad1d
    • Peter Zijlstra's avatar
      perf: Simplify __perf_event_sync_stat · 3dbebf15
      Peter Zijlstra authored
      Removes constraints from __perf_event_read() by leaving it with
      a single callsite; this callsite had ctx->lock held, the other
      one does not.
      
      Removes some superfluous code from __perf_event_sync_stat().
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20091120212508.918544317@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      3dbebf15
    • Peter Zijlstra's avatar
      perf: Optimize __perf_event_read() · f6f83785
      Peter Zijlstra authored
      Both callers actually have IRQs disabled, no need doing so
      again.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20091120212508.863685796@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f6f83785
    • Peter Zijlstra's avatar
      perf: Optimize perf_event_task_sched_out · 02ffdbc8
      Peter Zijlstra authored
      Remove an update_context_time() call from the
      perf_event_task_sched_out() path and into the branch its needed.
      
      The call was both superfluous, because __perf_event_sched_out()
      already does it, and wrong, because it was done without holding
      ctx->lock.
      
      Place it in perf_event_sync_stat(), which is the only place it
      is needed and which does already hold ctx->lock.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20091120212508.779516394@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      02ffdbc8
    • Peter Zijlstra's avatar
      perf: Fix PERF_FORMAT_GROUP scale info · abf4868b
      Peter Zijlstra authored
      As Corey reported, the total_enabled and total_running times
      could occasionally be 0, even though there were events counted.
      
      It turns out this is because we record the times before reading
      the counter while the latter updates the times.
      
      This patch corrects that.
      
      While looking at this code I found that there is a lot of
      locking iffyness around, the following patches correct most of
      that.
      Reported-by: default avatarCorey Ashford <cjashfor@linux.vnet.ibm.com>
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20091120212508.685559857@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      abf4868b
    • Peter Zijlstra's avatar
      perf: Optimize perf_event_mmap_ctx() · f6d9dd23
      Peter Zijlstra authored
      Remove a rcu_read_{,un}lock() pair and a few conditionals.
      
      We can remove the rcu_read_lock() by increasing the scope of one
      in the calling function.
      
      We can do away with the system_state check if the machine still
      boots after this patch (seems to be the case).
      
      We can do away with the list_empty() check because the bare
      list_for_each_entry_rcu() reduces to that now that we've removed
      everything else.
      Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Paul Mackerras <paulus@samba.org>
      LKML-Reference: <20091120212508.606459548@chello.nl>
      Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
      f6d9dd23