Skip to content

Commit

Permalink
Merge pull request openucx#5972 from hoopoepg/topic/keepalive-fixed-i…
Browse files Browse the repository at this point in the history
…ncorrect-assert

UCP/KEEPALIVE: removed incorrect assert
  • Loading branch information
brminich authored Dec 11, 2020
2 parents d90e702 + 73830be commit 83f029c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 9 deletions.
25 changes: 19 additions & 6 deletions src/ucp/core/ucp_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,9 @@ ucs_status_t ucp_worker_create_ep(ucp_worker_h worker, unsigned ep_init_flags,
goto err_destroy_ep_base;
}

if (!(ep_init_flags & UCP_EP_INIT_FLAG_MEM_TYPE)) {
if (ep_init_flags & UCP_EP_INIT_FLAG_MEM_TYPE) {
ep->flags |= UCP_EP_FLAG_INTERNAL;
} else {
ucs_list_add_tail(&worker->all_eps, &ucp_ep_ext_gen(ep)->ep_list);
}

Expand All @@ -208,7 +210,10 @@ void ucp_ep_delete(ucp_ep_h ep)

ucs_callbackq_remove_if(&ep->worker->uct->progress_q,
ucp_wireup_msg_ack_cb_pred, ep);
ucp_worker_keepalive_remove_ep(ep);
if (!(ep->flags & UCP_EP_FLAG_INTERNAL)) {
ucp_worker_keepalive_remove_ep(ep);
}

ucs_list_del(&ucp_ep_ext_gen(ep)->ep_list);
status = ucs_ptr_map_del(&ep->worker->ptr_map, ucp_ep_local_id(ep));
if (status != UCS_OK) {
Expand Down Expand Up @@ -357,12 +362,20 @@ ucs_status_t ucp_worker_create_mem_type_endpoints(ucp_worker_h worker)
void ucp_worker_destroy_mem_type_endpoints(ucp_worker_h worker)
{
ucs_memory_type_t mem_type;
ucp_ep_h ep;

ucs_memory_type_for_each(mem_type) {
if (worker->mem_type_ep[mem_type] != NULL) {
ucp_ep_destroy_internal(worker->mem_type_ep[mem_type]);
worker->mem_type_ep[mem_type] = NULL;
ep = worker->mem_type_ep[mem_type];
if (ep == NULL) {
continue;
}

ucs_debug("memtype ep %p: destroy", ep);
ucs_assert(ep->flags & UCP_EP_FLAG_INTERNAL);

ucp_ep_cleanup_lanes(ep);
ucp_ep_delete(ep);
worker->mem_type_ep[mem_type] = NULL;
}
}

Expand Down Expand Up @@ -792,7 +805,7 @@ void ucp_ep_destroy_internal(ucp_ep_h ep)
{
ucs_debug("ep %p: destroy", ep);
ucp_ep_cleanup_lanes(ep);
if (ep->flags & UCP_EP_FLAG_TEMPORARY) {
if (ep->flags & UCP_EP_FLAG_INTERNAL) {
/* it's failed tmp ep of main ep */
ucs_assert(ucp_ep_ext_control(ep)->local_ep_id == UCP_EP_ID_INVALID);
ucp_ep_destroy_base(ep);
Expand Down
5 changes: 3 additions & 2 deletions src/ucp/core/ucp_ep.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,9 @@ enum {
UCP_EP_FLAG_CLOSE_REQ_VALID = UCS_BIT(11),/* close protocol is started and
close_req is valid */
UCP_EP_FLAG_ERR_HANDLER_INVOKED = UCS_BIT(12),/* error handler was called */
UCP_EP_FLAG_TEMPORARY = UCS_BIT(13),/* the temporary EP which holds
temporary wireup configuration */
UCP_EP_FLAG_INTERNAL = UCS_BIT(13),/* the internal EP which holds
temporary wireup configuration or
mem-type EP */
UCP_EP_FLAG_INDIRECT_ID = UCS_BIT(14),/* protocols on this endpoint will send
indirect endpoint id instead of pointer,
can be replaced with looking at local ID */
Expand Down
2 changes: 1 addition & 1 deletion src/ucp/wireup/wireup_cm.c
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ static ssize_t ucp_cm_client_priv_pack_cb(void *arg,
goto out_check_err;
}

cm_wireup_ep->tmp_ep->flags |= UCP_EP_FLAG_TEMPORARY;
cm_wireup_ep->tmp_ep->flags |= UCP_EP_FLAG_INTERNAL;

status = ucp_worker_get_ep_config(worker, &key, 0,
&cm_wireup_ep->tmp_ep->cfg_index);
Expand Down

0 comments on commit 83f029c

Please sign in to comment.