lkml.org 
[lkml]   [2011]   [Aug]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 5/5][RFC] kprobes: Use ftrace hooks when probing ftrace nops
On Thu, Aug 11, 2011 at 09:22:36AM -0400, Steven Rostedt wrote:
> On Thu, 2011-08-11 at 16:41 +0900, Masami Hiramatsu wrote:

...

> > > +#ifdef CONFIG_FUNCTION_TRACER
> > > +static notrace void
> > > +kprobe_ftrace_callback(unsigned long ip, unsigned long parent_ip,
> > > + struct ftrace_ops *op, struct pt_regs *pt_regs)
> > > +{
> > > + struct kprobe *p = container_of(op, struct kprobe, fops);
> > > +
> >
> > Here, we need to set up kprobe_ctlblk and some of pt_regs members,
> > ip, cs and orig_ax as optimized_callback()@arch/x86/kernel/kprobes.c
> > does.
>
> I'm curious to what this is used for? It doesn't seem to be needed for
> the generic kprobes. Because we know the probe was on a nop, there's no
> need to simulate the operation. IOW, there's no need for singlestep() or
> other gdb like operations.

It is needed to handle recursion, for instance. If in the rare case a
kprobe handler calls another routine which also has a kprobe installed
(and so on), we just bypass calling the 2nd kprobe's handlers. To do
this and to set back the original kprobe context, we track the kprobe
state in the per_cpu kprobe_ctlblk.

Ananth


\
 
 \ /
  Last update: 2011-08-12 07:49    [from the cache]
©2003-2014 Jasper Spaans. Advertise on this site