diff options
author | Anju T <anju@linux.vnet.ibm.com> | 2017-02-08 10:50:52 +0100 |
---|---|---|
committer | Michael Ellerman <mpe@ellerman.id.au> | 2017-02-10 03:28:05 +0100 |
commit | 762df10bad6954b353ee649c387a8ffacf6dc347 (patch) | |
tree | 5dfc2db1b445fcd4e7124f08b45329f157e49456 /arch/powerpc/kernel/kprobes.c | |
parent | powerpc/kprobes: Implement Optprobes (diff) | |
download | linux-762df10bad6954b353ee649c387a8ffacf6dc347.tar.xz linux-762df10bad6954b353ee649c387a8ffacf6dc347.zip |
powerpc/kprobes: Optimize kprobe in kretprobe_trampoline()
Kprobe placed on the kretprobe_trampoline() during boot time can be
optimized, since the instruction at probe point is a 'nop'.
Signed-off-by: Anju T Sudhakar <anju@linux.vnet.ibm.com>
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Diffstat (limited to 'arch/powerpc/kernel/kprobes.c')
-rw-r--r-- | arch/powerpc/kernel/kprobes.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index 735ff3d3f77d..45e4f82b230d 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c @@ -285,6 +285,7 @@ asm(".global kretprobe_trampoline\n" ".type kretprobe_trampoline, @function\n" "kretprobe_trampoline:\n" "nop\n" + "blr\n" ".size kretprobe_trampoline, .-kretprobe_trampoline\n"); /* @@ -337,6 +338,13 @@ static int __kprobes trampoline_probe_handler(struct kprobe *p, kretprobe_assert(ri, orig_ret_address, trampoline_address); regs->nip = orig_ret_address; + /* + * Make LR point to the orig_ret_address. + * When the 'nop' inside the kretprobe_trampoline + * is optimized, we can do a 'blr' after executing the + * detour buffer code. + */ + regs->link = orig_ret_address; reset_current_kprobe(); kretprobe_hash_unlock(current, &flags); |