[PATCH v2 2/6] riscv: ftrace: align patchable functions to 4 Byte boundary

Björn Töpel bjorn at kernel.org
Tue Aug 13 04:11:16 PDT 2024


Andy Chiu <andy.chiu at sifive.com> writes:

> We are changing ftrace code patching in order to remove dependency from
> stop_machine() and enable kernel preemption. This requires us to align
> functions entry at a 4-B align address.
>
> However, -falign-functions on older versions of GCC alone was not strong
> enoungh to align all functions. In fact, cold functions are not aligned
> after turning on optimizations. We consider this is a bug in GCC and
> turn off guess-branch-probility as a workaround to align all functions.
>
> GCC bug id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88345
>
> The option -fmin-function-alignment is able to align all functions
> properly on newer versions of gcc. So, we add a cc-option to test if
> the toolchain supports it.
>
> Suggested-by: Evgenii Shatokhin <e.shatokhin at yadro.com>
> Signed-off-by: Andy Chiu <andy.chiu at sifive.com>

Reviewed-by: Björn Töpel <bjorn at rivosinc.com>



More information about the linux-riscv mailing list