• Masami Hiramatsu's avatar
    kprobes: introduce ftrace based optimization · ae6aa16f
    Masami Hiramatsu authored
    Introduce function trace based kprobes optimization.
    
    With using ftrace optimization, kprobes on the mcount calling
    address, use ftrace's mcount call instead of breakpoint.
    Furthermore, this optimization works with preemptive kernel
    not like as current jump-based optimization. Of cource,
    this feature works only if the probe is on mcount call.
    
    Only if kprobe.break_handler is set, that probe is not
    optimized with ftrace (nor put on ftrace). The reason why this
    limitation comes is that this break_handler may be used only
    from jprobes which changes ip address (for fetching the function
    arguments), but function tracer ignores modified ip address.
    
    Changes in v2:
     - Fix ftrace_ops registering right after setting its filter.
     - Unregister ftrace_ops if there is no kprobe using.
     - Remove notrace dependency from __kprobes macro.
    
    Link: http://lkml.kernel.org/r/20120605102832.27845.63461.stgit@localhost.localdomain
    
    Cc: Thomas Gleixner <tglx@linutronix.de>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: "H. Peter Anvin" <hpa@zytor.com>
    Cc: Ananth N Mavinakayanahalli <ananth@in.ibm.com>
    Cc: "Frank Ch. Eigler" <fche@redhat.com>
    Cc: Andrew Morton <akpm@linux-foundation.org>
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Signed-off-by: default avatarMasami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
    Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
    ae6aa16f
kprobes.c 59.2 KB