Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UCT/DC: Fix DCI pending allocation scheme - v1.3.x #2744

Merged
merged 1 commit into from
Jul 27, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/uct/ib/dc/base/dc_ep.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,9 @@ uct_dc_iface_dci_do_pending_wait(ucs_arbiter_t *arbiter,
uct_dc_ep_t *ep = ucs_container_of(ucs_arbiter_elem_group(elem), uct_dc_ep_t, arb_group);
uct_dc_iface_t *iface = ucs_derived_of(ep->super.super.iface, uct_dc_iface_t);

/**
* stop if dci can not be allocated
* else move group to the dci arbiter
*/
ucs_assert_always(ep->dci == UCT_DC_EP_NO_DCI);
if (ep->dci != UCT_DC_EP_NO_DCI) {
return UCS_ARBITER_CB_RESULT_DESCHED_GROUP;
}

if (!uct_dc_iface_dci_can_alloc(iface)) {
return UCS_ARBITER_CB_RESULT_STOP;
Expand Down
44 changes: 43 additions & 1 deletion test/gtest/uct/ib/test_dc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ UCS_TEST_P(test_dc, dcs_ep_flush_pending) {
preq.uct_req.func = uct_pending_flush;
status = uct_ep_pending_add(m_e1->ep(0), &preq.uct_req);
EXPECT_UCS_OK(status);

/* progress till ep is flushed */
do {
progress();
Expand All @@ -319,6 +319,48 @@ UCS_TEST_P(test_dc, dcs_ep_flush_pending) {
EXPECT_EQ(0, iface->tx.stack_top);
}

/* Check that the following sequnce works ok:
* - Add some pending request to DCI wait queue
* - Try to send something from this ep. This will force ep to take free DCI
* (the send will not succeed anyway)
* - Progress all pendings
* - Make sure that there is no any assertion and everyting is ok
* (just send something).
* */
UCS_TEST_P(test_dc, dcs_ep_am_pending) {

ucs_status_t status;
uct_dc_iface_t *iface;

m_e1->connect_to_iface(0, *m_e2);
m_e1->connect_to_iface(1, *m_e2);

/* use all iface resources */
iface = dc_iface(m_e1);
iface->super.tx.cq_available = 8;
do {
status = uct_ep_am_short(m_e1->ep(1), 0, 0, NULL, 0);
} while (status == UCS_OK);

EXPECT_EQ(UCS_ERR_NO_RESOURCE, status);

/* put AM op on pending */
preq.e = m_e1;
preq.uct_req.func = uct_pending_flush;
status = uct_ep_pending_add(m_e1->ep(0), &preq.uct_req);
EXPECT_UCS_OK(status);

status = uct_ep_am_short(m_e1->ep(0), 0, 0, NULL, 0);
EXPECT_EQ(UCS_ERR_NO_RESOURCE, status);

flush();

status = uct_ep_am_short(m_e1->ep(0), 0, 0, NULL, 0);
EXPECT_EQ(UCS_OK, status);

flush();
}

/* check that ep does not hold dci after
* purge
*/
Expand Down