1. 24 Jun, 2010 4 commits
    • Frederic Weisbecker's avatar
      x86: Support for instruction breakpoints · f7809daf
      Frederic Weisbecker authored
      Instruction breakpoints need to have a specific length of 0 to
      be working. Bring this support but also take care the user is not
      trying to set an unsupported length, like a range breakpoint for
      example.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Prasad <prasad@linux.vnet.ibm.com>
      Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Jason Wessel <jason.wessel@windriver.com>
      f7809daf
    • Frederic Weisbecker's avatar
      x86: Set resume bit before returning from breakpoint exception · 0c4519e8
      Frederic Weisbecker authored
      Instruction breakpoints trigger before the instruction executes,
      and returning back from the breakpoint handler brings us again
      to the instruction that breakpointed. This naturally bring to
      a breakpoint recursion.
      
      To solve this, x86 has the Resume Bit trick. When the cpu flags
      have the RF flag set, the next instruction won't trigger any
      instruction breakpoint, and once this instruction is executed,
      RF is cleared back.
      
      This let's us jump back to the instruction that triggered the
      breakpoint without recursion.
      
      Use this when an instruction breakpoint triggers.
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Prasad <prasad@linux.vnet.ibm.com>
      Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Jason Wessel <jason.wessel@windriver.com>
      0c4519e8
    • Nobuhiro Iwamatsu's avatar
      perf: Fix argument of perf_arch_fetch_caller_regs · 5cfaf214
      Nobuhiro Iwamatsu authored
      "struct regs" was set to argument of perf_arch_fetch_caller_regs
      off-case. It should be "struct pt_regs".
      
      This fixes various build errors in archs that have CONFIG_PERF_EVENTS=y
      but no overriden implementation of perf_arch_fetch_caller_regs.
      
      cc1: warnings being treated as errors
      In file included from include/linux/ftrace_event.h:8,
                       from include/trace/syscall.h:6,
                       from include/linux/syscalls.h:75,
                       from arch/sh/kernel/sys_sh32.c:9:
      include/linux/perf_event.h:937: error: 'struct regs' declared inside parameter list
      include/linux/perf_event.h:937: error: its scope is only this definition or declaration, which is probably not what you want
      include/linux/perf_event.h: In function 'perf_fetch_caller_regs':
      include/linux/perf_event.h:952: error: passing argument 1 of 'perf_arch_fetch_caller_regs' from incompatible pointer type
      Signed-off-by: default avatarNobuhiro Iwamatsu <nobuhiro.iwamatsu.yj@renesas.com>
      Reported-by: default avatarStephen Rothwell <sfr@canb.auug.org.au>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: David Miller <davem@davemloft.net>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      LKML-Reference: <AANLkTinKKFKEBQrZ3Hkj-XCaMwaTqulb-XnFzqEYiFRr@mail.gmail.com>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      5cfaf214
    • Frederic Weisbecker's avatar
      hw_breakpoints: Fix per task breakpoint tracking · 45a73372
      Frederic Weisbecker authored
      Freeing a perf event can happen in several ways. A task
      calls perf_event_exit_task() right before exiting. This helper
      will detach all the events from the task context and queue their
      removal through free_event() if they are child tasks. The task
      also loses its context reference there.
      
      Releasing the breakpoint slot from the constraint table is made
      from free_event() that calls release_bp_slot(). We count the number
      of breakpoints this task is running by looking at the task's
      perf_event_ctxp and iterating through its attached events.
      But at this time, the reference to this context has been cleaned up
      already.
      
      So looking at the event->ctx instead of task->perf_event_ctxp
      to count the remaining breakpoints should solve the problem.
      At least it would for child breakpoints, but not for parent ones.
      If the parent exits before the child, it will remove all its
      events from the context but free_event() will be called later,
      on fd release time. And checking the number of breakpoints the
      task has attached to its context at this time is unreliable as all
      events have been removed from the context.
      
      To solve this, we keep track of the list of per task breakpoints.
      On top of it, we maintain our array of numbers of breakpoints used
      by the tasks. We use the context address as a task id.
      
      So, instead of looking at the number of events attached to a context,
      we walk through our list of per task breakpoints and count the number
      of breakpoints that use the same ctx than the one to be reserved or
      released from the constraint table, and update the count on top of this
      result.
      
      In the meantime it solves a bad refcounting, it also solves a warning,
      reported by Paul.
      
      Badness at /home/paulus/kernel/perf/kernel/hw_breakpoint.c:114
      NIP: c0000000000cb470 LR: c0000000000cb46c CTR: c00000000032d9b8
      REGS: c000000118e7b570 TRAP: 0700   Not tainted  (2.6.35-rc3-perf-00008-g76b0f133
      )
      MSR: 9000000000029032 <EE,ME,CE,IR,DR>  CR: 44004424  XER: 000fffff
      TASK = c0000001187dcad0[3143] 'perf' THREAD: c000000118e78000 CPU: 1
      GPR00: c0000000000cb46c c000000118e7b7f0 c0000000009866a0 0000000000000020
      GPR04: 0000000000000000 000000000000001d 0000000000000000 0000000000000001
      GPR08: c0000000009bed68 c00000000086dff8 c000000000a5bf10 0000000000000001
      GPR12: 0000000024004422 c00000000ffff200 0000000000000000 0000000000000000
      GPR16: 0000000000000000 0000000000000000 0000000000000018 00000000101150f4
      GPR20: 0000000010206b40 0000000000000000 0000000000000000 00000000101150f4
      GPR24: c0000001199090c0 0000000000000001 0000000000000000 0000000000000001
      GPR28: 0000000000000000 0000000000000000 c0000000008ec290 0000000000000000
      NIP [c0000000000cb470] .task_bp_pinned+0x5c/0x12c
      LR [c0000000000cb46c] .task_bp_pinned+0x58/0x12c
      Call Trace:
      [c000000118e7b7f0] [c0000000000cb46c] .task_bp_pinned+0x58/0x12c (unreliable)
      [c000000118e7b8a0] [c0000000000cb584] .toggle_bp_task_slot+0x44/0xe4
      [c000000118e7b940] [c0000000000cb6c8] .toggle_bp_slot+0xa4/0x164
      [c000000118e7b9f0] [c0000000000cbafc] .release_bp_slot+0x44/0x6c
      [c000000118e7ba80] [c0000000000c4178] .bp_perf_event_destroy+0x10/0x24
      [c000000118e7bb00] [c0000000000c4aec] .free_event+0x180/0x1bc
      [c000000118e7bbc0] [c0000000000c54c4] .perf_event_release_kernel+0x14c/0x170
      Reported-by: default avatarPaul Mackerras <paulus@samba.org>
      Signed-off-by: default avatarFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Prasad <prasad@linux.vnet.ibm.com>
      Cc: Mahesh Salgaonkar <mahesh@linux.vnet.ibm.com>
      Cc: Will Deacon <will.deacon@arm.com>
      Cc: Jason Wessel <jason.wessel@windriver.com>
      45a73372
  2. 18 Jun, 2010 2 commits
  3. 17 Jun, 2010 7 commits
    • Andy Isaacson's avatar
      perf session: fix error message on failure to open perf.data · 0f2c3de2
      Andy Isaacson authored
      If we cannot open our data file, print strerror(errno) for a more
      comprehensible error message; and only suggest 'perf record' on ENOENT.
      
      In particular, this fixes the nonsensical advice when:
      
          % sudo perf record sleep 1
          [ perf record: Woken up 1 times to write data ]
          [ perf record: Captured and wrote 0.009 MB perf.data (~381 samples) ]
          % perf trace
          failed to open file: perf.data  (try 'perf record' first)
          %
      
      Cc: Ingo Molnar <mingo@elte.hu>
      LPU-Reference: <20100612033615.GA24731@hexapodia.org>
      Signed-off-by: default avatarAndy Isaacson <adi@hexapodia.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      0f2c3de2
    • Andy Isaacson's avatar
      perf debug: fix hex dump partial final line · 84c104ad
      Andy Isaacson authored
      The loop counter math in trace_event was much more complicated than
      necessary, resulting in incorrectly decoding the human-readable
      portion of the partial last line of hexdump in "perf trace -D" output:
      
      .  0020:  00 00 00 00 00 00 00 00 2f 73 62 69 6e 2f 69 6e  ......../sbin/i
      .  0030:  69 74 00 00 00 00 00 00                          /sbin/i
      
      With this fixed (and simpler!) code, we get the correct output:
      
      .  0020:  00 00 00 00 00 00 00 00 2f 73 62 69 6e 2f 69 6e  ......../sbin/in
      .  0030:  69 74 00 00 00 00 00 00                          it......
      
      Cc: Ingo Molnar <mingo@elte.hu>
      LPU-Reference: <20100612024404.GA24469@hexapodia.org>
      Signed-off-by: default avatarAndy Isaacson <adi@hexapodia.org>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      84c104ad
    • Chase Douglas's avatar
      perf probe: Add kernel source path option · 9ed7e1b8
      Chase Douglas authored
      The probe plugin requires access to the source code for some operations.  The
      source code must be in the exact same location as specified by the DWARF tags,
      but sometimes the location is an absolute path that cannot be replicated by a
      normal user. This change adds the -s|--source option to allow the user to
      specify the root of the kernel source tree.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      LKML-Reference: <1276543590-10486-1-git-send-email-chase.douglas@canonical.com>
      Signed-off-by: default avatarChase Douglas <chase.douglas@canonical.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      9ed7e1b8
    • Kirill Smelkov's avatar
      perf tools: .gitignore += config.make config.make.autogen · cfc21cc6
      Kirill Smelkov authored
      These are local-configuration files and should be ignored.
      
      LKML-Reference: <1276516847-25817-1-git-send-email-kirr@landau.phys.spbu.ru>
      Signed-off-by: default avatarKirill Smelkov <kirr@landau.phys.spbu.ru>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cfc21cc6
    • Stephane Eranian's avatar
      perf record: Add option to avoid updating buildid cache · a1ac1d3c
      Stephane Eranian authored
      There are situations where there is enough information in the perf.data
      to process the samples. Updating the buildid cache may add unecessary
      overhead in terms of disk space and time (copying large elf images).
      
      A persistent option to do this already exists via the perfconfig file,
      simply do:
      
      [buildid]
      dir = /dev/null
      
      This patch provides a way to suppress builid cache updates on a per-run
      basis.  It addds a new option, -N, to perf record. Buildids are still
      generated in the perf.data file.
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <4c19ef89.93ecd80a.40dc.fffff8e9@mx.google.com>
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      a1ac1d3c
    • Eric B Munson's avatar
      perf symbols: Function descriptor symbol lookup · 70c3856b
      Eric B Munson authored
      Currently symbol resolution does not work for 64-bit programs on architectures
      that use function descriptors such as ppc64.
      
      The problem is that a symbol doesn't point to a text address, it points to a
      data area that contains (amongst other things) a pointer to the text address.
      
      We look for a section called ".opd" which is the function descriptor area. To
      create the full symbol table, when we see a symbol in the function descriptor
      section we load the first pointer and use that as the text address.
      
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      LKML-Reference: <1276523793-15422-1-git-send-email-ebmunson@us.ibm.com>
      Signed-off-by: default avatarAnton Blanchard <anton@samba.org>
      Signed-off-by: default avatarEric B Munson <ebmunson@us.ibm.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      70c3856b
    • Stephane Eranian's avatar
      perf record: Avoid synthesizing mmap() for all processes in per-thread mode · cf103a14
      Stephane Eranian authored
      A bug was introduced by commit c45c6ea2.
      
      Perf record was scanning /proc/PID to create synthetic PERF_RECOR_MMAP
      entries even though it was running in per-thread mode. There was a bogus
      check to select what mmaps to synthesize. We only need all processes in
      system-wide mode.
      
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Frédéric Weisbecker <fweisbec@gmail.com>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Stephane Eranian <eranian@google.com>
      LKML-Reference: <4c192107.4f1ee30a.4316.fffff98e@mx.google.com>
      Signed-off-by: default avatarStephane Eranian <eranian@google.com>
      Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
      cf103a14
  4. 12 Jun, 2010 1 commit
  5. 11 Jun, 2010 26 commits