]> Git Repo - linux.git/commitdiff
arm64: ftrace: forbid CALL_OPS with CC_OPTIMIZE_FOR_SIZE
authorMark Rutland <[email protected]>
Mon, 27 Feb 2023 11:58:19 +0000 (11:58 +0000)
committerCatalin Marinas <[email protected]>
Tue, 28 Feb 2023 10:04:53 +0000 (10:04 +0000)
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]>
arch/arm64/Kconfig

index 71c35178e017dd9ba19d37791438ee220651ad06..f7521695a4742016313de5fb3762b7971e6de3bc 100644 (file)
@@ -188,7 +188,8 @@ config ARM64
        select HAVE_DYNAMIC_FTRACE_WITH_ARGS \
                if $(cc-option,-fpatchable-function-entry=2)
        select HAVE_DYNAMIC_FTRACE_WITH_CALL_OPS \
-               if (DYNAMIC_FTRACE_WITH_ARGS && !CFI_CLANG)
+               if (DYNAMIC_FTRACE_WITH_ARGS && !CFI_CLANG && \
+                   !CC_OPTIMIZE_FOR_SIZE)
        select FTRACE_MCOUNT_USE_PATCHABLE_FUNCTION_ENTRY \
                if DYNAMIC_FTRACE_WITH_ARGS
        select HAVE_EFFICIENT_UNALIGNED_ACCESS
This page took 0.057162 seconds and 4 git commands to generate.