Skip to content

UCP/PROTO: Repost GET and zcopy on the selected lane. - #12091

Merged
evgeny-leksikov merged 8 commits into
openucx:masterfrom
evgeny-leksikov:ucp_tf_proto_repost
Oct 16, 2026
Merged

evgeny-leksikov merged 8 commits into
openucx:masterfrom
evgeny-leksikov:ucp_tf_proto_repost

Conversation

@evgeny-leksikov

@evgeny-leksikov evgeny-leksikov commented Oct 15, 2026 •

Copy link
Copy Markdown
Contributor

What?

  • Repost GET bcopy/zcopy as well as PUT and AM from one protocol instance.
  • Translate the origin rkey and memory handle onto the repost lane.
  • When saving the purged operation fails after the descriptor is stored, complete the origin once and return success so a purge callback does not complete it again.

Translate the origin rkey and memory handle, and complete the origin once when the purged operation cannot be saved.
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

Comment thread src/ucp/proto/proto_repost.c Resolved
Comment thread src/ucp/proto/proto_repost.c Resolved
Comment thread src/ucp/proto/proto_repost.c Resolved
Comment thread src/ucp/proto/proto_repost.c Resolved
Comment thread src/ucp/proto/proto_repost.c Resolved
Comment thread src/ucp/proto/proto_repost.c Resolved
Comment thread src/ucp/proto/proto_repost.c Resolved
@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

@evgeny-leksikov
evgeny-leksikov marked this pull request as ready for review October 15, 2026 18:05
return origin->send.rndv.rkey;
}

return origin->send.rma.rkey;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if the repost lane fails? origin is then another repost request, so send.rma.rkey is send.repost.buffer and reads the iov ptr as an rkey.

@svc-ucx

svc-ucx commented Oct 15, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Tests gpu on worker 0) · commit 4e3efe4a

TL;DR: The gtest run aborted on a UCT assertion (!(txwq->flags & UCT_IB_MLX5_TXWQ_FLAG_FAILED), rc_mlx5.inl:498) while dcx/test_ucp_fault_tolerance.initiator_failure/6 <dc_x/GET|MSG_LARGE> was in its "Checking recovery status" phase — a GET zcopy was posted on a DC lane whose TXWQ is still flagged FAILED, because the new repost protocol on this branch picks its lane from a probe-time cached index and never validates it against the EP's current failed-lane state.

Full analysis

Summary: make test in the gpu worker-0 job aborted (core dumped) on a fatal assertion inside uct_dc_mlx5_ep_get_zcopy during dcx/test_ucp_fault_tolerance.initiator_failure/6 <dc_x/GET|MSG_LARGE>.

Root cause: From the log, the test injected a failure on lane 0/2, the GET succeeded, and then during Checking recovery status... a GET zcopy was posted down to DC:

