1
1

fix recursive lock of openib_btl->ib_lock.

This commit was SVN r9427.
Этот коммит содержится в:
Gleb Natapov 2006-03-26 15:02:43 +00:00
родитель 01a119c3c5
Коммит 590c992a7e
3 изменённых файлов: 16 добавлений и 10 удалений

Просмотреть файл

@ -183,6 +183,7 @@ struct mca_btl_openib_module_t {
opal_list_t pending_frags_lp; opal_list_t pending_frags_lp;
/**< list of pending low priority frags */ /**< list of pending low priority frags */
opal_mutex_t eager_rdma_lock;
size_t eager_rdma_frag_size; /**< length of eager frag */ size_t eager_rdma_frag_size; /**< length of eager frag */
orte_pointer_array_t *eager_rdma_buffers; /**< RDMA buffers to poll */ orte_pointer_array_t *eager_rdma_buffers; /**< RDMA buffers to poll */
uint32_t eager_rdma_buffers_count; /**< number of RDMA buffers */ uint32_t eager_rdma_buffers_count; /**< number of RDMA buffers */

Просмотреть файл

@ -579,6 +579,7 @@ mca_btl_base_module_t** mca_btl_openib_component_init(int *num_btl_modules,
mca_btl_openib_component.max_eager_rdma, mca_btl_openib_component.max_eager_rdma,
0); 0);
openib_btl->eager_rdma_buffers_count = 0; openib_btl->eager_rdma_buffers_count = 0;
OBJ_CONSTRUCT(&openib_btl->eager_rdma_lock, opal_mutex_t);
/* Initialize the rd_desc_post array for posting of rr*/ /* Initialize the rd_desc_post array for posting of rr*/
openib_btl->rd_desc_post = (struct ibv_recv_wr *) openib_btl->rd_desc_post = (struct ibv_recv_wr *)
@ -723,9 +724,9 @@ int mca_btl_openib_component_progress()
* note that low priority messages are only processed one per progress call. * note that low priority messages are only processed one per progress call.
*/ */
OPAL_THREAD_LOCK(&openib_btl->ib_lock); OPAL_THREAD_LOCK(&openib_btl->eager_rdma_lock);
c = openib_btl->eager_rdma_buffers_count; c = openib_btl->eager_rdma_buffers_count;
OPAL_THREAD_UNLOCK(&openib_btl->ib_lock); OPAL_THREAD_UNLOCK(&openib_btl->eager_rdma_lock);
for(j = 0; j < c; j++) { for(j = 0; j < c; j++) {
endpoint = endpoint =

Просмотреть файл

@ -263,6 +263,7 @@ static void mca_btl_openib_endpoint_construct(mca_btl_base_endpoint_t* endpoint)
sizeof(mca_btl_openib_eager_rdma_remote_t)); sizeof(mca_btl_openib_eager_rdma_remote_t));
memset (&endpoint->eager_rdma_local, 0, memset (&endpoint->eager_rdma_local, 0,
sizeof(mca_btl_openib_eager_rdma_local_t)); sizeof(mca_btl_openib_eager_rdma_local_t));
OBJ_CONSTRUCT(&endpoint->eager_rdma_local.lock, opal_mutex_t);
endpoint->rem_info.rem_qp_num_hp = 0; endpoint->rem_info.rem_qp_num_hp = 0;
endpoint->rem_info.rem_qp_num_lp = 0; endpoint->rem_info.rem_qp_num_lp = 0;
@ -1219,17 +1220,17 @@ void mca_btl_openib_endpoint_connect_eager_rdma(
char *buf; char *buf;
int i; int i;
OPAL_THREAD_LOCK(&endpoint->eager_rdma_local.lock);
if (endpoint->eager_rdma_local.base.pval) if (endpoint->eager_rdma_local.base.pval)
return; goto unlock_rdma_local;
OPAL_THREAD_LOCK(&openib_btl->ib_lock);
buf = openib_btl->super.btl_mpool->mpool_alloc(openib_btl->super.btl_mpool, buf = openib_btl->super.btl_mpool->mpool_alloc(openib_btl->super.btl_mpool,
openib_btl->eager_rdma_frag_size * openib_btl->eager_rdma_frag_size *
mca_btl_openib_component.eager_rdma_num, 0, 0, mca_btl_openib_component.eager_rdma_num, 0, 0,
(mca_mpool_base_registration_t**)&endpoint->eager_rdma_local.reg); (mca_mpool_base_registration_t**)&endpoint->eager_rdma_local.reg);
if(!buf) if(!buf)
goto unlock; goto unlock_rdma_local;
for(i = 0; i < mca_btl_openib_component.eager_rdma_num; i++) { for(i = 0; i < mca_btl_openib_component.eager_rdma_num; i++) {
ompi_free_list_item_t *item = (ompi_free_list_item_t *)(buf + ompi_free_list_item_t *item = (ompi_free_list_item_t *)(buf +
@ -1239,6 +1240,7 @@ void mca_btl_openib_endpoint_connect_eager_rdma(
((mca_btl_openib_frag_t*)item)->endpoint = endpoint; ((mca_btl_openib_frag_t*)item)->endpoint = endpoint;
} }
OPAL_THREAD_LOCK(&openib_btl->eager_rdma_lock);
if(orte_pointer_array_add (&endpoint->eager_rdma_index, if(orte_pointer_array_add (&endpoint->eager_rdma_index,
openib_btl->eager_rdma_buffers, endpoint) < 0) openib_btl->eager_rdma_buffers, endpoint) < 0)
goto cleanup; goto cleanup;
@ -1246,8 +1248,9 @@ void mca_btl_openib_endpoint_connect_eager_rdma(
endpoint->eager_rdma_local.base.pval = buf; endpoint->eager_rdma_local.base.pval = buf;
openib_btl->eager_rdma_buffers_count++; openib_btl->eager_rdma_buffers_count++;
if (mca_btl_openib_endpoint_send_eager_rdma(endpoint) == 0) { if (mca_btl_openib_endpoint_send_eager_rdma(endpoint) == 0) {
OBJ_CONSTRUCT(&endpoint->eager_rdma_local.lock, opal_mutex_t); OPAL_THREAD_UNLOCK(&openib_btl->eager_rdma_lock);
goto unlock; OPAL_THREAD_UNLOCK(&endpoint->eager_rdma_local.lock);
return;
} }
openib_btl->eager_rdma_buffers_count--; openib_btl->eager_rdma_buffers_count--;
@ -1256,8 +1259,9 @@ void mca_btl_openib_endpoint_connect_eager_rdma(
endpoint->eager_rdma_index, NULL); endpoint->eager_rdma_index, NULL);
cleanup: cleanup:
OPAL_THREAD_UNLOCK(&openib_btl->eager_rdma_lock);
openib_btl->super.btl_mpool->mpool_free(openib_btl->super.btl_mpool, openib_btl->super.btl_mpool->mpool_free(openib_btl->super.btl_mpool,
buf, (mca_mpool_base_registration_t*)eager_rdma->reg); buf, (mca_mpool_base_registration_t*)eager_rdma->reg);
unlock: unlock_rdma_local:
OPAL_THREAD_UNLOCK(&openib_btl->ib_lock); OPAL_THREAD_UNLOCK(&endpoint->eager_rdma_local.lock);
} }