From: Ard Biesheuvel <ardb@kernel.org>
To: linux@armlinux.org.uk, linux-arm-kernel@lists.infradead.org
Cc: Ard Biesheuvel <ardb@kernel.org>, Arnd Bergmann <arnd@arndb.de>,
Linus Walleij <linus.walleij@linaro.org>,
Nick Desaulniers <ndesaulniers@google.com>
Subject: [PATCH 5/8] ARM: ftrace: avoid unnecessary literal loads
Date: Tue, 25 Jan 2022 16:36:53 +0100 [thread overview]
Message-ID: <20220125153656.1802079-6-ardb@kernel.org> (raw)
In-Reply-To: <20220125153656.1802079-1-ardb@kernel.org>
Avoid explicit literal loads and instead, use accessor macros that
generate the optimal sequence depending on the architecture revision
being targeted.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
---
arch/arm/kernel/entry-ftrace.S | 27 ++++++++------------
1 file changed, 11 insertions(+), 16 deletions(-)
diff --git a/arch/arm/kernel/entry-ftrace.S b/arch/arm/kernel/entry-ftrace.S
index 67548c38a567..99720064a4c5 100644
--- a/arch/arm/kernel/entry-ftrace.S
+++ b/arch/arm/kernel/entry-ftrace.S
@@ -35,23 +35,20 @@
.macro __mcount suffix
mcount_enter
- ldr r0, =ftrace_trace_function
- ldr r2, [r0]
+ ldr_va r2, ftrace_trace_function
badr r0, .Lftrace_stub
cmp r0, r2
bne 1f
#ifdef CONFIG_FUNCTION_GRAPH_TRACER
- ldr r1, =ftrace_graph_return
- ldr r2, [r1]
- cmp r0, r2
- bne ftrace_graph_caller\suffix
-
- ldr r1, =ftrace_graph_entry
- ldr r2, [r1]
- ldr r0, =ftrace_graph_entry_stub
- cmp r0, r2
- bne ftrace_graph_caller\suffix
+ ldr_va r2, ftrace_graph_return
+ cmp r0, r2
+ bne ftrace_graph_caller\suffix
+
+ ldr_va r2, ftrace_graph_entry
+ mov_l r0, ftrace_graph_entry_stub
+ cmp r0, r2
+ bne ftrace_graph_caller\suffix
#endif
mcount_exit
@@ -87,8 +84,7 @@
mov r3, sp @ struct pt_regs*
- ldr r2, =function_trace_op
- ldr r2, [r2] @ pointer to the current
+ ldr_va r2, function_trace_op @ pointer to the current
@ function tracing op
ldr r1, [sp, #S_LR] @ lr of instrumented func
@@ -141,8 +137,7 @@ ftrace_graph_regs_call:
mcount_adjust_addr r0, lr @ instrumented function
#ifdef CONFIG_DYNAMIC_FTRACE_WITH_REGS
- ldr r2, =function_trace_op
- ldr r2, [r2] @ pointer to the current
+ ldr_va r2, function_trace_op @ pointer to the current
@ function tracing op
mov r3, #0 @ regs is NULL
#endif
--
2.30.2
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2022-01-25 15:52 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-25 15:36 [PATCH 0/8] ARM: ftrace fixes and cleanups Ard Biesheuvel
2022-01-25 15:36 ` [PATCH 1/8] ARM: ftrace: ensure that ADR take Thumb bit into account Ard Biesheuvel
2022-01-25 19:14 ` Nick Desaulniers
2022-02-02 23:53 ` Linus Walleij
2022-01-25 15:36 ` [PATCH 2/8] ARM: ftrace: use ADD not POP to counter PUSH at entry Ard Biesheuvel
2022-01-25 19:23 ` Nick Desaulniers
2022-02-02 23:59 ` Linus Walleij
2022-01-25 15:36 ` [PATCH 3/8] ARM: ftrace: use trampolines to keep .init.text in branching range Ard Biesheuvel
2022-01-25 20:20 ` Nick Desaulniers
2022-02-03 0:12 ` Linus Walleij
2022-01-25 15:36 ` [PATCH 4/8] ARM: ftrace: avoid redundant loads or clobbering IP Ard Biesheuvel
2022-01-25 15:36 ` Ard Biesheuvel [this message]
2022-01-25 20:27 ` [PATCH 5/8] ARM: ftrace: avoid unnecessary literal loads Nick Desaulniers
2022-01-25 15:36 ` [PATCH 6/8] ARM: ftrace: enable HAVE_FUNCTION_GRAPH_FP_TEST Ard Biesheuvel
2022-01-25 15:36 ` [PATCH 7/8] ARM: unwind: track location of LR value in stack frame Ard Biesheuvel
2022-01-25 15:36 ` [PATCH 8/8] ARM: ftrace: enable the graph tracer with the EABI unwinder Ard Biesheuvel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220125153656.1802079-6-ardb@kernel.org \
--to=ardb@kernel.org \
--cc=arnd@arndb.de \
--cc=linus.walleij@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux@armlinux.org.uk \
--cc=ndesaulniers@google.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.