[ RUN ] dcx/test_ucp_fault_tolerance.initiator_failure/6 <dc_x/GET|MSG_LARGE>
[INFO] Attempting GET|MSG_LARGE operation after failure injection on lane 0/2...
[INFO] Success
[INFO] Checking recovery status...
rc_mlx5.inl:498  Assertion `!(txwq->flags & UCT_IB_MLX5_TXWQ_FLAG_FAILED)' failed
  3 libuct_ib_mlx5.so.0(uct_dc_mlx5_ep_get_zcopy+0x1150)
  4 libucp.so.0(+0xc12e1)
  5 libucp.so.0(ucp_get_nbx+0x42a)

uct_rc_mlx5_common_post_send() only allows MLX5_OPCODE_NOP once a TXWQ has UCT_IB_MLX5_TXWQ_FLAG_FAILED (src/uct/ib/mlx5/rc/rc_mlx5.inl:495-499). So a real GET_ZCOPY WQE reached a DCI TXWQ that is still in the failed state, i.e. UCP considered the lane usable/recovered (ucp_ep_get_failed_lanes() == 0 is what test_recovery() waits for, test/gtest/ucp/test_ucp_fault_tolerance.cc:582-591) while the underlying DC TXWQ had not been reset yet.

This branch (ucp_tf_proto_repost) is exactly what changes that flow: it introduces the "repost" protocol that re-issues purged operations instead of aborting them. ucp_proto_repost_probe() resolves the target lane once via ucp_proto_common_find_lanes() and caches it in rpriv->lane (src/ucp/proto/proto_repost.c:69-72); ucp_proto_repost_progress() and ucp_proto_repost_submit() then only guard against UCP_NULL_LANE / uct_ep == NULL (proto_repost.c:412-421, 581-584) — there is no check against ucp_ep_get_failed_lanes(ep) / ucp_is_uct_ep_failed(uct_ep), and no re-resolution of the lane at submit time. Reposting PUT/GET zcopy traffic onto a lane that is failed-but-not-yet-reset (or re-enabling the lane for new ops before the DCI reset completes) is precisely what makes a non-NOP WQE hit a FAILED TXWQ. The base branch does not run this path, which is why only this PR fails.

Implicated commit: The PR #12091 repost series by Evgeny Leksikov: be06f81f "UCP/PROTO: Repost GET and zcopy on the selected lane.", 3b895b75 "Repost from the protocol request that owns the completion.", 8183140c, [REDACTED:Hex High Entropy String], 9e875d39, and HEAD 4e3efe4a "UCP/PROTO: Abort a failed repost save once."

File: src/ucp/proto/proto_repost.c:412-421 and :481-490 (lane validation / GET_ZCOPY repost); assertion site src/uct/ib/mlx5/rc/rc_mlx5.inl:498; failing test test/gtest/ucp/test_ucp_fault_tolerance.cc:582-629

Suggested fix:

  1. Validate the lane at repost time instead of trusting the probe-time cache: in ucp_proto_repost_submit()/ucp_proto_repost_progress(), abort/defer with UCS_ERR_UNREACHABLE/pending if ucp_ep_get_failed_lanes(ep) & UCS_BIT(rpriv->lane) or ucp_is_uct_ep_failed(ucp_ep_get_lane(ep, lane)) or ucp_wireup_ep_test() is true, and re-select a live lane (the same predicate used by ucp_ep_recovery_is_lane_connected(), src/ucp/core/ucp_ep.c:187-193).
  2. Make the repost wait until the lane's UCT resources are actually reset — add the request to the lane's pending queue and only post after the DCI/TXWQ FAILED flag has been cleared, so UCP never clears the failed-lane bit (which test_recovery() polls) while the DC TXWQ is still failed.
  3. To reproduce locally: GTEST_FILTER='dcx/test_ucp_fault_tolerance.initiator_failure/6' on a dc_x-capable node with assertions enabled.

Related: PR #12091 (this branch), PR #12047 (predecessor "Repost an undelivered operation from one protocol instance"), PR #12048 ("UCP/FT: Purge an unaware lane before rebuilding its address"), PR #12062 ("UCT/IB/MLX5: support flush remote in purge outstanding"), PR #12065 (added the PUT/GET small/medium/large FT variants that expose this)

🛡️ This comment had 1 potential secret(s) redacted (Hex High Entropy String). See request_id 7b435177-98ba-4761-9087-07ad130ceb3a in the triage console for the audit trail.

@svc-nvidia-pr-review

Copy link
Copy Markdown

🤖 Starting review — findings will be posted here when done.

@gleon99 gleon99 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏼

@evgeny-leksikov
evgeny-leksikov enabled auto-merge (squash) October 15, 2026 21:05
@svc-ucx

svc-ucx commented Oct 15, 2026

Copy link
Copy Markdown

🤖 CI Triage Agent — UCX PR (Tests roce on worker 0) · commit fc2c70d5

TL;DR: The build failed in the test_ucm_hooks shell stage — ./test/apps/test_hooks -n 57 segfaulted at iteration 5/30, which is the known inherent race in UCM bistro's non-atomic code patching, not anything in PR #12091 (a UCP proto change that touches no UCM code). Re-run to confirm the flake; the durable fix is to make the bistro patch lock cover the full first instruction (and unbuffer test_hooks output so the log is actually useful).

Full analysis

Summary: contrib/test_jenkins.sh line 1115 → timeout 10 ./test/apps/test_hooks -n 57 died with SIGSEGV ("timeout: the monitored command dumped core"), causing exit 1 and ##[error]Bash exited with code '1'.

Root cause: The gtest portion of this job ran only *test_obj_size*:*test_ucp_tag_match.rndv_rts_unexp* and passed (1 test, 2 ms), so none of the PR's UCP protocol code was exercised before the failure. The crash is in the UCM bistro hook stress test, which deliberately races N threads calling mmap() against live function patching (test/apps/test_hooks.c:83). On x86_64, ucm_bistro_apply_patch_atomic() (src/ucm/bistro/bistro.c:83-97) serializes only the first 2 bytes via ucm_bistro_patch_lock() writing jmp %rip-2 (src/ucm/bistro/bistro_x86_64.c:311-326), then after a timed grace period (ucm_global_opts.bistro_grace_duration, a busy sched_yield() loop, not a real quiescence barrier) memcpys the remaining 3-13 payload bytes over live code. A thread that has already fetched/entered the function beyond byte 2 can execute a half-old/half-new instruction stream → SIGSEGV. The comment at bistro_x86_64.c:315-325 explicitly acknowledges this truncation window is only reduced, not eliminated. With 57 threads (NPROC-scaled, random per iteration) on a 72-core agent, the window is hit occasionally — classic flake, iteration-and-thread-count dependent.

Secondary finding: test_hooks.log was empty apart from the timeout message, even though main() prints thread timeout, started N threads, and loading library.... Because stdout is redirected to a file it is fully buffered, and SIGSEGV discards the buffer — so the test produces no diagnostic evidence at all on the one path where it matters.

Also note a pre-existing unrelated breakage visible earlier in the same log: ./test/apps/test_ucp_config: error: '.../build-test/test/apps/.libs/test_ucp_config' does not exist — the libtool wrapper ran without the binary being built. That one is non-fatal (grep finds nothing, so the check passes vacuously), but it means the module allow-list check at contrib/test_jenkins.sh:1104 is silently testing nothing.

Implicated commit: Not PR #12091 / fc2c70d. The racy mechanism comes from 676b579 (Thomas Vegas, "UCM/BISTRO: Add locking step while patching library functions") and was last tuned in c77bb48 (shasson5, "UCM/BISTRO: Increase grace time to reduce patch race (#11112)") — a mitigation that narrowed but did not close the window.

File: src/ucm/bistro/bistro.c:86-97 (grace loop + unprotected payload memcpy); src/ucm/bistro/bistro_x86_64.c:309-327 (2-byte lock); harness at contrib/test_jenkins.sh:1119

Suggested fix:

  1. Unblock the PR: re-run the roce on worker 0 job. The failure is in a component untouched by UCP/PROTO: Repost GET and zcopy on the selected lane. #12091 and the PR's own tests passed, so this should not gate the merge.
  2. Make the failure debuggable (do this first — it costs nothing): add setvbuf(stdout, NULL, _IONBF, 0) at the top of main() in test/apps/test_hooks.c, or run it under stdbuf -o0 -e0 in contrib/test_jenkins.sh:1119. Also print the thread count and iteration into the log so a core dump can be correlated. Right now a crash yields zero information.
  3. Capture the core: have test_ucm_hooks() run gdb -batch -ex bt on the core (or set ulimit -c unlimited plus an artifact upload) so the next occurrence shows whether the faulting RIP is inside the patched mmap prologue — that would definitively confirm the truncated-instruction theory versus some other bug.
  4. Real fix for the race: replace the timed grace period with a genuine quiescence mechanism — e.g. membarrier(MEMBARRIER_CMD_PRIVATE_EXPEDITED_SYNC_CORE) to force other cores to re-fetch, or patch the whole first instruction atomically (align the patch site and use a single 8-byte ucs_atomic_swap64 for the first instruction instead of a 2-byte jmp self followed by a plain memcpy). Writing the full near-jump (5 bytes, bistro_x86_64.c:337-357) inside one aligned atomic store would remove the window entirely for the common non-far-jump case.
  5. Separate bug: investigate why test/apps/.libs/test_ucp_config was missing at contrib/test_jenkins.sh:1104, and make that check fail loudly (set -e / explicit existence test) rather than passing vacuously when the binary is absent.

Related: PR #12091 (UCP/PROTO: Repost GET and zcopy on the selected lane) — the triggering PR, not the cause. Mitigation history: #11112 (UCM/BISTRO: Increase grace time to reduce patch race). No existing open issue tracks test_hooks segfault flakiness; worth filing one with the core backtrace once item 3 is in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants