Path: blob/master/tools/memory-model/Documentation/herd-representation.txt
26285 views
#1# Legend:2# R, a Load event3# W, a Store event4# F, a Fence event5# LKR, a Lock-Read event6# LKW, a Lock-Write event7# UL, an Unlock event8# LF, a Lock-Fail event9# RL, a Read-Locked event10# RU, a Read-Unlocked event11# R*, a Load event included in RMW12# W*, a Store event included in RMW13# SRCU, a Sleepable-Read-Copy-Update event14#15# po, a Program-Order link16# rmw, a Read-Modify-Write link - every rmw link is a po link17#18# By convention, a blank line in a cell means "same as the preceding line".19#20# Note that the syntactic representation does not always match the sets and21# relations in linux-kernel.cat, due to redefinitions in linux-kernel.bell and22# lock.cat. For example, the po link between LKR and LKW is upgraded to an rmw23# link, and W[ACQUIRE] are not included in the Acquire set.24#25# Disclaimer. The table includes representations of "add" and "and" operations;26# corresponding/identical representations of "sub", "inc", "dec" and "or", "xor",27# "andnot" operations are omitted.28#29------------------------------------------------------------------------------30| C macro | Events |31------------------------------------------------------------------------------32| Non-RMW ops | |33------------------------------------------------------------------------------34| READ_ONCE | R[ONCE] |35| atomic_read | |36| WRITE_ONCE | W[ONCE] |37| atomic_set | |38| smp_load_acquire | R[ACQUIRE] |39| atomic_read_acquire | |40| smp_store_release | W[RELEASE] |41| atomic_set_release | |42| smp_store_mb | W[ONCE] ->po F[MB] |43| smp_mb | F[MB] |44| smp_rmb | F[rmb] |45| smp_wmb | F[wmb] |46| smp_mb__before_atomic | F[before-atomic] |47| smp_mb__after_atomic | F[after-atomic] |48| spin_unlock | UL |49| spin_is_locked | On success: RL |50| | On failure: RU |51| smp_mb__after_spinlock | F[after-spinlock] |52| smp_mb__after_unlock_lock | F[after-unlock-lock] |53| rcu_read_lock | F[rcu-lock] |54| rcu_read_unlock | F[rcu-unlock] |55| synchronize_rcu | F[sync-rcu] |56| rcu_dereference | R[ONCE] |57| rcu_assign_pointer | W[RELEASE] |58| srcu_read_lock | R[srcu-lock] |59| srcu_down_read | |60| srcu_read_unlock | W[srcu-unlock] |61| srcu_up_read | |62| synchronize_srcu | SRCU[sync-srcu] |63| smp_mb__after_srcu_read_unlock | F[after-srcu-read-unlock] |64------------------------------------------------------------------------------65| RMW ops w/o return value | |66------------------------------------------------------------------------------67| atomic_add | R*[NORETURN] ->rmw W*[NORETURN] |68| atomic_and | |69| spin_lock | LKR ->po LKW |70------------------------------------------------------------------------------71| RMW ops w/ return value | |72------------------------------------------------------------------------------73| atomic_add_return | R*[MB] ->rmw W*[MB] |74| atomic_fetch_add | |75| atomic_fetch_and | |76| atomic_xchg | |77| xchg | |78| atomic_add_negative | |79| atomic_add_return_relaxed | R*[ONCE] ->rmw W*[ONCE] |80| atomic_fetch_add_relaxed | |81| atomic_fetch_and_relaxed | |82| atomic_xchg_relaxed | |83| xchg_relaxed | |84| atomic_add_negative_relaxed | |85| atomic_add_return_acquire | R*[ACQUIRE] ->rmw W*[ACQUIRE] |86| atomic_fetch_add_acquire | |87| atomic_fetch_and_acquire | |88| atomic_xchg_acquire | |89| xchg_acquire | |90| atomic_add_negative_acquire | |91| atomic_add_return_release | R*[RELEASE] ->rmw W*[RELEASE] |92| atomic_fetch_add_release | |93| atomic_fetch_and_release | |94| atomic_xchg_release | |95| xchg_release | |96| atomic_add_negative_release | |97------------------------------------------------------------------------------98| Conditional RMW ops | |99------------------------------------------------------------------------------100| atomic_cmpxchg | On success: R*[MB] ->rmw W*[MB] |101| | On failure: R*[MB] |102| cmpxchg | |103| atomic_add_unless | |104| atomic_cmpxchg_relaxed | On success: R*[ONCE] ->rmw W*[ONCE] |105| | On failure: R*[ONCE] |106| atomic_cmpxchg_acquire | On success: R*[ACQUIRE] ->rmw W*[ACQUIRE] |107| | On failure: R*[ACQUIRE] |108| atomic_cmpxchg_release | On success: R*[RELEASE] ->rmw W*[RELEASE] |109| | On failure: R*[RELEASE] |110| spin_trylock | On success: LKR ->po LKW |111| | On failure: LF |112------------------------------------------------------------------------------113114115