• Mark Rutland's avatar
    locking/atomic: add generic arch_*() bitops · cf3ee3c8
    Mark Rutland authored
    Now that all architectures provide arch_atomic_long_*(), we can
    implement the generic bitops atop these rather than atop
    atomic_long_*(), and provide arch_*() forms of the bitops that are safe
    to use in noinstr code.
    
    Now that all architectures provide arch_atomic_long_*(), we can
    build the generic arch_*() bitops atop these, which can be safely used
    in noinstr code. The regular bitop wrappers are built atop these.
    
    As the generic non-atomic bitops use plain accesses, these will be
    implicitly instrumented unless they are inlined into noinstr functions
    (which is similar to arch_atomic*_read() when based on READ_ONCE()).
    The wrappers are modified so that where the underlying arch_*() function
    uses a plain access, no explicit instrumentation is added, as this is
    redundant and could result in confusing reports.
    
    Since function prototypes get excessively long with both an `arch_`
    prefix and `__always_inline` attribute, the return type and function
    attributes have been split onto a separate line, matching the style of
    the generated atomic headers.
    Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
    Signed-off-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
    Link: https://lore.kernel.org/r/20210713105253.7615-6-mark.rutland@arm.com
    cf3ee3c8
atomic.h 1.72 KB