[PATCH v2 3/9] ARM: optimize indirect call to handle_arch_irq for v7 cores

Arnd Bergmann arnd at arndb.de
Tue Oct 5 05:11:36 PDT 2021


On Tue, Oct 5, 2021 at 9:15 AM Ard Biesheuvel <ardb at kernel.org> wrote:
>
> The current irq_handler macro uses a literal load followed by an
> explicit assignment of lr before an indirect call, both of which are
> sub-optimal on recent ARM cores. Replace it by a mov_l call, which will
> evaluate to a movw/movt pair on v7 cores, avoiding one of the two loads,
> followed by a call to a newly introduced 'bl_m' macro, which will
> evaluate to a blx instruction on cores that support it. (Setting lr
> explicitly rather than via a bl or blx instruction confuses the return
> address prediction that modern out-of-order cores use to speculatively
> perform the function return.)
>
> Signed-off-by: Ard Biesheuvel <ardb at kernel.org>

Reviewed-by: Arnd Bergmann <arnd at arndb.de>



More information about the linux-arm-kernel mailing list