Skip to content

UCT/IB/MLX5: DV UAR alloc type NC support - #6082

Merged
yosefe merged 1 commit into
openucx:masterfrom
Artemy-Mellanox:topic/dv_uar_nc
Jan 5, 2021
Merged

yosefe merged 1 commit into
openucx:masterfrom
Artemy-Mellanox:topic/dv_uar_nc

Conversation

@Artemy-Mellanox

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread src/uct/ib/mlx5/ib_mlx5.c Outdated
Comment on lines +408 to +417
unsigned flags = UCT_IB_MLX5_UAR_ALLOC_TYPE_WC;

retry:
uar->uar = mlx5dv_devx_alloc_uar(md->super.dev.ibv_context,
flags);
if (uar->uar == NULL) {
if (flags != UCT_IB_MLX5_UAR_ALLOC_TYPE_NC) {
flags = UCT_IB_MLX5_UAR_ALLOC_TYPE_NC;
goto retry;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, calling mlx5dv_devx_alloc_uar twice(instead of goto/retry) would be more readable

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't we want to cache the failure?

Comment thread src/uct/ib/mlx5/ib_mlx5.c Outdated
{
#if HAVE_DEVX
uar->uar = mlx5dv_devx_alloc_uar(md->super.dev.ibv_context, 0);
uar->uar = mlx5dv_devx_alloc_uar(md->super.dev.ibv_context,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls remove indentation where not needed

Comment thread src/uct/ib/mlx5/ib_mlx5.c Outdated
ucs_error("mlx5dv_devx_alloc_uar() failed: %m");
return UCS_ERR_NO_MEMORY;
if (UCT_IB_MLX5_UAR_ALLOC_TYPE_WC == UCT_IB_MLX5_UAR_ALLOC_TYPE_NC) {
ucs_error("mlx5dv_devx_alloc_uar(WC) failed: %m");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. print a debug message if WC failed and we're doing fallback
  2. print actual flag value, ucs_error("mlx5dv_devx_alloc_uar(WC, flags=0x%x) failed: %m", UCT_IB_MLX5_UAR_ALLOC_TYPE_WC);

Comment thread src/uct/ib/mlx5/ib_mlx5.c Outdated
Comment on lines +416 to +421
uar->uar = mlx5dv_devx_alloc_uar(md->super.dev.ibv_context,
UCT_IB_MLX5_UAR_ALLOC_TYPE_NC);
if (uar->uar == NULL) {
ucs_error("mlx5dv_devx_alloc_uar(NC) failed: %m");
return UCS_ERR_NO_MEMORY;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO, #define UCT_IB_MLX5_UAR_ALLOC_TYPE_NC 0 is not correct (but only #define UCT_IB_MLX5_UAR_ALLOC_TYPE_WC 0 is correct)
maybe add #ifdef HAVE_DECL_MLX5DV_UAR_ALLOC_TYPE_NC here?
and check for HAVE_DECL_MLX5DV_UAR_ALLOC_TYPE_WC separately in configure?

Comment thread src/uct/ib/mlx5/ib_mlx5.c Outdated
uar->uar = mlx5dv_devx_alloc_uar(md->super.dev.ibv_context,
UCT_IB_MLX5_UAR_ALLOC_TYPE_NC);
#if HAVE_DECL_MLX5DV_UAR_ALLOC_TYPE_NC
ucs_debug("UAR alloc WC failed. Fallback to NC\n");

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ucs_debug("mlx5dv_devx_alloc_uar(device=%s, flags=0x%x) failed: %m, fallback to NC\n");

Comment thread src/uct/ib/mlx5/ib_mlx5.c Outdated
UCT_IB_MLX5_UAR_ALLOC_TYPE_NC);
if (uar->uar == NULL) {
ucs_error("mlx5dv_devx_alloc_uar(NC) failed: %m");
ucs_error("mlx5dv_devx_alloc_uar(NC, flags=0x%x) failed: %m",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

device=%s

@yosefe

yosefe commented Jan 3, 2021 •

Copy link
Copy Markdown
Member

also, revert #6061 in this PR

Comment thread src/uct/ib/mlx5/ib_mlx5.c Outdated
Comment on lines +412 to +415
ucs_debug("mlx5dv_devx_alloc_uar(device=%s, flags=0x%x(WC)) "
"failed: %m, fallback to NC",
uct_ib_device_name(&md->super.dev),
UCT_IB_MLX5_UAR_ALLOC_TYPE_WC);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe add function uct_ib_mlx5_devx_alloc_uar(md, flags, err_level=ERROR/DEBUG, char *title="WC"/"NC") which will wrap the debug/error print?

@yosefe yosefe left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pls squash

Comment thread src/uct/ib/mlx5/ib_mlx5.c
Comment on lines +414 to +421
sprintf(buf, "mlx5dv_devx_alloc_uar(device=%s, flags=0x%x(%s)) "
"failed: %m", uct_ib_device_name(&md->super.dev), flags, title);
if (fallback == NULL) {
ucs_log(log_level, "%s", buf);
} else {
ucs_log(log_level, "%s, fallback to %s", buf, fallback);
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what was wrong with the previous version?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

coverity

@yosefe

yosefe commented Jan 4, 2021

Copy link
Copy Markdown
Member

@Artemy-Mellanox can u pls squash?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants