Skip to content

Commit 7f7267c

Browse files
authored
Merge pull request #6972 from devreal/osc-ucx-excl-lock-v3.1.x
v3.1.x: UCX osc: properly release exclusive lock to avoid lockup
2 parents be19752 + 9805ebf commit 7f7267c

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

ompi/mca/osc/ucx/osc_ucx_passive_target.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,23 +89,21 @@ static inline int start_exclusive(ompi_osc_ucx_module_t *module, int target) {
8989
}
9090

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

98-
status = ucp_atomic_swap64(ep, TARGET_LOCK_UNLOCKED,
99-
remote_addr, rkey, &result_value);
100-
if (status != UCS_OK) {
97+
status = ucp_atomic_post(ep, UCP_ATOMIC_POST_OP_ADD,
98+
-((int64_t)TARGET_LOCK_EXCLUSIVE), sizeof(uint64_t),
99+
remote_addr, rkey);
100+
if (UCS_OK != status) {
101101
opal_output_verbose(1, ompi_osc_base_framework.framework_output,
102-
"%s:%d: ucp_atomic_swap64 failed: %d\n",
102+
"%s:%d: ucp_atomic_post failed: %d\n",
103103
__FILE__, __LINE__, status);
104104
return OMPI_ERROR;
105105
}
106106

107-
assert(result_value >= TARGET_LOCK_EXCLUSIVE);
108-
109107
return OMPI_SUCCESS;
110108
}
111109

0 commit comments

Comments
 (0)