diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt.h b/ompi/mca/osc/pt2pt/osc_pt2pt.h index bbb35f55629..f011a052eed 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt.h +++ b/ompi/mca/osc/pt2pt/osc_pt2pt.h @@ -912,11 +912,14 @@ static inline ompi_osc_pt2pt_sync_t *ompi_osc_pt2pt_module_sync_lookup (ompi_osc return &module->all_sync; case OMPI_OSC_PT2PT_SYNC_TYPE_PSCW: + OPAL_THREAD_LOCK(&module->all_sync.lock); if (ompi_osc_pt2pt_sync_pscw_peer (module, target, peer)) { + OPAL_THREAD_UNLOCK(&module->all_sync.lock); OPAL_OUTPUT_VERBOSE((50, ompi_osc_base_framework.framework_output, "osc/pt2pt: found PSCW access epoch target for %d", target)); return &module->all_sync; } + OPAL_THREAD_UNLOCK(&module->all_sync.lock); } return NULL; diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_active_target.c b/ompi/mca/osc/pt2pt/osc_pt2pt_active_target.c index 55917ca65ae..b8b1d27b411 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_active_target.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_active_target.c @@ -213,9 +213,11 @@ int ompi_osc_pt2pt_start (ompi_group_t *group, int assert, ompi_win_t *win) ompi_osc_pt2pt_sync_t *sync = &module->all_sync; OPAL_THREAD_LOCK(&module->lock); + OPAL_THREAD_LOCK(&sync->lock); /* check if we are already in an access epoch */ if (ompi_osc_pt2pt_access_epoch_active (module)) { + OPAL_THREAD_UNLOCK(&sync->lock); OPAL_THREAD_UNLOCK(&module->lock); return OMPI_ERR_RMA_SYNC; } @@ -249,6 +251,7 @@ int ompi_osc_pt2pt_start (ompi_group_t *group, int assert, ompi_win_t *win) if (0 == ompi_group_size (group)) { /* nothing more to do. this is an empty start epoch */ sync->eager_send_active = true; + OPAL_THREAD_UNLOCK(&sync->lock); OPAL_THREAD_UNLOCK(&module->lock); return OMPI_SUCCESS; } @@ -258,12 +261,12 @@ int ompi_osc_pt2pt_start (ompi_group_t *group, int assert, ompi_win_t *win) /* translate the group ranks into the communicator */ sync->peer_list.peers = ompi_osc_pt2pt_get_peers (module, group); if (NULL == sync->peer_list.peers) { + OPAL_THREAD_UNLOCK(&sync->lock); OPAL_THREAD_UNLOCK(&module->lock); return OMPI_ERR_OUT_OF_RESOURCE; } if (!(assert & MPI_MODE_NOCHECK)) { - OPAL_THREAD_LOCK(&sync->lock); for (int i = 0 ; i < sync->num_peers ; ++i) { ompi_osc_pt2pt_peer_t *peer = sync->peer_list.peers[i]; @@ -276,7 +279,6 @@ int ompi_osc_pt2pt_start (ompi_group_t *group, int assert, ompi_win_t *win) ompi_osc_pt2pt_peer_set_unex (peer, false); } } - OPAL_THREAD_UNLOCK(&sync->lock); } else { sync->sync_expected = 0; } @@ -295,6 +297,7 @@ int ompi_osc_pt2pt_start (ompi_group_t *group, int assert, ompi_win_t *win) "ompi_osc_pt2pt_start complete. eager sends active: %d", sync->eager_send_active)); + OPAL_THREAD_UNLOCK(&sync->lock); OPAL_THREAD_UNLOCK(&module->lock); return OMPI_SUCCESS; } diff --git a/ompi/mca/osc/pt2pt/osc_pt2pt_data_move.c b/ompi/mca/osc/pt2pt/osc_pt2pt_data_move.c index 04333d2add4..bacfab86b9a 100644 --- a/ompi/mca/osc/pt2pt/osc_pt2pt_data_move.c +++ b/ompi/mca/osc/pt2pt/osc_pt2pt_data_move.c @@ -747,7 +747,9 @@ static int ompi_osc_pt2pt_acc_op_queue (ompi_osc_pt2pt_module_t *module, ompi_os } /* add to the pending acc queue */ - OPAL_THREAD_SCOPED_LOCK(&module->lock, opal_list_append (&module->pending_acc, &pending_acc->super)); + ompi_osc_pt2pt_accumulate_lock(module); + opal_list_append (&module->pending_acc, &pending_acc->super); + ompi_osc_pt2pt_accumulate_unlock(module); return OMPI_SUCCESS; }