summaryrefslogtreecommitdiffstats
path: root/arch/powerpc/kernel/optprobes.c
diff options
context:
space:
mode:
authorAnju T <anju@linux.vnet.ibm.com>2017-02-08 10:50:52 +0100
committerMichael Ellerman <mpe@ellerman.id.au>2017-02-10 03:28:05 +0100
commit762df10bad6954b353ee649c387a8ffacf6dc347 (patch)
tree5dfc2db1b445fcd4e7124f08b45329f157e49456 /arch/powerpc/kernel/optprobes.c
parentpowerpc/kprobes: Implement Optprobes (diff)
downloadlinux-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/optprobes.c')
-rw-r--r--arch/powerpc/kernel/optprobes.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/arch/powerpc/kernel/optprobes.c b/arch/powerpc/kernel/optprobes.c
index 17f4c94142d3..2282bf4e63cd 100644
--- a/arch/powerpc/kernel/optprobes.c
+++ b/arch/powerpc/kernel/optprobes.c
@@ -72,12 +72,11 @@ static unsigned long can_optimize(struct kprobe *p)
/*
* kprobe placed for kretprobe during boot time
- * is not optimizing now.
- *
- * TODO: Optimize kprobe in kretprobe_trampoline
+ * has a 'nop' instruction, which can be emulated.
+ * So further checks can be skipped.
*/
if (p->addr == (kprobe_opcode_t *)&kretprobe_trampoline)
- return 0;
+ return (unsigned long)p->addr + sizeof(kprobe_opcode_t);
/*
* We only support optimizing kernel addresses, but not