Repository navigation
UCT: add token query support in ucx - #11804
Conversation
636a850 to
4806968
Compare
4806968 to
9b1ba91
Compare
| uct_rc_mlx5_tx_token_t tx_token = {}; | ||
| uct_rc_mlx5_rx_token_t rx_token = {}; | ||
| uint32_t rx_count = 0; |
evgeny-leksikov
left a comment
There was a problem hiding this comment.
LGTM besides few minor comments
|
🤖 CI Triage Agent — TL;DR: The Coverity Full analysisSummary: Root cause: Both defects originate at Implicated commit: File: Suggested fix: Make the pointer contract explicit so both the code is safer and Coverity's path is pruned: static ucs_status_t
uct_rc_mlx5_iface_query_rx_token(uct_iface_h tl_iface,
uct_iface_attr_v2_t *iface_attr)
{
...
if (!(iface_attr->field_mask & UCT_IFACE_ATTR_FIELD_TX_TOKEN)) {
ucs_error("rc mlx5: tx token is required to query rx token");
return UCS_ERR_INVALID_PARAM;
}
if ((iface_attr->tx_token == NULL) || (iface_attr->rx_token == NULL)) {
ucs_error("rc mlx5: tx/rx token pointer is NULL");
return UCS_ERR_INVALID_PARAM;
}
...
}Secondary hardening (optional but recommended): in Related: PR #11804 ( |
|
@jeynmann shouldn't we remove |
Hi, @roiedanino Removed leftovers. |
| ext_attr->tx_token = iface_attr->tx_token; | ||
| tx_token = iface_attr->tx_token; | ||
| iface = ucs_derived_of(tl_iface, uct_rc_iface_t); | ||
| remote_qpn = be32toh(*tx_token); |
There was a problem hiding this comment.
maybe we should check remote_qpn (smaller than UCS_BIT(UCT_IB_QPN_ORDER)) is in range? this is not on fast-path
|
|
||
| uct_iface_query_v2_init(tl_iface, iface_attr); | ||
|
|
||
| #if HAVE_DEVX |
There was a problem hiding this comment.
It would be better to check UCT_IB_MLX5_MD_FLAG_DEVX at runtime rather than (or in addition to) how UCX was compiled
|
🤖 Starting review — findings will be posted here when done. |
| void *qpc; | ||
|
|
||
| /* suppress coverity false-positive */ | ||
| ucs_assert((iface_attr->tx_token != NULL) && |
There was a problem hiding this comment.
NULL token pointers are only guarded by ucs_assert, which is compiled out in release builds. The removed uct_ib_mlx5_ext_iface_query_check_param returned UCS_ERR_INVALID_PARAM when tx_token/rx_token were NULL while their field-mask bits were set. Now a caller that sets UCT_IFACE_ATTR_FIELD_TX_TOKEN | UCT_IFACE_ATTR_FIELD_RX_TOKEN but leaves the pointers NULL will dereference NULL at be32toh(*tx_token) / *rx_token = .... The EP path (uct_rc_mlx5_ep_query_tx_token) kept a real runtime check for ep_attr->tx_token == NULL, so this is an inconsistent regression. Suggest replacing the assert with an UCS_ERR_INVALID_PARAM check like the ep path.
| } tx; | ||
| } uct_rc_mlx5_base_ep_t; | ||
|
|
||
| typedef __be32 uct_rc_mlx5_tx_token_t; |
There was a problem hiding this comment.
Double blank line after the new typedefs before the uct_rc_mlx5_ep_t comment block; drop one blank line to match surrounding style.
| @@ -1323,6 +1323,79 @@ UCT_INSTANTIATE_RC_TEST_CASE(test_rc_keepalive) | |||
|
|
|||
There was a problem hiding this comment.
In test_rc_mlx5_token_query.am_short, EXPECT_EQ(NUM_MESSAGES, be32toh(rx_token)) assumes next_rcv_psn equals exactly the number of AM messages. This holds only if no other packets (e.g. FC control, keepalive) are received on that QP. With default config and 10 short AMs this is likely fine, but it is a latent flakiness if FC or other traffic ever lands on the RX side; worth confirming FC is not triggered here.
|
Coverage gaps to confirm: the new iface/ep token paths are only exercised on DEVX-capable HW (test skips otherwise), and there is no negative test for the removed NULL-pointer validation (related to the iface blocker) or for the "tx/rx must be set together" |
What?
Add token query support in ucx.
How?
Implement rx/tx token query via qp query.
Cleanup plugin related code.