1. 09 5月, 2007 2 次提交
  2. 21 2月, 2007 1 次提交
    • S
      [PATCH] kprobes: list all active probes in the system · 346fd59b
      Srinivasa Ds 提交于
      This patch lists all active probes in the system by scanning through
      kprobe_table[].  It takes care of aggregate handlers and prints the type of
      the probe.  Letter "k" for kprobes, "j" for jprobes, "r" for kretprobes.
      It also lists address of the instruction,its symbolic name(function name +
      offset) and the module name.  One can access this file through
      /sys/kernel/debug/kprobes/list.
      
      Output looks like this
      =====================
      llm40:~/a # cat /sys/kernel/debug/kprobes/list
      c0169ae3  r  sys_read+0x0
      c0169ae3  k  sys_read+0x0
      c01694c8  k  vfs_write+0x0
      c0167d20  r  sys_open+0x0
      f8e658a6  k  reiserfs_delete_inode+0x0  reiserfs
      c0120f4a  k  do_fork+0x0
      c0120f4a  j  do_fork+0x0
      c0169b4a  r  sys_write+0x0
      c0169b4a  k  sys_write+0x0
      c0169622  r  vfs_read+0x0
      =================================
      
      [akpm@linux-foundation.org: cleanup]
      [ananth@in.ibm.com: sparc build fix]
      Signed-off-by: NSrinivasa DS <srinivasa@in.ibm.com>
      Cc: Prasanna S Panchamukhi <prasanna@in.ibm.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Signed-off-by: NAnanth N Mavinakayanahalli <ananth@in.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      346fd59b
  3. 31 1月, 2007 1 次提交
  4. 08 12月, 2006 1 次提交
    • M
      [PATCH] kprobes: enable booster on the preemptible kernel · b4c6c34a
      Masami Hiramatsu 提交于
      When we are unregistering a kprobe-booster, we can't release its
      instruction buffer immediately on the preemptive kernel, because some
      processes might be preempted on the buffer.  The freeze_processes() and
      thaw_processes() functions can clean most of processes up from the buffer.
      There are still some non-frozen threads who have the PF_NOFREEZE flag.  If
      those threads are sleeping (not preempted) at the known place outside the
      buffer, we can ensure safety of freeing.
      
      However, the processing of this check routine takes a long time.  So, this
      patch introduces the garbage collection mechanism of insn_slot.  It also
      introduces the "dirty" flag to free_insn_slot because of efficiency.
      
      The "clean" instruction slots (dirty flag is cleared) are released
      immediately.  But the "dirty" slots which are used by boosted kprobes, are
      marked as garbages.  collect_garbage_slots() will be invoked to release
      "dirty" slots if there are more than INSNS_PER_PAGE garbage slots or if
      there are no unused slots.
      
      Cc: "Keshavamurthy, Anil S" <anil.s.keshavamurthy@intel.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: "bibo,mao" <bibo.mao@intel.com>
      Cc: Prasanna S Panchamukhi <prasanna@in.ibm.com>
      Cc: Yumiko Sugita <yumiko.sugita.yf@hitachi.com>
      Cc: Satoshi Oshima <soshima@redhat.com>
      Cc: Hideo Aoki <haoki@redhat.com>
      Signed-off-by: NMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
      Acked-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      b4c6c34a
  5. 02 10月, 2006 3 次提交
  6. 01 8月, 2006 1 次提交
  7. 27 6月, 2006 3 次提交
  8. 20 4月, 2006 1 次提交
  9. 27 3月, 2006 1 次提交
    • B
      [PATCH] kretprobe instance recycled by parent process · c6fd91f0
      bibo mao 提交于
      When kretprobe probes the schedule() function, if the probed process exits
      then schedule() will never return, so some kretprobe instances will never
      be recycled.
      
      In this patch the parent process will recycle retprobe instances of the
      probed function and there will be no memory leak of kretprobe instances.
      Signed-off-by: Nbibo mao <bibo.mao@intel.com>
      Cc: Masami Hiramatsu <hiramatu@sdl.hitachi.co.jp>
      Cc: Prasanna S Panchamukhi <prasanna@in.ibm.com>
      Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
      Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      c6fd91f0
  10. 23 3月, 2006 1 次提交
  11. 04 2月, 2006 2 次提交
  12. 12 1月, 2006 1 次提交
    • K
      [PATCH] kprobes: fix unloading of self probed module · df019b1d
      Keshavamurthy Anil S 提交于
      When a kprobes modules is written in such a way that probes are inserted on
      itself, then unload of that moudle was not possible due to reference
      couning on the same module.
      
      The below patch makes a check and incrementes the module refcount only if
      it is not a self probed module.
      
      We need to allow modules to probe themself for kprobes performance
      measurements
      
      This patch has been tested on several x86_64, ppc64 and IA64 architectures.
      
      Signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      df019b1d
  13. 11 1月, 2006 6 次提交
  14. 13 12月, 2005 3 次提交
  15. 07 11月, 2005 3 次提交
  16. 31 10月, 2005 1 次提交
    • T
      [PATCH] fix missing includes · 4e57b681
      Tim Schmielau 提交于
      I recently picked up my older work to remove unnecessary #includes of
      sched.h, starting from a patch by Dave Jones to not include sched.h
      from module.h. This reduces the number of indirect includes of sched.h
      by ~300. Another ~400 pointless direct includes can be removed after
      this disentangling (patch to follow later).
      However, quite a few indirect includes need to be fixed up for this.
      
      In order to feed the patches through -mm with as little disturbance as
      possible, I've split out the fixes I accumulated up to now (complete for
      i386 and x86_64, more archs to follow later) and post them before the real
      patch.  This way this large part of the patch is kept simple with only
      adding #includes, and all hunks are independent of each other.  So if any
      hunk rejects or gets in the way of other patches, just drop it.  My scripts
      will pick it up again in the next round.
      Signed-off-by: NTim Schmielau <tim@physik3.uni-rostock.de>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      4e57b681
  17. 08 9月, 2005 2 次提交
  18. 06 7月, 2005 1 次提交
  19. 28 6月, 2005 2 次提交
    • R
      [PATCH] Return probe redesign: architecture independent changes · 802eae7c
      Rusty Lynch 提交于
      The following is the second version of the function return probe patches
      I sent out earlier this week.  Changes since my last submission include:
      
      * Fix in ppc64 code removing an unneeded call to re-enable preemption
      * Fix a build problem in ia64 when kprobes was turned off
      * Added another BUG_ON check to each of the architecture trampoline
        handlers
      
      My initial patch description ==>
      
       From my experiences with adding return probes to x86_64 and ia64, and the
      feedback on LKML to those patches, I think we can simplify the design
      for return probes.
      
      The following patch tweaks the original design such that:
      
      * Instead of storing the stack address in the return probe instance, the
        task pointer is stored.  This gives us all we need in order to:
          - find the correct return probe instance when we enter the trampoline
            (even if we are recursing)
          - find all left-over return probe instances when the task is going away
      
        This has the side effect of simplifying the implementation since more
        work can be done in kernel/kprobes.c since architecture specific knowledge
        of the stack layout is no longer required.  Specifically, we no longer have:
      	- arch_get_kprobe_task()
      	- arch_kprobe_flush_task()
      	- get_rp_inst_tsk()
      	- get_rp_inst()
      	- trampoline_post_handler() <see next bullet>
      
      * Instead of splitting the return probe handling and cleanup logic across
        the pre and post trampoline handlers, all the work is pushed into the
        pre function (trampoline_probe_handler), and then we skip single stepping
        the original function.  In this case the original instruction to be single
        stepped was just a NOP, and we can do without the extra interruption.
      
      The new flow of events to having a return probe handler execute when a target
      function exits is:
      
      * At system initialization time, a kprobe is inserted at the beginning of
        kretprobe_trampoline.  kernel/kprobes.c use to handle this on it's own,
        but ia64 needed to do this a little differently (i.e. a function pointer
        is really a pointer to a structure containing the instruction pointer and
        a global pointer), so I added the notion of arch_init(), so that
        kernel/kprobes.c:init_kprobes() now allows architecture specific
        initialization by calling arch_init() before exiting.  Each architecture
        now registers a kprobe on it's own trampoline function.
      
      * register_kretprobe() will insert a kprobe at the beginning of the targeted
        function with the kprobe pre_handler set to arch_prepare_kretprobe
        (still no change)
      
      * When the target function is entered, the kprobe is fired, calling
        arch_prepare_kretprobe (still no change)
      
      * In arch_prepare_kretprobe() we try to get a free instance and if one is
        available then we fill out the instance with a pointer to the return probe,
        the original return address, and a pointer to the task structure (instead
        of the stack address.)  Just like before we change the return address
        to the trampoline function and mark the instance as used.
      
        If multiple return probes are registered for a given target function,
        then arch_prepare_kretprobe() will get called multiple times for the same
        task (since our kprobe implementation is able to handle multiple kprobes
        at the same address.)  Past the first call to arch_prepare_kretprobe,
        we end up with the original address stored in the return probe instance
        pointing to our trampoline function. (This is a significant difference
        from the original arch_prepare_kretprobe design.)
      
      * Target function executes like normal and then returns to kretprobe_trampoline.
      
      * kprobe inserted on the first instruction of kretprobe_trampoline is fired
        and calls trampoline_probe_handler() (no change here)
      
      * trampoline_probe_handler() consumes each of the instances associated with
        the current task by calling the registered handler function and marking
        the instance as unused until an instance is found that has a return address
        different then the trampoline function.
      
        (change similar to my previous ia64 RFC)
      
      * If the task is killed with some left-over return probe instances (meaning
        that a target function was entered, but never returned), then we just
        free any instances associated with the task.  (Not much different other
        then we can handle this without calling architecture specific functions.)
      
        There is a known problem that this patch does not yet solve where
        registering a return probe flush_old_exec or flush_thread will put us
        in a bad state.  Most likely the best way to handle this is to not allow
        registering return probes on these two functions.
      
        (Significant change)
      
      This patch series applies to the 2.6.12-rc6-mm1 kernel, and provides:
        * kernel/kprobes.c changes
        * i386 patch of existing return probes implementation
        * x86_64 patch of existing return probe implementation
        * ia64 implementation
        * ppc64 implementation (provided by Ananth)
      
      This patch implements the architecture independant changes for a reworking
      of the kprobes based function return probes design. Changes include:
      
        * Removing functions for querying a return probe instance off a stack address
        * Removing the stack_addr field from the kretprobe_instance definition,
          and adding a task pointer
        * Adding architecture specific initialization via arch_init()
        * Removing extern definitions for the architecture trampoline functions
          (this isn't needed anymore since the architecture handles the
           initialization of the kprobe in the return probe trampoline function.)
      Signed-off-by: NRusty Lynch <rusty.lynch@intel.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      802eae7c
    • A
      [PATCH] kprobes: fix single-step out of line - take2 · 9ec4b1f3
      Ananth N Mavinakayanahalli 提交于
      Now that PPC64 has no-execute support, here is a second try to fix the
      single step out of line during kprobe execution.  Kprobes on x86_64 already
      solved this problem by allocating an executable page and using it as the
      scratch area for stepping out of line.  Reuse that.
      Signed-off-by: NAnanth N Mavinakayanahalli <ananth@in.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      9ec4b1f3
  20. 24 6月, 2005 4 次提交