locking/atomic: Correct (cmp)xchg() instrumentation
authorMark Rutland <mark.rutland@arm.com>
Thu, 13 Apr 2023 16:06:44 +0000 (17:06 +0100)
committerIngo Molnar <mingo@kernel.org>
Sat, 29 Apr 2023 07:09:31 +0000 (09:09 +0200)
commitec570320b09f76d52819e60abdccf372658216b6
tree84f20c89e91ee82eab626f0d510a63a335149dc5
parent5cd4c268412f802e71b7722c3ec4638b0fe04acd
locking/atomic: Correct (cmp)xchg() instrumentation

All xchg() and cmpxchg() ops are atomic RMWs, but currently we
instrument these with instrument_atomic_write() rather than
instrument_atomic_read_write(), missing the read aspect.

Similarly, all try_cmpxchg() ops are non-atomic RMWs on *oldp, but we
instrument these accesses with instrument_atomic_write() rather than
instrument_read_write(), missing the read aspect and erroneously marking
these as atomic.

Fix the instrumentation for both points.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Link: https://lkml.kernel.org/r/20230413160644.490976-1-mark.rutland@arm.com
Cc: Linus Torvalds <torvalds@linux-foundation.org>
include/linux/atomic/atomic-instrumented.h
scripts/atomic/gen-atomic-instrumented.sh