Skip to content

Commit

Permalink
IB/SEND-OPS/STR: added obj-str implementation
Browse files Browse the repository at this point in the history
- added obj_str implementation for flush_mp mpool to simplify
  resource leaks investigation
  • Loading branch information
Sergey Oblomov committed Sep 10, 2021
1 parent 909d55d commit 0ab1268
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/uct/ib/rc/base/rc_ep.h
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ uct_rc_txqp_add_flush_comp(uct_rc_iface_t *iface, uct_base_ep_t *ep,

op->flags = 0;
op->user_comp = comp;
uct_rc_iface_send_op_set_name(op, "rc_txqp_add_flush_comp");
uct_rc_txqp_add_send_op_sn(txqp, op, sn);
VALGRIND_MAKE_MEM_DEFINED(op, sizeof(*op)); /* handler set by mpool init */
}
Expand Down
28 changes: 27 additions & 1 deletion src/uct/ib/rc/base/rc_iface.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,12 +159,17 @@ uct_rc_iface_flush_comp_init(ucs_mpool_t *mp, void *obj, void *chunk)
op->iface = iface;
}


static void ucp_send_op_mpool_obj_str(ucs_mpool_t *mp, void *obj,
ucs_string_buffer_t *strb);


static ucs_mpool_ops_t uct_rc_flush_comp_mpool_ops = {
.chunk_alloc = ucs_mpool_chunk_malloc,
.chunk_release = ucs_mpool_chunk_free,
.obj_init = uct_rc_iface_flush_comp_init,
.obj_cleanup = NULL,
.obj_str = NULL
.obj_str = ucp_send_op_mpool_obj_str
};

ucs_status_t uct_rc_iface_query(uct_rc_iface_t *iface,
Expand Down Expand Up @@ -953,3 +958,24 @@ ucs_status_t uct_rc_iface_fence(uct_iface_h tl_iface, unsigned flags)
UCT_TL_IFACE_STAT_FENCE(&iface->super.super);
return UCS_OK;
}

static void ucp_send_op_mpool_obj_str(ucs_mpool_t *mp, void *obj,
ucs_string_buffer_t *strb)
{
uct_rc_iface_send_op_t *op = obj;
const char *handler_func_name = ucs_debug_get_symbol_name(op->handler);
const char *comp_func_name;

ucs_string_buffer_appendf(strb, "flags:0x%x handler:%s()", op->flags,
handler_func_name);

if (op->user_comp != NULL) {
comp_func_name = ucs_debug_get_symbol_name(op->user_comp->func);
ucs_string_buffer_appendf(strb, " comp:%s()", comp_func_name);
}

#if ENABLE_DEBUG_DATA
ucs_string_buffer_appendf(strb, " name:%s", op->name);
#endif
}

12 changes: 12 additions & 0 deletions src/uct/ib/rc/base/rc_iface.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ struct uct_rc_iface_send_op {
get_bcopy completions */
};
uct_completion_t *user_comp;
#if ENABLE_DEBUG_DATA
const char *name; /* object ID, debug only */
#endif
};


Expand Down Expand Up @@ -473,4 +476,13 @@ uct_rc_iface_atomic_handler(uct_rc_iface_t *iface, int ext, unsigned length)
}
return NULL;
}

static UCS_F_ALWAYS_INLINE void
uct_rc_iface_send_op_set_name(uct_rc_iface_send_op_t *op, const char *name)
{
#if ENABLE_DEBUG_DATA
op->name = name;
#endif
}

#endif

0 comments on commit 0ab1268

Please sign in to comment.