Repository navigation
[TENT] Cover the RDMA context enable failure paths and link-speed events without an RNIC - #4263
Merged
alogfans merged 1 commit intoSep 22, 2026
Conversation
SongOf
requested review from
00fish0,
alogfans,
chestnut-Q,
doujiang24,
dtcccc and
staryxchen
as code owners
September 21, 2026 16:28
SongOf
force-pushed
the
test/tent-rdma-context-lifecycle
branch
from
September 21, 2026 17:09
a8ed369 to
c77ec5e
Compare
…nts without an RNIC
SongOf
force-pushed
the
test/tent-rdma-context-lifecycle
branch
from
September 21, 2026 17:23
c77ec5e to
7e05f33
Compare
2 of 3 tasks
This was referenced Sep 29, 2026
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
RdmaContext::enable()acquires a device, a PD, an epoll set, completion channels, data CQs and a notification CQ in order, and #3325 made a failure between any two steps release what had been acquired so far. None of that has been testable without an RNIC. The per-context verbs table from #3777 lets a test stand in for individual verbs, butopenDevice()still called libibverbs directly for its GID scan, andibv_query_gid_ex()is a header inline that dereferencescontext->device, so a stand-inibv_contextcrashed inside the library beforeenable()got anywhere.Two small production changes open the seam:
_ibv_query_gid_ex, the entry point behind that inline, joinsIbvSymbolswith aQueryGidEx()helper hidingentry_size, and the three GID-scan call sites go through the table. The binary already links the symbol, so requiring it loses no host.kIbvEventDeviceSpeedChangenamesIBV_EVENT_DEVICE_SPEED_CHANGEwhere the header lacks the enumerator (the async-event ABI is append-only, so its value is 20, afterWQ_FATAL), andapplyContextEvent()switches onint. The branch that handles a speed change without a link flap is now compiled and tested everywhere instead of sitting behind#ifdef. Astatic_assertpins the fallback to the real enumerator on any build whose header has it, so a header that ever broke the append-only rule fails to compile rather than misroute an event.On that seam, a
FakeRnicstands in for a whole device with live counters of what is currently held, and 19 cases cover:enable()andopenDevice()— unknown name, open failure,ibv_query_device, port out of range, no usable GID,ibv_alloc_pd, a later completion channel, a later data CQ, the notification CQ, the final port query — each asserting nothing is left held on either the device or the context;DEVICE_PAUSEDwith everything built;openDevice()seeds the effective speed, and falls back to the encoded rate when the verb reports 0;Workers::applyContextEvent:PORT_ACTIVEre-seeds the selector only when the speed changed and still recovers the device when its re-read fails;DEVICE_SPEED_CHANGEre-seeds without touching availability, keeps the EWMA at an unchanged speed, and changes nothing when the re-read fails.Not covered:
epoll_create1and the fcntl/epoll_ctl exits, which are syscalls the table cannot stand in for, and theactive_speed_exdecode, which the build image's rdma-core header lacks.Module
mooncake-transfer-engine)mooncake-store)mooncake-conductor)mooncake-reshard)mooncake-ep)mooncake-pg)mooncake-integration)mooncake-p2p-store)mooncake-wheel)mooncake-common)mooncake-rl)Type of Change
How Has This Been Tested?
Every case was red-checked by disabling the production line it is about: removing the
disable()call after any fakeable acquisition inenable()(PD, completion channel, data CQ, notification CQ, final port query) fails exactly the matching case; leaking the scoped device handle on theibv_query_deviceor no-GID exit, or skippingibv_free_device_listafter a failed open, fails exactly the threeopenDevice()cases and no other; putting the speed-change branch back behind#ifdeffails all three of its cases, since each asserts the re-read happened.Test commands:
Test results:
tent_rdma_transport_test: 104 passed, 2 skipped for want of an RDMA device, same asmain)Checklist
./scripts/code_format.shAI Assistance Disclosure
Claude Code helped design the stand-in device, write the cases and the two seam changes. Every changed line has been reviewed by the submitter.