]> git.baikalelectronics.ru Git - kernel.git/commit
powerpc/ftrace: Don't use copy_from_kernel_nofault() in module_trampoline_target()
authorChristophe Leroy <christophe.leroy@csgroup.eu>
Mon, 9 May 2022 05:36:19 +0000 (07:36 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 22 May 2022 05:58:27 +0000 (15:58 +1000)
commit304e0ad09e27681904ee6bf664b3605c41c68608
tree1add94d8a900bc7d7a66dbd57224511ed6e0d1af
parent3bde5aa302bc4abbdb2a573f4880c9d81a81d0b7
powerpc/ftrace: Don't use copy_from_kernel_nofault() in module_trampoline_target()

module_trampoline_target() is quite a hot path used when
activating/deactivating function tracer.

Avoid the heavy copy_from_kernel_nofault() by doing four calls
to copy_inst_from_kernel_nofault().

Use __copy_inst_from_kernel_nofault() for the 3 last calls. First call
is done to copy_from_kernel_nofault() to check address is within
kernel space. No risk to wrap out the top of kernel space because the
last page is never mapped so if address is in last page the first copy
will fails and the other ones will never be performed.

And also make it notrace just like all functions that call it.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/c55559103e014b7863161559d340e8e9484eaaa6.1652074503.git.christophe.leroy@csgroup.eu
arch/powerpc/kernel/module_32.c