• Andrew Murray's avatar
    arm64: atomics: avoid out-of-line ll/sc atomics · addfc386
    Andrew Murray authored
    When building for LSE atomics (CONFIG_ARM64_LSE_ATOMICS), if the hardware
    or toolchain doesn't support it the existing code will fallback to ll/sc
    atomics. It achieves this by branching from inline assembly to a function
    that is built with special compile flags. Further this results in the
    clobbering of registers even when the fallback isn't used increasing
    register pressure.
    
    Improve this by providing inline implementations of both LSE and
    ll/sc and use a static key to select between them, which allows for the
    compiler to generate better atomics code. Put the LL/SC fallback atomics
    in their own subsection to improve icache performance.
    Signed-off-by: default avatarAndrew Murray <andrew.murray@arm.com>
    Signed-off-by: default avatarWill Deacon <will@kernel.org>
    addfc386
atomic.h 6.41 KB