ck_pr: Introduce ck_pr_fence_lock and fence_unlock.

These primitives are meant to be used in lock implementations
where control dependency ordering is sufficient to enforce
ordering of critical section. At the moment, this only affects
PPC. Currently, we rely on lwsync for entry into critical sections
which is insufficient. sync is rather heavy-weight, and assuming
we aren't falling victim into compiler re-ordering, isync should
be sufficient.

There is follow-up work to be done in ARM, as we may have cheaper
(but target-specialized) ISB-tricks for load-load ordering.
ck_pring
Samy Al Bahra 10 years ago
parent 787cffe9c9
commit 1537c8091d

@ -97,6 +97,8 @@ CK_PR_FENCE_EMIT(store)
CK_PR_FENCE_EMIT(memory)
CK_PR_FENCE_EMIT(acquire)
CK_PR_FENCE_EMIT(release)
CK_PR_FENCE_EMIT(lock)
CK_PR_FENCE_EMIT(unlock)
#elif defined(CK_MD_PSO)
/*
* Anything can be re-ordered with respect to stores.
@ -114,6 +116,8 @@ CK_PR_FENCE_EMIT(store)
CK_PR_FENCE_EMIT(memory)
CK_PR_FENCE_EMIT(acquire)
CK_PR_FENCE_EMIT(release)
CK_PR_FENCE_EMIT(lock)
CK_PR_FENCE_EMIT(unlock)
#elif defined(CK_MD_TSO)
/*
* Only loads are re-ordered and only with respect to
@ -131,6 +135,8 @@ CK_PR_FENCE_NOOP(store)
CK_PR_FENCE_NOOP(memory)
CK_PR_FENCE_NOOP(acquire)
CK_PR_FENCE_NOOP(release)
CK_PR_FENCE_NOOP(lock)
CK_PR_FENCE_NOOP(unlock)
#else
#error "No memory model has been defined."
#endif /* CK_MD_TSO */

@ -94,6 +94,8 @@ CK_PR_FENCE(load_store, CK_DMB)
CK_PR_FENCE(memory, CK_DMB)
CK_PR_FENCE(acquire, CK_DMB)
CK_PR_FENCE(release, CK_DMB)
CK_PR_FENCE(lock, CK_DMB)
CK_PR_FENCE(unlock, CK_DMB)
#undef CK_PR_FENCE

@ -142,6 +142,8 @@ CK_PR_FENCE(store_load)
CK_PR_FENCE(memory)
CK_PR_FENCE(acquire)
CK_PR_FENCE(release)
CK_PR_FENCE(lock)
CK_PR_FENCE(unlock)
#undef CK_PR_FENCE

@ -79,6 +79,8 @@ CK_PR_FENCE(load_store, "lwsync")
CK_PR_FENCE(memory, "sync")
CK_PR_FENCE(acquire, "lwsync")
CK_PR_FENCE(release, "lwsync")
CK_PR_FENCE(lock, "isync")
CK_PR_FENCE(unlock, "lwsync")
#undef CK_PR_FENCE

@ -82,6 +82,8 @@ CK_PR_FENCE(load_store, "lwsync")
CK_PR_FENCE(memory, "sync")
CK_PR_FENCE(acquire, "lwsync")
CK_PR_FENCE(release, "lwsync")
CK_PR_FENCE(lock, "isync")
CK_PR_FENCE(unlock, "lwsync")
#undef CK_PR_FENCE

@ -79,6 +79,8 @@ CK_PR_FENCE(load_store, "membar #LoadStore")
CK_PR_FENCE(memory, "membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad")
CK_PR_FENCE(acquire, "membar #LoadLoad | #LoadStore")
CK_PR_FENCE(release, "membar #LoadStore | #StoreStore")
CK_PR_FENCE(lock, "membar #LoadLoad | #LoadStore | #StoreStore | #StoreLoad")
CK_PR_FENCE(unlock, "membar #LoadStore | #StoreStore")
#undef CK_PR_FENCE

@ -82,6 +82,8 @@ CK_PR_FENCE(store_load, "mfence")
CK_PR_FENCE(memory, "mfence")
CK_PR_FENCE(release, "mfence")
CK_PR_FENCE(acquire, "mfence")
CK_PR_FENCE(lock, "mfence")
CK_PR_FENCE(unlock, "mfence")
#undef CK_PR_FENCE

@ -88,6 +88,8 @@ CK_PR_FENCE(store_load, "mfence")
CK_PR_FENCE(memory, "mfence")
CK_PR_FENCE(release, "mfence")
CK_PR_FENCE(acquire, "mfence")
CK_PR_FENCE(lock, "mfence")
CK_PR_FENCE(unlock, "mfence")
#undef CK_PR_FENCE

Loading…
Cancel
Save