Skip to content

Commit

Permalink
Merge pull request #6934 from devreal/osc-ucx-excl-lock-v4.0.x
Browse files Browse the repository at this point in the history
UCX osc: properly release exclusive lock to avoid lockup (v4.0.x)
  • Loading branch information
gpaulsen authored Aug 29, 2019
2 parents 78b8b01 + 8d130e1 commit 2d515f7
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions ompi/mca/osc/ucx/osc_ucx_passive_target.c
Original file line number Diff line number Diff line change
Expand Up @@ -90,21 +90,19 @@ static inline int start_exclusive(ompi_osc_ucx_module_t *module, int target) {
}

static inline int end_exclusive(ompi_osc_ucx_module_t *module, int target) {
uint64_t result_value = 0;
ucp_ep_h ep = OSC_UCX_GET_EP(module->comm, target);
ucp_rkey_h rkey = (module->state_info_array)[target].rkey;
uint64_t remote_addr = (module->state_info_array)[target].addr + OSC_UCX_STATE_LOCK_OFFSET;
int ret;
ucs_status_t status;

ret = opal_common_ucx_atomic_fetch(ep, UCP_ATOMIC_FETCH_OP_SWAP, TARGET_LOCK_UNLOCKED,
&result_value, sizeof(result_value),
remote_addr, rkey, mca_osc_ucx_component.ucp_worker);
if (OMPI_SUCCESS != ret) {
return ret;
status = ucp_atomic_post(ep, UCP_ATOMIC_POST_OP_ADD,
-((int64_t)TARGET_LOCK_EXCLUSIVE), sizeof(uint64_t),
remote_addr, rkey);
if (UCS_OK != status) {
OSC_UCX_VERBOSE(1, "ucp_atomic_post(OP_ADD) failed: %d", status);
return OMPI_ERROR;
}

assert(result_value >= TARGET_LOCK_EXCLUSIVE);

return OMPI_SUCCESS;
}

Expand Down

0 comments on commit 2d515f7

Please sign in to comment.