UCP/WIREUP: Add flush+destroy of UCT EPs used by TMP EP lanes#5613
UCP/WIREUP: Add flush+destroy of UCT EPs used by TMP EP lanes#5613dmitrygx wants to merge 9 commits intoopenucx:masterfrom
Conversation
a9319ee to
19b7064
Compare
|
waiting #5612 |
19b7064 to
104057c
Compare
|
@brminich @evgeny-leksikov could you review pls? |
6bf6ea4 to
c860575
Compare
c860575 to
7de5445
Compare
|
@alinask @brminich @evgeny-leksikov could you review pls? |
src/ucp/wireup/wireup_ep.c
Outdated
| ucp_wireup_ep_t *wireup_ep = (ucp_wireup_ep_t*)user_data; | ||
|
|
||
| if (wireup_ep == NULL) { | ||
| /* check for NULL pointer to workaround Coverity warning (it wrongly |
There was a problem hiding this comment.
would assert help here instead?
There was a problem hiding this comment.
yes, will try ucs_assert_always()
There was a problem hiding this comment.
ucs_assert() should be enough to suppress coverity
There was a problem hiding this comment.
ucs_assert() should be enough to suppress coverity
yes, but I guess it's OK to have always, since it's not a critical path
src/ucp/wireup/wireup_ep.c
Outdated
| ucs_assert(tmp_ep != ep); | ||
|
|
||
| /* to prevent flush+destroy UCT EPs that are used by the main EP, | ||
| * they have to be remove from the TMP EP lanes and their WIREUP |
|
@brminich @evgeny-leksikov your comments were addressed, could you review again pls? |
src/ucp/wireup/wireup.c
Outdated
|
|
||
| for (another_lane = 0; another_lane < another_ep_config_key->num_lanes; | ||
| ++another_lane) { | ||
| if (ucp_ep_config_lane_is_equal(ep_config_key, |
There was a problem hiding this comment.
- this condition has the same result for any
another_lanevalue. - whole
ucp_wireup_ep_lane_used_by_another_ep_configfunc looks confusing to me
so since major change is based on this func it should be revised
src/ucp/core/ucp_ep.c
Outdated
| return (key1->lanes[lane1].rsc_index == key2->lanes[lane2].rsc_index) && | ||
| (key1->lanes[lane1].proxy_lane == key2->lanes[lane2].proxy_lane) && | ||
| (key1->lanes[lane1].dst_md_index == key2->lanes[lane2].dst_md_index) && | ||
| (key1->lanes[lane1].path_index == key2->lanes[lane2].path_index) && | ||
| ((key1->lanes[lane1].lane_types == key2->lanes[lane2].lane_types) || |
There was a problem hiding this comment.
memcmp? or even (key1->lanes[lane1] == key2->lanes[lane2]
There was a problem hiding this comment.
no, wouldn't work since we don't want compare lane_tpyes if it wasn't requested
There was a problem hiding this comment.
sorry, missed extra () around lane_types comparison, better don't align different block, maybe even separate by extra line to improve readability?
There was a problem hiding this comment.
or
if (compare_types) {
return key1->lanes[lane1] == key2->lanes[lane2];
} else {
return (key1->lanes[lane].rsc_index == key2->lanes[lane2].rsc_index) &&
(key1->lanes[lane].proxy_lane == key2->lanes[lane2].proxy_lane) &&
(key1->lanes[lane].dst_md_index == key2->lanes[lane2].dst_md_index) &&
(key1->lanes[lane].path_index == key2->lanes[lane2].path_index);
}
src/ucp/wireup/wireup.c
Outdated
| ++another_lane) { | ||
| if (ucp_ep_config_lane_is_equal(ep_config_key, | ||
| another_ep_config_key, | ||
| lane, another_lane, 0)) { |
There was a problem hiding this comment.
btw, why don't we need to compare types?
There was a problem hiding this comment.
the can be different, we need to check whether this is the same TL+device pair or not
src/ucp/wireup/wireup_ep.c
Outdated
|
|
||
| /* check for NULL pointer to workaround Coverity warning (it wrongly | ||
| * assumes that this callback could be called upon GET/PUT operation) */ | ||
| ucs_assertv_always(wireup_ep == NULL, |
There was a problem hiding this comment.
good catch, sure
it is currently dead code, since all lanes in UCP EP are identical to TMP EP's one
so, UCP EP is responsible for them, and TMP EP don't' flush and delete them
src/ucp/core/ucp_ep.c
Outdated
| (key1->lanes[lane].path_index == key2->lanes[lane].path_index) && | ||
| ((key1->lanes[lane].lane_types == key2->lanes[lane].lane_types) || | ||
| return (key1->lanes[lane1].rsc_index == key2->lanes[lane2].rsc_index) && | ||
| (key1->lanes[lane1].proxy_lane == key2->lanes[lane2].proxy_lane) && |
There was a problem hiding this comment.
comparing lane numbers from different configs is erroneous, also does not seem to be needed
aec5a88 to
4e1c626
Compare
|
bot:pipe:retest |
1 similar comment
|
bot:pipe:retest |
|
@brminich @evgeny-leksikov @yosefe could you review pls? |
src/ucp/core/ucp_ep.c
Outdated
| ucp_lane_index_t lane1, | ||
| ucp_lane_index_t lane2) | ||
| { | ||
| return !memcmp(&key1->lanes[lane1], &key2->lanes[lane2], |
There was a problem hiding this comment.
yes, better not to do this
src/ucp/wireup/select.c
Outdated
| ucs_assertv_always(dst_dev_index == lane_desc->dst_dev_index, | ||
| "lane[%d].dst_md_index=%d, dst_md_index=%d", | ||
| lane, lane_desc->dst_md_index, dst_md_index); | ||
| ucs_assertv_always(dst_md_index == lane_desc->dst_md_index, | ||
| "lane[%d].dst_dev_index=%d, dst_dev_index=%d", |
There was a problem hiding this comment.
traces are incorrect, you mention dst_dev for dst_md and vice versa
src/ucp/core/ucp_ep.c
Outdated
| int ucp_ep_config_lane_tl_is_equal(const ucp_ep_config_key_t *key1, | ||
| const ucp_ep_config_key_t *key2, | ||
| ucp_lane_index_t lane1, | ||
| ucp_lane_index_t lane2) |
There was a problem hiding this comment.
minor: maybe reorder args like key1, lane1, key2, lane2 here and below?
src/ucp/core/ucp_ep.h
Outdated
| defined by | ||
| UCP_WIREUP_SA_DATA_xx */ | ||
| uint8_t dev_index; /**< Device address index used to | ||
| ucp_rsc_index_t dev_index; /**< Device address index used to |
There was a problem hiding this comment.
pls use fixed sized types for wire protocols
src/ucp/wireup/select.c
Outdated
| dst_md_index = select_params->address->address_list | ||
| [select_info->addr_index].md_index; | ||
| dst_dev_index = select_params->address->address_list | ||
| [select_info->addr_index].dev_index; |
There was a problem hiding this comment.
minor: can create local pointer to select_params->address->address_list or even its entry
src/ucp/wireup/wireup.c
Outdated
| ucp_wireup_ep_configs_use_same_lane(ucp_ep_config_key_t *ep_config_key, | ||
| ucp_ep_config_key_t *another_ep_config_key, |
There was a problem hiding this comment.
- just
key1andkey2likeucp_ep_config_lane_tl_is_equal - and
ucp_wireup_ep_configs_use_same_tl_lane
to be consistent
src/ucp/wireup/wireup.c
Outdated
| ucp_ep_config_key_t *another_ep_config_key, | ||
| ucp_lane_index_t lane) | ||
| { | ||
| ucp_lane_index_t another_lane; |
There was a problem hiding this comment.
lane_idx shorter and typically used
src/ucp/wireup/wireup_ep.c
Outdated
| if (self->tmp_ep != NULL) { | ||
| ucs_assert(!(self->tmp_ep->flags & UCP_EP_FLAG_USED)); | ||
| ucp_ep_disconnected(self->tmp_ep, 1); | ||
| ucp_wireup_tmp_ep_destroy(ucp_ep, self, UCT_FLUSH_FLAG_CANCEL, NULL); |
There was a problem hiding this comment.
why ret value is not checked here? request can leak here
There was a problem hiding this comment.
added a TODO that it will be replaced by ucp_worker_discard_uct_ep() when 5608 gets merged
9f9bcdd to
9df2346
Compare
|
@dmitrygx, plz fix merge conflicts |
src/ucp/core/ucp_ep.c
Outdated
| int ucp_ep_config_lane_is_equal(const ucp_ep_config_key_t *key1, | ||
| const ucp_ep_config_key_t *key2, | ||
| ucp_lane_index_t lane, int compare_types) | ||
| int ucp_ep_config_lane_tl_is_equal(const ucp_ep_config_key_t *key1, |
There was a problem hiding this comment.
ucp_ep_config_lane_is_same_peer
src/ucp/core/ucp_ep.c
Outdated
| ucp_lane_index_t lane1, | ||
| ucp_lane_index_t lane2) |
src/ucp/wireup/wireup.c
Outdated
| } | ||
|
|
||
| ucp_lane_index_t | ||
| ucp_wireup_ep_configs_use_same_tl_lane(ucp_ep_config_key_t *key1, |
There was a problem hiding this comment.
ucp_wireup_ep_configs_can_reuse_lane
|
|
||
| wireup_ep->tmp_ep = NULL; | ||
|
|
||
| req = ucp_ep_flush_internal(tmp_ep, ep_flush_flags, 0, ¶m, NULL, |
There was a problem hiding this comment.
why do we need flush on tmp_ep? can't we just ep_discard all the lanes we don't need?
There was a problem hiding this comment.
they need to be converted from WIREUP EP to UCT EP
I'll use @alinask implementation for destroying TMP EP and will add ep_discard there
There was a problem hiding this comment.
but need to merge ep_discard first
What
Add flush+destroy of UCT EPs used by TMP EP lanes.
Why ?
Will be used by #5582 to flush+destroy of UCT EPs used only by TMP EP in order to correctly send data that has to be transferred before closing the UCT EP.
Depends on #5612.
How ?
flush_flag=CANCEL) or replaced by real UCT EP (flush_flag=LOCAL), schedule flush+destroy of all UCT EP lanes used by TMP EP.NULLin TMP EP lanes in order to not flush them.complete_cbif it was specified by the caller (e.g. it allows continueucp_wireup_ep_progress()).