[PATCH] arm64: ftrace: forbid CALL_OPS with CC_OPTIMIZE_FOR_SIZE

Florian Fainelli f.fainelli at gmail.com
Mon Feb 27 11:56:32 PST 2023



On 2/27/2023 3:58 AM, Mark Rutland wrote:
> 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 <f.fainelli at gmail.com>
> Link: http://lore.kernel.org/linux-arm-kernel/2d9284c3-3805-402b-5423-520ced56d047@gmail.com
> Signed-off-by: Mark Rutland <mark.rutland at arm.com>
> Cc: Catalin Marinas <catalin.marinas at arm.com>
> Cc: Marc Zyngier <maz at kernel.org>
> Cc: Stefan Wahren <stefan.wahren at i2se.com>
> Cc: Steven Rostedt <rostedt at goodmis.org>
> Cc: Will Deacon <will at kernel.org>

Tested-by: Florian Fainelli <f.fainelli at gmail.com>

Thanks Mark!
-- 
Florian



More information about the linux-arm-kernel mailing list