Skip to content

Commit 8473a66

Browse files
committed
btl/uct: fix bug when using a transport without zero-copy
This commit fixes a crash that can occur if a transport is usable but doesn't have zero-copy support. In this case do not attempt to use zero-copy and set the max send size off the bcopy limit. Signed-off-by: Nathan Hjelm <[email protected]>
1 parent 526775d commit 8473a66

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

opal/mca/btl/uct/btl_uct_am.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,8 @@ int mca_btl_uct_send_frag (mca_btl_uct_module_t *uct_btl, mca_btl_uct_base_frag_
175175
if (!context->in_am_callback) {
176176
mca_btl_uct_context_lock (context);
177177
/* attempt to post the fragment */
178-
if (NULL != frag->base.super.registration) {
178+
if (NULL != frag->base.super.registration &&
179+
(context->uct_iface_attr.cap.flags & UCT_IFACE_FLAG_AM_ZCOPY)) {
179180
frag->comp.dev_context = context;
180181
ucs_status = uct_ep_am_zcopy (ep_handle, MCA_BTL_UCT_FRAG, &frag->header, sizeof (frag->header),
181182
&frag->uct_iov, 1, 0, &frag->comp.uct_comp);

opal/mca/btl/uct/btl_uct_tl.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -461,8 +461,14 @@ static void mca_btl_uct_set_tl_am (mca_btl_uct_module_t *module, mca_btl_uct_tl_
461461
tl->max_device_contexts = mca_btl_uct_component.num_contexts_per_module;
462462
}
463463

464-
module->super.btl_max_send_size = MCA_BTL_UCT_TL_ATTR(tl, 0).cap.am.max_zcopy - sizeof (mca_btl_uct_am_header_t);
465-
module->super.btl_eager_limit = MCA_BTL_UCT_TL_ATTR(tl, 0).cap.am.max_bcopy - sizeof (mca_btl_uct_am_header_t);
464+
module->super.btl_eager_limit = MCA_BTL_UCT_TL_ATTR(tl, 0).cap.am.max_bcopy -
465+
sizeof (mca_btl_uct_am_header_t);
466+
if (MCA_BTL_UCT_TL_ATTR(tl, 0).cap.flags & UCT_IFACE_FLAG_AM_ZCOPY) {
467+
module->super.btl_max_send_size = MCA_BTL_UCT_TL_ATTR(tl, 0).cap.am.max_zcopy -
468+
sizeof (mca_btl_uct_am_header_t);
469+
} else {
470+
module->super.btl_max_send_size = module->super.btl_eager_limit;
471+
}
466472
}
467473

468474
static int mca_btl_uct_set_tl_conn (mca_btl_uct_module_t *module, mca_btl_uct_tl_t *tl)

0 commit comments

Comments
 (0)