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

Masami Hiramatsu mhiramat at kernel.org
Thu Nov 24 13:10:29 AEDT 2016


On Tue, 22 Nov 2016 16:23:13 +0530
"Naveen N. Rao" <naveen.n.rao at linux.vnet.ibm.com> wrote:

> On 2016/11/22 09:43PM, Michael Ellerman wrote:
> > "Naveen N. Rao" <naveen.n.rao at linux.vnet.ibm.com> writes:
> > > On 2016/11/22 02:25PM, Masami Hiramatsu wrote:
> > >> On Mon, 21 Nov 2016 22:36:41 +0530
> > >> "Naveen N. Rao" <naveen.n.rao at linux.vnet.ibm.com> wrote:
> > >> > 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?
> > 
> > Yep done.
> > 
> > Why do we still need kprobe_exceptions_notify() now that it's empty?
> > Just to keep the generic code happy?
> 
> Yup. I took a look to see if we can get rid of it, but there are other 
> architectures that need it.

FYI, x86 use it not only for hooking traps but also hooking page
protection fault in kprobe handlers. Anyway, I'd better add an weak
function for that.

Thanks!

> 
> Thanks!
> - Naveen
> 


-- 
Masami Hiramatsu <mhiramat at kernel.org>


More information about the Linuxppc-dev mailing list