Skip to content

Commit

Permalink
linux-gen: ring: fix memory ordering in ring dequeue
Browse files Browse the repository at this point in the history
Acquire ordering is needed to maintain proper release consistency with
the ring enqueue operation. This issue presented itself as deadlock when
running on an ARM-based chip.

Signed-off-by: Brian Brooks <brian.brooks@linaro.org>
Reviewed-by: Bill Fischofer <bill.fischofer@linaro.org>
Signed-off-by: Maxim Uvarov <maxim.uvarov@linaro.org>
  • Loading branch information
brbrooks authored and muvarov committed Mar 22, 2017
1 parent 97b7d50 commit 7ba232f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions platform/linux-generic/include/odp_ring_internal.h
Expand Up @@ -57,7 +57,7 @@ static inline uint32_t ring_deq(ring_t *ring, uint32_t mask)

/* Move reader head. This thread owns data at the new head. */
do {
tail = odp_atomic_load_u32(&ring->w_tail);
tail = odp_atomic_load_acq_u32(&ring->w_tail);

if (head == tail)
return RING_EMPTY;
Expand Down Expand Up @@ -90,7 +90,7 @@ static inline uint32_t ring_deq_multi(ring_t *ring, uint32_t mask,

/* Move reader head. This thread owns data at the new head. */
do {
tail = odp_atomic_load_u32(&ring->w_tail);
tail = odp_atomic_load_acq_u32(&ring->w_tail);

/* Ring is empty */
if (head == tail)
Expand Down

0 comments on commit 7ba232f

Please sign in to comment.