Skip to content

Commit

Permalink
UCP/UCT/MD: add diag prints to mem_reg path
Browse files Browse the repository at this point in the history
  • Loading branch information
evgeny-leksikov committed Jan 30, 2021
1 parent 3d4f8f7 commit 1ac4697
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/ucp/core/ucp_mm.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ ucs_status_t ucp_mem_rereg_mds(ucp_context_h context, ucp_md_map_t reg_md_map,
}

level = (uct_flags & UCT_MD_MEM_FLAG_HIDE_ERRORS) ?
UCS_LOG_LEVEL_DEBUG : UCS_LOG_LEVEL_ERROR;
UCS_LOG_LEVEL_DIAG : UCS_LOG_LEVEL_ERROR;

ucs_log(level,
"failed to register address %p mem_type bit 0x%lx length %zu on "
Expand Down
6 changes: 6 additions & 0 deletions src/uct/base/uct_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -450,11 +450,17 @@ ucs_status_t uct_md_mem_reg(uct_md_h md, void *address, size_t length,
ucs_status_t status;

if ((length == 0) || (address == NULL)) {
uct_md_log_mem_reg_error(flags,
"uct_md_mem_reg(address=%p length=%zu): "
"invalid parameters", address, length);
return UCS_ERR_INVALID_PARAM;
}

status = uct_mem_check_flags(flags);
if (status != UCS_OK) {
uct_md_log_mem_reg_error(flags,
"uct_md_mem_reg(flags=0x%x): invalid flags",
flags);
return status;
}

Expand Down
10 changes: 10 additions & 0 deletions src/uct/base/uct_md.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@
#include <string.h>


#define uct_md_log_mem_reg_error(_flags, _fmt, ...) \
ucs_log(uct_md_reg_log_lvl(_flags), _fmt, ## __VA_ARGS__)


typedef struct uct_md_rcache_config {
size_t alignment; /**< Force address alignment */
unsigned event_prio; /**< Memory events priority */
Expand Down Expand Up @@ -196,4 +200,10 @@ ucs_status_t uct_mem_alloc_check_params(size_t length,

extern ucs_config_field_t uct_md_config_table[];

static inline ucs_log_level_t uct_md_reg_log_lvl(unsigned flags)
{
return (flags & UCT_MD_MEM_FLAG_HIDE_ERRORS) ? UCS_LOG_LEVEL_DIAG :
UCS_LOG_LEVEL_ERROR;
}

#endif
2 changes: 2 additions & 0 deletions src/uct/ib/base/ib_md.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,6 +801,8 @@ static ucs_status_t uct_ib_mem_reg(uct_md_h uct_md, void *address, size_t length

memh = uct_ib_memh_alloc(md);
if (memh == NULL) {
uct_md_log_mem_reg_error(flags,
"md %p: failed to allocate memory handle", md);
return UCS_ERR_NO_MEMORY;
}

Expand Down

0 comments on commit 1ac4697

Please sign in to comment.