[PATCH v2 2/2] powerpc: kprobes: invoke handlers directly

Naveen N. Rao naveen.n.rao at linux.vnet.ibm.com
Tue Nov 22 17:25:49 AEDT 2016


On 2016/11/22 02:25PM, Masami Hiramatsu wrote:
> Hello Naveen,

Hi Masami,

> 
> On Mon, 21 Nov 2016 22:36:41 +0530
> "Naveen N. Rao" <naveen.n.rao at linux.vnet.ibm.com> wrote:
> 
> > ... rather than through notify_die(), to reduce path taken for handling
> > kprobes. Similar to commit 6f6343f53d13 ("kprobes/x86: Call exception
> > handlers directly from do_int3/do_debug").
> > 
> > While at it, rename post_kprobe_handler() to kprobe_post_handler() for
> > more uniform naming.
> > 
> > Reported-by: Masami Hiramatsu <mhiramat at kernel.org>
> > Signed-off-by: Naveen N. Rao <naveen.n.rao at linux.vnet.ibm.com>
> > ---
> > Changes since v1:
> > - Removed CONFIG_KPROBES guard in traps.c
> > - Introduce CONFIG_KPROBES guard in asm/kprobes.h to prevent conflicts when
> >   including both linux/kprobes.h as well as asm/kprobes.h
> > 
> >  arch/powerpc/include/asm/kprobes.h |  7 +++++++
> >  arch/powerpc/kernel/kprobes.c      | 29 +++++++----------------------
> >  arch/powerpc/kernel/traps.c        | 13 +++++++++++++
> >  3 files changed, 27 insertions(+), 22 deletions(-)
> > 
> > diff --git a/arch/powerpc/include/asm/kprobes.h b/arch/powerpc/include/asm/kprobes.h
> > index 2c9759bd..da30dc3 100644
> > --- a/arch/powerpc/include/asm/kprobes.h
> > +++ b/arch/powerpc/include/asm/kprobes.h
> > @@ -32,6 +32,7 @@
> >  #include <asm/probes.h>
> >  #include <asm/code-patching.h>
> >  
> > +#ifdef CONFIG_KPROBES
> >  #define  __ARCH_WANT_KPROBES_INSN_SLOT
> >  
> >  struct pt_regs;
> > @@ -127,5 +128,11 @@ struct kprobe_ctlblk {
> >  extern int kprobe_exceptions_notify(struct notifier_block *self,
> >  					unsigned long val, void *data);
> >  extern int kprobe_fault_handler(struct pt_regs *regs, int trapnr);
> > +extern int kprobe_handler(struct pt_regs *regs);
> > +extern int kprobe_post_handler(struct pt_regs *regs);
> > +#else
> > +static int kprobe_handler(struct pt_regs *regs) { return 0; }
> > +static int kprobe_post_handler(struct pt_regs *regs) { return 0; }
> 
> These should be "static inline int kprobe_...", you lost 'inline' here.
> Others are OK for me.

Ah, indeed. Good catch. Thanks.
 
Michael,
Would you be ok to make this change when applying this, if you're ok 
with the rest of the patch? If not, please let me know and I will send 
an updated version.

Thanks,
Naveen



More information about the Linuxppc-dev mailing list