Skip to content

Commit b3f11af

Browse files
mrutland-armctmarinas
authored andcommitted
arm64: ftrace: forbid CALL_OPS with CC_OPTIMIZE_FOR_SIZE
Florian reports that when building with CONFIG_CC_OPTIMIZE_FOR_SIZE=y, he sees "Misaligned patch-site" warnings at boot, e.g. | Misaligned patch-site bcm2836_arm_irqchip_handle_irq+0x0/0x88 | WARNING: CPU: 0 PID: 0 at arch/arm64/kernel/ftrace.c:120 ftrace_call_adjust+0x4c/0x70 This is because GCC will silently ignore `-falign-functions=N` when passed `-Os`, resulting in functions not being aligned as we expect. This is a known issue, and to account for this we modified the kernel to avoid `-Os` generally. Unfortunately we forgot to account for CONFIG_CC_OPTIMIZE_FOR_SIZE. Forbid the use of CALL_OPS with CONFIG_CC_OPTIMIZE_FOR_SIZE=y to prevent this issue. All exising ftrace features will work as before, though without the performance benefit of CALL_OPS. Reported-by: Florian Fainelli <[email protected]> Link: http://lore.kernel.org/linux-arm-kernel/[email protected] Signed-off-by: Mark Rutland <[email protected]> Cc: Marc Zyngier <[email protected]> Cc: Stefan Wahren <[email protected]> Cc: Steven Rostedt <[email protected]> Cc: Will Deacon <[email protected]> Tested-by: Florian Fainelli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Catalin Marinas <[email protected]>
1 parent 1b561d3 commit b3f11af

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

arch/arm64/Kconfig

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ config ARM64
188188
select HAVE_DYNAMIC_FTRACE_WITH_ARGS \
189189
if $(cc-option,-fpatchable-function-entry=2)
190190
select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS \
191-
if (DYNAMIC_FTRACE_WITH_ARGS && !CFI_CLANG)
191+
if (DYNAMIC_FTRACE_WITH_ARGS && !CFI_CLANG && \
192+
!CC_OPTIMIZE_FOR_SIZE)
192193
select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY \
193194
if DYNAMIC_FTRACE_WITH_ARGS
194195
select HAVE_EFFICIENT_UNALIGNED_ACCESS

0 commit comments

Comments
 (0)