From aca751a9d6d1030c2a0eaecc6153888788685b9e Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 14 Jul 2015 12:12:37 -0600 Subject: [PATCH 1/2] opal/fifo: add missing memory barrier master commit open-mpi/ompi@9abccbd9fc72966173b7d876f65022a2ba5d4daa Signed-off-by: Nathan Hjelm --- opal/class/opal_fifo.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/opal/class/opal_fifo.h b/opal/class/opal_fifo.h index 8c866aa5b2..79ba5bae6b 100644 --- a/opal/class/opal_fifo.h +++ b/opal/class/opal_fifo.h @@ -189,6 +189,8 @@ static inline opal_list_item_t *opal_fifo_push_atomic (opal_fifo_t *fifo, item->opal_list_next = &fifo->opal_fifo_ghost; + opal_atomic_wmb (); + /* try to get the tail */ tail_item = opal_atomic_swap_ptr (&fifo->opal_fifo_tail.data.item, item); From 2e1767a9191dc5321f5e91d9a0b775ab083595e6 Mon Sep 17 00:00:00 2001 From: Nathan Hjelm Date: Tue, 4 Aug 2015 08:54:06 -0600 Subject: [PATCH 2/2] opal/lifo: add missing opal_atomic_wmb and remove unnecessary opal_atomic_rmb master commit open-mpi/ompi@6003a4dae148964b2fb175c7fe5e3bff03e6c9d3 Signed-off-by: Nathan Hjelm --- opal/class/opal_lifo.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/opal/class/opal_lifo.h b/opal/class/opal_lifo.h index ca66a6e9a5..2297de56c1 100644 --- a/opal/class/opal_lifo.h +++ b/opal/class/opal_lifo.h @@ -187,20 +187,22 @@ static inline opal_list_item_t *opal_lifo_pop_atomic (opal_lifo_t* lifo) { opal_list_item_t *item; while ((item = (opal_list_item_t *) lifo->opal_lifo_head.data.item) != &lifo->opal_lifo_ghost) { - opal_atomic_rmb(); - /* ensure it is safe to pop the head */ if (opal_atomic_swap_32((volatile int32_t *) &item->item_free, 1)) { continue; } + opal_atomic_wmb (); + /* try to swap out the head pointer */ if (opal_atomic_cmpset_ptr (&lifo->opal_lifo_head.data.item, item, (void *) item->opal_list_next)) { break; } + /* NTH: don't need another atomic here */ item->item_free = 0; + /* Do some kind of pause to release the bus */ }