Fix ABA problem in atomic_lifo code. This is temporary solution for now. We
are looking for a better one. This commit was SVN r16091.
Этот коммит содержится в:
родитель
e82a6eec27
Коммит
140dce7614
@ -9,6 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2007 Voltaire All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -71,8 +72,10 @@ static inline opal_list_item_t* opal_atomic_lifo_push( opal_atomic_lifo_t* lifo,
|
|||||||
item->opal_list_next = lifo->opal_lifo_head;
|
item->opal_list_next = lifo->opal_lifo_head;
|
||||||
if( opal_atomic_cmpset_ptr( &(lifo->opal_lifo_head),
|
if( opal_atomic_cmpset_ptr( &(lifo->opal_lifo_head),
|
||||||
(void*)item->opal_list_next,
|
(void*)item->opal_list_next,
|
||||||
item ) )
|
item ) ) {
|
||||||
|
opal_atomic_cmpset_32((volatile int32_t*)&item->item_free, 1, 0);
|
||||||
return (opal_list_item_t*)item->opal_list_next;
|
return (opal_list_item_t*)item->opal_list_next;
|
||||||
|
}
|
||||||
/* DO some kind of pause to release the bus */
|
/* DO some kind of pause to release the bus */
|
||||||
} while( 1 );
|
} while( 1 );
|
||||||
#else
|
#else
|
||||||
@ -89,14 +92,17 @@ static inline opal_list_item_t* opal_atomic_lifo_pop( opal_atomic_lifo_t* lifo )
|
|||||||
{
|
{
|
||||||
opal_list_item_t* item;
|
opal_list_item_t* item;
|
||||||
#if OMPI_HAVE_THREAD_SUPPORT
|
#if OMPI_HAVE_THREAD_SUPPORT
|
||||||
do {
|
while((item = lifo->opal_lifo_head) != &(lifo->opal_lifo_ghost))
|
||||||
item = lifo->opal_lifo_head;
|
{
|
||||||
|
if(!opal_atomic_cmpset_32((volatile int32_t*)&item->item_free, 0, 1))
|
||||||
|
continue;
|
||||||
if( opal_atomic_cmpset_ptr( &(lifo->opal_lifo_head),
|
if( opal_atomic_cmpset_ptr( &(lifo->opal_lifo_head),
|
||||||
item,
|
item,
|
||||||
(void*)item->opal_list_next ) )
|
(void*)item->opal_list_next ) )
|
||||||
break;
|
break;
|
||||||
|
opal_atomic_cmpset_32((volatile int32_t*)&item->item_free, 1, 0);
|
||||||
/* Do some kind of pause to release the bus */
|
/* Do some kind of pause to release the bus */
|
||||||
} while( 1 );
|
}
|
||||||
#else
|
#else
|
||||||
item = lifo->opal_lifo_head;
|
item = lifo->opal_lifo_head;
|
||||||
lifo->opal_lifo_head = (opal_list_item_t*)item->opal_list_next;
|
lifo->opal_lifo_head = (opal_list_item_t*)item->opal_list_next;
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2007 Voltaire All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -55,6 +56,7 @@ OBJ_CLASS_INSTANCE(
|
|||||||
static void opal_list_item_construct(opal_list_item_t *item)
|
static void opal_list_item_construct(opal_list_item_t *item)
|
||||||
{
|
{
|
||||||
item->opal_list_next = item->opal_list_prev = NULL;
|
item->opal_list_next = item->opal_list_prev = NULL;
|
||||||
|
item->item_free = 1;
|
||||||
#if OMPI_ENABLE_DEBUG
|
#if OMPI_ENABLE_DEBUG
|
||||||
item->opal_list_item_refcount = 0;
|
item->opal_list_item_refcount = 0;
|
||||||
item->opal_list_item_belong_to = NULL;
|
item->opal_list_item_belong_to = NULL;
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
* University of Stuttgart. All rights reserved.
|
* University of Stuttgart. All rights reserved.
|
||||||
* Copyright (c) 2004-2005 The Regents of the University of California.
|
* Copyright (c) 2004-2005 The Regents of the University of California.
|
||||||
* All rights reserved.
|
* All rights reserved.
|
||||||
|
* Copyright (c) 2007 Voltaire All rights reserved.
|
||||||
* $COPYRIGHT$
|
* $COPYRIGHT$
|
||||||
*
|
*
|
||||||
* Additional copyrights may follow
|
* Additional copyrights may follow
|
||||||
@ -102,6 +103,7 @@ struct opal_list_item_t
|
|||||||
/**< Pointer to next list item */
|
/**< Pointer to next list item */
|
||||||
volatile struct opal_list_item_t *opal_list_prev;
|
volatile struct opal_list_item_t *opal_list_prev;
|
||||||
/**< Pointer to previous list item */
|
/**< Pointer to previous list item */
|
||||||
|
int32_t item_free;
|
||||||
|
|
||||||
#if OMPI_ENABLE_DEBUG
|
#if OMPI_ENABLE_DEBUG
|
||||||
/** Atomic reference count for debugging */
|
/** Atomic reference count for debugging */
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user