[RFC PATCH v2 2/9] eal: annotate spinlock and rwlock

David Marchand david.marchand at redhat.com
Thu Mar 31 11:22:41 CEST 2022


On Wed, Mar 30, 2022 at 3:50 PM David Marchand
<david.marchand at redhat.com> wrote:
> diff --git a/lib/eal/include/generic/rte_rwlock.h b/lib/eal/include/generic/rte_rwlock.h
> index da9bc3e9c0..dabbac0131 100644
> --- a/lib/eal/include/generic/rte_rwlock.h
> +++ b/lib/eal/include/generic/rte_rwlock.h

[snip]

> @@ -90,7 +92,8 @@ rte_rwlock_read_lock(rte_rwlock_t *rwl)
>   */
>  __rte_experimental
>  static inline int
> -rte_rwlock_read_trylock(rte_rwlock_t *rwl)
> +rte_rwlock_read_trylock(rte_rwlock_t *rwl) RTE_SHARED_LOCK_TRYLOCK(1, rwl)

Should be 0.

> +       RTE_NO_ANNOTATED_LOCK_CHECK
>  {
>         int32_t x;
>         int success = 0;
> @@ -114,7 +117,8 @@ rte_rwlock_read_trylock(rte_rwlock_t *rwl)
>   *   A pointer to the rwlock structure.
>   */
>  static inline void
> -rte_rwlock_read_unlock(rte_rwlock_t *rwl)
> +rte_rwlock_read_unlock(rte_rwlock_t *rwl) RTE_LOCK_RELEASES(rwl)
> +       RTE_NO_ANNOTATED_LOCK_CHECK
>  {
>         __atomic_fetch_sub(&rwl->cnt, 1, __ATOMIC_RELEASE);
>  }
> @@ -134,7 +138,8 @@ rte_rwlock_read_unlock(rte_rwlock_t *rwl)
>   */
>  __rte_experimental
>  static inline int
> -rte_rwlock_write_trylock(rte_rwlock_t *rwl)
> +rte_rwlock_write_trylock(rte_rwlock_t *rwl) RTE_EXC_LOCK_TRYLOCK(1, rwl)

Should be 0.


> +       RTE_NO_ANNOTATED_LOCK_CHECK
>  {
>         int32_t x;
>


-- 
David Marchand



More information about the dev mailing list