1. 10 11月, 2009 1 次提交
    • P
      ksym_tracer: Support read accesses independent of read/write. · 676c0dbe
      Paul Mundt 提交于
      All of the infrastructure already exists to support read accesses
      for platforms that support a read access independently of read/write
      (such as in the case of the SuperH UBC). This just trivially hooks
      up the read case by itself.
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Prasad <prasad@linux.vnet.ibm.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Jan Kiszka <jan.kiszka@web.de>
      Cc: Jiri Slaby <jirislaby@gmail.com>
      Cc: Avi Kivity <avi@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      LKML-Reference: <20091109083733.GA25848@linux-sh.org>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      676c0dbe
  2. 08 11月, 2009 1 次提交
    • F
      hw-breakpoints: Rewrite the hw-breakpoints layer on top of perf events · 24f1e32c
      Frederic Weisbecker 提交于
      This patch rebase the implementation of the breakpoints API on top of
      perf events instances.
      
      Each breakpoints are now perf events that handle the
      register scheduling, thread/cpu attachment, etc..
      
      The new layering is now made as follows:
      
             ptrace       kgdb      ftrace   perf syscall
                \          |          /         /
                 \         |         /         /
                                              /
                  Core breakpoint API        /
                                            /
                           |               /
                           |              /
      
                    Breakpoints perf events
      
                           |
                           |
      
                     Breakpoints PMU ---- Debug Register constraints handling
                                          (Part of core breakpoint API)
                           |
                           |
      
                   Hardware debug registers
      
      Reasons of this rewrite:
      
      - Use the centralized/optimized pmu registers scheduling,
        implying an easier arch integration
      - More powerful register handling: perf attributes (pinned/flexible
        events, exclusive/non-exclusive, tunable period, etc...)
      
      Impact:
      
      - New perf ABI: the hardware breakpoints counters
      - Ptrace breakpoints setting remains tricky and still needs some per
        thread breakpoints references.
      
      Todo (in the order):
      
      - Support breakpoints perf counter events for perf tools (ie: implement
        perf_bpcounter_event())
      - Support from perf tools
      
      Changes in v2:
      
      - Follow the perf "event " rename
      - The ptrace regression have been fixed (ptrace breakpoint perf events
        weren't released when a task ended)
      - Drop the struct hw_breakpoint and store generic fields in
        perf_event_attr.
      - Separate core and arch specific headers, drop
        asm-generic/hw_breakpoint.h and create linux/hw_breakpoint.h
      - Use new generic len/type for breakpoint
      - Handle off case: when breakpoints api is not supported by an arch
      
      Changes in v3:
      
      - Fix broken CONFIG_KVM, we need to propagate the breakpoint api
        changes to kvm when we exit the guest and restore the bp registers
        to the host.
      
      Changes in v4:
      
      - Drop the hw_breakpoint_restore() stub as it is only used by KVM
      - EXPORT_SYMBOL_GPL hw_breakpoint_restore() as KVM can be built as a
        module
      - Restore the breakpoints unconditionally on kvm guest exit:
        TIF_DEBUG_THREAD doesn't anymore cover every cases of running
        breakpoints and vcpu->arch.switch_db_regs might not always be
        set when the guest used debug registers.
        (Waiting for a reliable optimization)
      
      Changes in v5:
      
      - Split-up the asm-generic/hw-breakpoint.h moving to
        linux/hw_breakpoint.h into a separate patch
      - Optimize the breakpoints restoring while switching from kvm guest
        to host. We only want to restore the state if we have active
        breakpoints to the host, otherwise we don't care about messed-up
        address registers.
      - Add asm/hw_breakpoint.h to Kbuild
      - Fix bad breakpoint type in trace_selftest.c
      
      Changes in v6:
      
      - Fix wrong header inclusion in trace.h (triggered a build
        error with CONFIG_FTRACE_SELFTEST
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      Cc: Prasad <prasad@linux.vnet.ibm.com>
      Cc: Alan Stern <stern@rowland.harvard.edu>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ingo Molnar <mingo@elte.hu>
      Cc: Jan Kiszka <jan.kiszka@web.de>
      Cc: Jiri Slaby <jirislaby@gmail.com>
      Cc: Li Zefan <lizf@cn.fujitsu.com>
      Cc: Avi Kivity <avi@redhat.com>
      Cc: Paul Mackerras <paulus@samba.org>
      Cc: Mike Galbraith <efault@gmx.de>
      Cc: Masami Hiramatsu <mhiramat@redhat.com>
      Cc: Paul Mundt <lethal@linux-sh.org>
      24f1e32c
  3. 07 9月, 2009 1 次提交
    • F
      tracing: Fix ring-buffer and ksym tracer merge interaction · d6a65dff
      Frederic Weisbecker 提交于
      The compiler warns us about:
      
        kernel/trace/trace_ksym.c: In function ksym_hbp_handler:
        kernel/trace/trace_ksym.c:92: attention : passing argument 1 of trace_buffer_lock_reserve from incompatible pointer type
        kernel/trace/trace_ksym.c:106: attention : passing argument 1 of trace_buffer_unlock_commit from incompatible pointer type
      
      Commit "e77405ad" (tracing: pass around ring buffer
      instead of tracer) has changed the central tracing
      APIs. And this change has updated every callsites of
      these APIs except those that aren't in tracing/core,
      such as the ksym tracer.
      
      Cc: Steven Rostedt <srostedt@redhat.com>
      Signed-off-by: NIngo Molnar <mingo@elte.hu>
      d6a65dff
  4. 24 7月, 2009 3 次提交
    • X
      tracing/ksym_tracer: support quick clear for ksym_trace_filter -- v2 · 75e33751
      Xiao Guangrong 提交于
      It's rather boring to clear symbol one by one in ksym_trace_filter
      file, so, this patch will let ksym_trace_filter file support quickly
      clear all break points. We can write "0" to this file and it will clear
      all symbols
      
      for example:
       # cat ksym_trace_filter
       ksym_filter_head:rw-
       global_trace:rw-
       # echo 0 > ksym_trace_filter
       # cat ksym_trace_filter
       #
      
      Changelog v1->v2:
      Add other ways to clear all breakpoints by writing NULL or "*:---"
      to ksym_trace_filter file base on K.Prasad's suggestion
      Signed-off-by: NXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      LKML-Reference: <4A67E092.3080202@cn.fujitsu.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      75e33751
    • X
      tracing/ksym_tracer: fix write operation of ksym_trace_filter · 8e068542
      Xiao Guangrong 提交于
      This patch fix 2 bugs:
      - fix the return value of ksym_trace_filter_write() when we want to
        clear symbol in ksym_trace_filter file
        for example:
        # echo global_trace:rw- > /debug/tracing/ksym_trace_filter
        # echo global_trace:--- > /debug/tracing/ksym_trace_filter
        -bash: echo: write error: Invalid argument
        # cat /debug/tracing/ksym_trace_filter
        #
        We want to clear 'global_trace' in ksym_trace_filter, it complain
        with "Invalid argument", but the operation is successful
      
      - the "r--" access types is not allowed, but ksym_trace_filter file think
        it OK
        for example:
        # echo ksym_tracer_mutex:r-- > ksym_trace_filter
        -bash: echo: write error: Resource temporarily unavailable
        # dmesg
        ksym_tracer request failed. Try again later!!
      
        The error occur at register_kernel_hw_breakpoint(), but It's should
        at access types parser
      Signed-off-by: NXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      LKML-Reference: <4A66863D.5090802@cn.fujitsu.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      8e068542
    • X
      tracing/ksym_tracer: fix the output of ksym tracer · d857ace1
      Xiao Guangrong 提交于
      Fix the output format of ksym tracer, make it properly aligned
      
      Befor patch:
      # tracer: ksym_tracer
      #
      #       TASK-PID      CPU#      Symbol         Type    Function
      #          |           |          |              |         |
      bash            1378  1   ksym_tracer_mutex     W  mutex_lock+0x11/0x27
      bash            1378  1   ksym_filter_head      W  process_new_ksym_entry+0xd2/0x10c
      bash            1378  1   ksym_tracer_mutex     W  mutex_unlock+0x12/0x1b
      cat             1429  0   ksym_tracer_mutex     W  mutex_lock+0x11/0x27
      
      After patch:
      # tracer: ksym_tracer
      #
      #       TASK-PID   CPU#      Symbol                    Type    Function
      #          |        |          |                        |         |
              cat-1423  [000] ksym_tracer_mutex               RW mutex_lock+0x11/0x27
              cat-1423  [000] ksym_filter_head                RW ksym_trace_filter_read+0x6e/0x10d
              cat-1423  [000] ksym_tracer_mutex               RW mutex_unlock+0x12/0x1b
              cat-1423  [000] ksym_tracer_mutex               RW mutex_lock+0x11/0x27
              cat-1423  [000] ksym_filter_head                RW ksym_trace_filter_read+0x6e/0x10d
              cat-1423  [000] ksym_tracer_mutex               RW mutex_unlock+0x12/0x1b
      Signed-off-by: NXiao Guangrong <xiaoguangrong@cn.fujitsu.com>
      LKML-Reference: <4A6685BB.2090809@cn.fujitsu.com>
      Signed-off-by: NSteven Rostedt <rostedt@goodmis.org>
      d857ace1
  5. 10 7月, 2009 8 次提交
  6. 03 6月, 2009 2 次提交
    • F
      hw-breakpoints: fix undeclared ksym_tracer_mutex · 73874005
      Frederic Weisbecker 提交于
      ksym_tracer_mutex is declared inside an #ifdef CONFIG_PROFILE_KSYM_TRACER
      section. This makes it unavailable for the hardware breakpoint tracer if it is
      configured without the breakpoint profiler.
      
      This patch fixes the following build error:
      
      kernel/trace/trace_ksym.c: In function ‘ksym_trace_filter_read’:
      kernel/trace/trace_ksym.c:226: erreur: ‘ksym_tracer_mutex’ undeclared (first use in this function)
      kernel/trace/trace_ksym.c:226: erreur: (Each undeclared identifier is reported only once
      kernel/trace/trace_ksym.c:226: erreur: for each function it appears in.)
      kernel/trace/trace_ksym.c: In function ‘ksym_trace_filter_write’:
      kernel/trace/trace_ksym.c:273: erreur: ‘ksym_tracer_mutex’ undeclared (first use in this function)
      kernel/trace/trace_ksym.c: In function ‘ksym_trace_reset’:
      kernel/trace/trace_ksym.c:335: erreur: ‘ksym_tracer_mutex’ undeclared (first use in this function)
      make[1]: *** [kernel/trace/trace_ksym.o] Erreur 1
      
      [ Impact: fix a build error ]
      Reported-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      73874005
    • K
      hw-breakpoints: ftrace plugin for kernel symbol tracing using HW Breakpoint interfaces · 0722db01
      K.Prasad 提交于
      This patch adds an ftrace plugin to detect and profile memory access over kernel
      variables. It uses HW Breakpoint interfaces to 'watch memory addresses.
      Signed-off-by: NK.Prasad <prasad@linux.vnet.ibm.com>
      Signed-off-by: NFrederic Weisbecker <fweisbec@gmail.com>
      0722db01