summaryrefslogtreecommitdiff
path: root/arch/arm/kernel/entry-ftrace.S
diff options
context:
space:
mode:
authorArd Biesheuvel <ardb@kernel.org>2021-12-08 08:42:03 +0100
committerArd Biesheuvel <ardb@kernel.org>2022-02-09 09:12:32 +0100
commitad1c2f39fda0acb51b5a93604c5e1a703b849a7d (patch)
tree47f173a82e141c35d4afee2953ccc29497bec46f /arch/arm/kernel/entry-ftrace.S
parentdd88b03ff0c84f4bcbe1419b93a4bed429fed3be (diff)
ARM: ftrace: use ADD not POP to counter PUSH at entry
The compiler emitted hook used for ftrace consists of a PUSH {LR} to preserve the link register, followed by a branch-and-link (BL) to __gnu_mount_nc. Dynamic ftrace patches away the latter to turn the combined sequence into a NOP, using a POP {LR} instruction. This is not necessary, since the link register does not get clobbered in this case, and simply adding #4 to the stack pointer is sufficient, and avoids a memory access that may take a few cycles to resolve depending on the micro-architecture. Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Reviewed-by: Steven Rostedt (Google) <rostedt@goodmis.org>
Diffstat (limited to 'arch/arm/kernel/entry-ftrace.S')
-rw-r--r--arch/arm/kernel/entry-ftrace.S2
1 files changed, 1 insertions, 1 deletions
diff --git a/arch/arm/kernel/entry-ftrace.S b/arch/arm/kernel/entry-ftrace.S
index f4886fb6e9ba..dca12a09322a 100644
--- a/arch/arm/kernel/entry-ftrace.S
+++ b/arch/arm/kernel/entry-ftrace.S
@@ -27,7 +27,7 @@
* allows it to be clobbered in subroutines and doesn't use it to hold
* parameters.)
*
- * When using dynamic ftrace, we patch out the mcount call by a "pop {lr}"
+ * When using dynamic ftrace, we patch out the mcount call by a "add sp, #4"
* instead of the __gnu_mcount_nc call (see arch/arm/kernel/ftrace.c).
*/