1
1

Force locking regardles to the opal_using_threads() setting.

Этот коммит содержится в:
Artem Polyakov 2015-12-21 18:23:40 +06:00
родитель 11b72d9add
Коммит 3eb4756a17
2 изменённых файлов: 17 добавлений и 17 удалений

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

@ -981,21 +981,21 @@ int mca_btl_openib_add_procs(
#endif
/* protect the device */
OPAL_THREAD_LOCK(&mca_btl_openib_component.ib_lock);
opal_mutex_lock(&mca_btl_openib_component.ib_lock);
rc = prepare_device_for_use (openib_btl->device);
if (OPAL_SUCCESS != rc) {
BTL_ERROR(("could not prepare openib device for use"));
OPAL_THREAD_UNLOCK(&mca_btl_openib_component.ib_lock);
opal_mutex_unlock(&mca_btl_openib_component.ib_lock);
return rc;
}
rc = mca_btl_openib_size_queues(openib_btl, nprocs);
if (OPAL_SUCCESS != rc) {
BTL_ERROR(("error creating cqs"));
OPAL_THREAD_UNLOCK(&mca_btl_openib_component.ib_lock);
opal_mutex_unlock(&mca_btl_openib_component.ib_lock);
return rc;
}
OPAL_THREAD_UNLOCK(&mca_btl_openib_component.ib_lock);
opal_mutex_unlock(&mca_btl_openib_component.ib_lock);
for (i = 0, local_procs = 0 ; i < (int) nprocs; i++) {
struct opal_proc_t* proc = procs[i];
@ -1047,7 +1047,7 @@ int mca_btl_openib_add_procs(
found_existing = true;
}
}
OPAL_THREAD_UNLOCK( &ib_proc->proc_lock );
opal_mutex_unlock( &ib_proc->proc_lock );
if (found_existing) {
if (reachable) {
@ -1075,21 +1075,21 @@ struct mca_btl_base_endpoint_t *mca_btl_openib_get_ep (struct mca_btl_base_modul
// TODO: shift to the separate function
/* protect the device */
OPAL_THREAD_LOCK(&mca_btl_openib_component.ib_lock);
opal_mutex_lock(&mca_btl_openib_component.ib_lock);
rc = prepare_device_for_use (openib_btl->device);
if (OPAL_SUCCESS != rc) {
BTL_ERROR(("could not prepare openib device for use"));
OPAL_THREAD_UNLOCK(&mca_btl_openib_component.ib_lock);
opal_mutex_unlock(&mca_btl_openib_component.ib_lock);
return NULL;
}
rc = mca_btl_openib_size_queues(openib_btl, 1);
if (OPAL_SUCCESS != rc) {
BTL_ERROR(("error creating cqs"));
OPAL_THREAD_UNLOCK(&mca_btl_openib_component.ib_lock);
opal_mutex_unlock(&mca_btl_openib_component.ib_lock);
return NULL;
}
OPAL_THREAD_UNLOCK(&mca_btl_openib_component.ib_lock);
opal_mutex_unlock(&mca_btl_openib_component.ib_lock);
if (NULL == (ib_proc = mca_btl_openib_proc_get_locked(proc, &is_new))) {
@ -1122,7 +1122,7 @@ struct mca_btl_base_endpoint_t *mca_btl_openib_get_ep (struct mca_btl_base_modul
(void)init_ib_proc_nolock(openib_btl, ib_proc, &endpoint,
local_port_cnt, btl_rank);
exit:
OPAL_THREAD_UNLOCK(&ib_proc->proc_lock);
opal_mutex_unlock(&ib_proc->proc_lock);
return endpoint;
}

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

@ -96,13 +96,13 @@ static mca_btl_openib_proc_t* ibproc_lookup_and_lock(opal_proc_t* proc)
mca_btl_openib_proc_t* ib_proc;
/* get the process from the list */
OPAL_THREAD_LOCK(&mca_btl_openib_component.ib_lock);
opal_mutex_lock(&mca_btl_openib_component.ib_lock);
ib_proc = ibproc_lookup_no_lock(proc);
OPAL_THREAD_UNLOCK(&mca_btl_openib_component.ib_lock);
opal_mutex_unlock(&mca_btl_openib_component.ib_lock);
if( NULL != ib_proc ){
/* if we were able to find it - lock it.
* NOTE: we want to lock it outside of list locked region */
OPAL_THREAD_LOCK(&ib_proc->proc_lock);
opal_mutex_lock(&ib_proc->proc_lock);
}
return ib_proc;
}
@ -263,14 +263,14 @@ mca_btl_openib_proc_t* mca_btl_openib_proc_get_locked(opal_proc_t* proc, bool *i
BTL_VERBOSE(("unpacking done!"));
/* Finally add this process to the initialized procs list */
OPAL_THREAD_LOCK(&mca_btl_openib_component.ib_lock);
opal_mutex_lock(&mca_btl_openib_component.ib_lock);
ib_proc_ret = ibproc_lookup_no_lock(proc);
if (NULL == ib_proc_ret) {
/* if process can't be found in this list - insert it locked
* it is safe to lock ib_proc here because this thread is
* the only one who knows about it so far */
OPAL_THREAD_LOCK(&ib_proc->proc_lock);
opal_mutex_lock(&ib_proc->proc_lock);
opal_list_append(&mca_btl_openib_component.ib_procs, &ib_proc->super);
ib_proc_ret = ib_proc;
*is_new = true;
@ -278,12 +278,12 @@ mca_btl_openib_proc_t* mca_btl_openib_proc_get_locked(opal_proc_t* proc, bool *i
/* otherwise - release module_proc */
OBJ_RELEASE(ib_proc);
}
OPAL_THREAD_UNLOCK(&mca_btl_openib_component.ib_lock);
opal_mutex_unlock(&mca_btl_openib_component.ib_lock);
/* if we haven't insert the process - lock it here so we
* won't lock mca_btl_openib_component.ib_lock */
if( !(*is_new) ){
OPAL_THREAD_LOCK(&ib_proc_ret->proc_lock);
opal_mutex_lock(&ib_proc_ret->proc_lock);
}
return ib_proc_ret;