X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=lib%2Flibrte_eal%2Finclude%2Fgeneric%2Frte_mcslock.h;h=9f323bd2a23ded6d3707312c608f4307c4961bb7;hb=8d63961fc7137cab823f85a50ee82779792f21e4;hp=2bef28351c427a022544891f3cc7bf34e4d36f3b;hpb=9c1e0dc39a03c95447095241eaf3764d2e0dd003;p=dpdk.git diff --git a/lib/librte_eal/include/generic/rte_mcslock.h b/lib/librte_eal/include/generic/rte_mcslock.h index 2bef28351c..9f323bd2a2 100644 --- a/lib/librte_eal/include/generic/rte_mcslock.h +++ b/lib/librte_eal/include/generic/rte_mcslock.h @@ -22,6 +22,7 @@ #include #include #include +#include /** * The rte_mcslock_t type. @@ -32,9 +33,6 @@ typedef struct rte_mcslock { } rte_mcslock_t; /** - * @warning - * @b EXPERIMENTAL: This API may change without prior notice - * * Take the MCS lock. * * @param msl @@ -45,7 +43,6 @@ typedef struct rte_mcslock { * A pointer to a new node of MCS lock. Each CPU/thread acquiring the * lock should use its 'own node'. */ -__rte_experimental static inline void rte_mcslock_lock(rte_mcslock_t **msl, rte_mcslock_t *me) { @@ -68,7 +65,14 @@ rte_mcslock_lock(rte_mcslock_t **msl, rte_mcslock_t *me) */ return; } - __atomic_store_n(&prev->next, me, __ATOMIC_RELAXED); + /* The store to me->next above should also complete before the node is + * visible to predecessor thread releasing the lock. Hence, the store + * prev->next also requires release semantics. Note that, for example, + * on ARM, the release semantics in the exchange operation is not + * strong as a release fence and is not sufficient to enforce the + * desired order here. + */ + __atomic_store_n(&prev->next, me, __ATOMIC_RELEASE); /* The while-load of me->locked should not move above the previous * store to prev->next. Otherwise it will cause a deadlock. Need a @@ -85,9 +89,6 @@ rte_mcslock_lock(rte_mcslock_t **msl, rte_mcslock_t *me) } /** - * @warning - * @b EXPERIMENTAL: This API may change without prior notice - * * Release the MCS lock. * * @param msl @@ -95,7 +96,6 @@ rte_mcslock_lock(rte_mcslock_t **msl, rte_mcslock_t *me) * @param me * A pointer to the node of MCS lock passed in rte_mcslock_lock. */ -__rte_experimental static inline void rte_mcslock_unlock(rte_mcslock_t **msl, rte_mcslock_t *me) { @@ -126,9 +126,6 @@ rte_mcslock_unlock(rte_mcslock_t **msl, rte_mcslock_t *me) } /** - * @warning - * @b EXPERIMENTAL: This API may change without prior notice - * * Try to take the lock. * * @param msl @@ -138,7 +135,6 @@ rte_mcslock_unlock(rte_mcslock_t **msl, rte_mcslock_t *me) * @return * 1 if the lock is successfully taken; 0 otherwise. */ -__rte_experimental static inline int rte_mcslock_trylock(rte_mcslock_t **msl, rte_mcslock_t *me) { @@ -159,9 +155,6 @@ rte_mcslock_trylock(rte_mcslock_t **msl, rte_mcslock_t *me) } /** - * @warning - * @b EXPERIMENTAL: This API may change without prior notice - * * Test if the lock is taken. * * @param msl @@ -169,7 +162,6 @@ rte_mcslock_trylock(rte_mcslock_t **msl, rte_mcslock_t *me) * @return * 1 if the lock is currently taken; 0 otherwise. */ -__rte_experimental static inline int rte_mcslock_is_locked(rte_mcslock_t *msl) {