Repository navigation
UCP: add UCX_FAILOVER_MODE parameter - #11994
Conversation
HW-PSN failover reads the token capability and lengths from the worker iface. A transport that does not implement tokens still opens, with both lengths left at 0.
Endpoints in failover error-handling mode can select software discard or token failover. The error path does not read the setting yet.
Endpoints in failover mode with UCX_FAILOVER_MODE=token keep transports that can query a token. Other modes keep the existing transport set.
|
🤖 Starting review — findings will be posted here when done. |
| ucp_rsc_index_t rsc_index; | ||
|
|
||
| memset(tl_bitmap_out, 0, sizeof(*tl_bitmap_out)); | ||
| UCS_STATIC_BITMAP_FOR_EACH_BIT(rsc_index, tl_bitmap_in) { |
There was a problem hiding this comment.
blocker: tl_bitmap is often ucp_tl_bitmap_max (all 128 bits set) coming from the ucp_wireup_init_lanes() callers (ucp_ep.c:782/1169, wireup.c:733/829/1016, wireup_ep.c:279, forwarded via ucp_wireup_try_select_lanes()), so this loop queries ucp_worker_iface_get_attr_v2()/context->tl_rscs[rsc_index] for resource indexes that don't exist. For an index outside context->tl_bitmap, ucp_worker_iface() hits ucs_assert(UCS_STATIC_BITMAP_GET(tl_bitmap, rsc_index)) in debug builds, and in release returns worker->ifaces[popcount] past the end of the num_ifaces-element array, i.e. an out-of-bounds read followed by a bogus pointer dereference; the context->tl_rscs[rsc_index] access in the trace is OOB as well. Please intersect with context->tl_bitmap first, like ucp_wireup_select_transport() does (select.c:466):
| UCS_STATIC_BITMAP_FOR_EACH_BIT(rsc_index, tl_bitmap_in) { | |
| ucp_tl_bitmap_t tl_bitmap = UCS_STATIC_BITMAP_AND( | |
| *tl_bitmap_in, worker->context->tl_bitmap); | |
| ucp_rsc_index_t rsc_index; | |
| UCS_STATIC_BITMAP_RESET_ALL(tl_bitmap_out); | |
| UCS_STATIC_BITMAP_FOR_EACH_BIT(rsc_index, &tl_bitmap) { |
| ucs_status_t status; | ||
|
|
||
| UCS_STATIC_BITMAP_AND_INPLACE(&scalable_tl_bitmap, tl_bitmap); | ||
| if ((key->err_mode == UCP_ERR_HANDLING_MODE_FAILOVER) && |
There was a problem hiding this comment.
The filtered bitmap is used for every lane type, including aux/wireup-msg and keepalive candidates (criteria.tl_rsc_flags = UCP_TL_RSC_FLAG_AUX at select.c:1207 and 2572, both restricted by select_params->tl_bitmap). ud/ud_mlx5/tcp use uct_iface_base_query_v2 and never report UCT_IFACE_FLAG_V2_QUERY_TOKEN, so with UCX_FAILOVER_MODE=token they are removed and a p2p transport such as rc_mlx5 connected by worker address has no aux transport left for the wireup message lane → ep creation fails. Should the filter be limited to the lanes that actually need token failover?
| continue; | ||
| } | ||
|
|
||
| ucs_trace(UCT_TL_RESOURCE_DESC_FMT " : disabled, no token query", |
There was a problem hiding this comment.
minor: continuation lines of the if condition and of ucs_trace() are over-indented relative to the opening paren, plus there are redundant outer parentheses in the if. Please re-run clang-format.
| ucs_offsetof(ucp_context_config_t, recovery_retries), | ||
| UCS_CONFIG_TYPE_UINT}, | ||
|
|
||
| {"FAILOVER_MODE", "auto", |
There was a problem hiding this comment.
FAILOVER_MODE doc vs code: only UCP_FAILOVER_MODE_TOKEN is consumed in this PR; auto and sw are handled identically, although the help text describes different semantics. Is the per-lane auto selection coming in a follow-up?
| /** | ||
| * @return worker's iface v2 attributes by resource index | ||
| */ | ||
| static UCS_F_ALWAYS_INLINE uct_iface_attr_v2_t* |
There was a problem hiding this comment.
minor: duplicate v2 queries — ucp_proto_common_find_lanes() (proto_common.c:602) and proto_multi.c:597 still call uct_iface_query_v2() per protocol init for the same static v2 cap flags that are now cached. Maybe use this helper there instead?
|
PR-level gap: no test exercises the new config value. Please add a test that creates an endpoint with |
Default UCX_FAILOVER_MODE to software until token failover is complete. The token suite stays off until --gtest_also_run_disabled_tests. It uses the same transport matrix and skips when lane selection finds no token-capable transport.
Token recovery is not implemented, so automatic selection uses the software PSN protocol and does not change the transport set. Protocol init reads iface v2 attributes cached at open.
|
🤖 Starting review — findings will be posted here when done. |
| const uint64_t basic_mask = UCT_IFACE_ATTR_FIELD_CAP_FLAGS | | ||
| UCT_IFACE_ATTR_FIELD_MAX_PUT_SGL_ZCOPY_COUNT | | ||
| UCT_IFACE_ATTR_FIELD_MAX_GET_SGL_ZCOPY_COUNT; | ||
| const uint64_t token_mask = UCT_IFACE_ATTR_FIELD_TX_TOKEN_LENGTH | |
There was a problem hiding this comment.
Nothing reads tx_token_length/rx_token_length in this PR — can we query only the basic fields now and add the token lengths together with the code that consumes them? It would also drop this fallback and the second uct_iface_query_v2() call that every non-token transport now does at open.
| { | ||
| ucp_rsc_index_t rsc_index; | ||
|
|
||
| memset(tl_bitmap_out, 0, sizeof(*tl_bitmap_out)); |
There was a problem hiding this comment.
| memset(tl_bitmap_out, 0, sizeof(*tl_bitmap_out)); | |
| UCS_STATIC_BITMAP_RESET_ALL(tl_bitmap_out); |
Minor: pls use the bitmap API instead of memset, as in the rest of this file.
| if ((key->err_mode == UCP_ERR_HANDLING_MODE_FAILOVER) && | ||
| (worker->context->config.ext.failover_mode == | ||
| UCP_FAILOVER_MODE_TOKEN)) { | ||
| ucp_wireup_filter_token_tls(worker, &tl_bitmap, &tl_bitmap_filtered); |
There was a problem hiding this comment.
If no transport reports QUERY_TOKEN, tl_bitmap_filtered becomes zero and the failure surfaces later as the generic "no am transport to " error. Can we detect the empty result here and log why all transports were disabled?
|
In the Residual coverage gap (already raised in the earlier review): the token path is only covered by |
|
|
#11995 is the first step of that protocol. Without transport filtering we cannot force token based protocol to make sure that everything works as expected. Default "auto" will work via tokens once we have FT tests passed with forced token mode, currently these test suite is disabled and require extra flags for |
|
👍🏼 |
What?
add UCX_FAILOVER_MODE parameter
Why?
to control failover mode