locking/atomic: add generic arch_*() bitops
authorMark Rutland <mark.rutland@arm.com>
Tue, 13 Jul 2021 10:52:53 +0000 (11:52 +0100)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 16 Jul 2021 16:46:45 +0000 (18:46 +0200)
commitcf3ee3c8c29dc349b2cf52e5e72e8cb805ff5e57
tree3a341d32735ffce29fa67bc5bd0f84eb7fe2423d
parent67d1b0de258ad066e1fc85d0ceaa75e107fb45bb
locking/atomic: add generic arch_*() bitops

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: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lore.kernel.org/r/20210713105253.7615-6-mark.rutland@arm.com
include/asm-generic/bitops/atomic.h
include/asm-generic/bitops/instrumented-non-atomic.h
include/asm-generic/bitops/lock.h
include/asm-generic/bitops/non-atomic.h