From 74cff0e2a51111fcea3a945246b3fed5083d501c Mon Sep 17 00:00:00 2001 From: Samuel Gutierrez Date: Mon, 29 Nov 2010 15:57:54 +0000 Subject: [PATCH] Update memory barriers in shared memory (sm) BTL. Fixes periodic segmentation faults when using Intel 10.0.025 or PGI 9.0-3. See #2619 for more details. Thanks Brian and George! This commit was SVN r24095. --- ompi/mca/btl/sm/btl_sm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ompi/mca/btl/sm/btl_sm.h b/ompi/mca/btl/sm/btl_sm.h index 1058b8a7f6..fabdbd4348 100644 --- a/ompi/mca/btl/sm/btl_sm.h +++ b/ompi/mca/btl/sm/btl_sm.h @@ -334,12 +334,13 @@ static inline int sm_fifo_write(void *value, sm_fifo_t *fifo) volatile void **q = (volatile void **) RELATIVE2VIRTUAL(fifo->queue); /* if there is no free slot to write, report exhausted resource */ + opal_atomic_rmb(); if ( SM_FIFO_FREE != q[fifo->head] ) return OMPI_ERR_OUT_OF_RESOURCE; /* otherwise, write to the slot and advance the head index */ - opal_atomic_rmb(); q[fifo->head] = value; + opal_atomic_wmb(); fifo->head = (fifo->head + 1) & fifo->mask; opal_atomic_wmb(); return OMPI_SUCCESS;