[PATCH] ARM: Use conditionals for CFI branches

Russell King (Oracle) linux at armlinux.org.uk
Tue Apr 30 02:23:20 PDT 2024


On Tue, Apr 30, 2024 at 11:18:55AM +0200, Ard Biesheuvel wrote:
> On Tue, 30 Apr 2024 at 10:26, Linus Walleij <linus.walleij at linaro.org> wrote:
> > diff --git a/arch/arm/mm/cache-fa.S b/arch/arm/mm/cache-fa.S
> > index db454033b76f..4a3668b52a2d 100644
> > --- a/arch/arm/mm/cache-fa.S
> > +++ b/arch/arm/mm/cache-fa.S
> > @@ -112,7 +112,9 @@ SYM_FUNC_END(fa_flush_user_cache_range)
> >   *     - end    - virtual end address
> >   */
> >  SYM_TYPED_FUNC_START(fa_coherent_kern_range)
> > +#ifdef CONFIG_CFI_CLANG /* Fallthrough if !CFI */
> 
> These functions are only called indirectly if MULTI_CACHE is enabled,
> right? If so, this could be
> 
> #if defined(CONFIG_CFI_CLANG) && defined(MULTI_CACHE)

I don't see that makes any difference. Whether or not they're called
indirectly, the symbol is the entry point to the function. If called
directly and the useless branch is there, we'll incur the overhead of
the BL instruction flushing the pipeline followed immediately by the
overhead of the B instruction flushing the pipeline again.

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!



More information about the linux-arm-kernel mailing list