fix(iouring): correct IORING_NOTIF_USAGE_ZC_COPIED constant and treat loopback as functional probe (#465) - #489
Open
FumingPower3925 wants to merge 3 commits into
Open
Conversation
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.
Closes #465
1. Reproduction
msa2-client, kernel7.0.0-30-generic), base commitf4749e9probeSendZC()against loopbackThe probe erroneously reported "true zero-copy" from a loopback socket, which Linux networking always copies via
skb_orphan_frags_rx.2. Root cause
In
engine/iouring/probe.go:73,notifUsageZCCopied = 2was defined as bit 1, whereas the Linux kernel UAPI definesIORING_NOTIF_USAGE_ZC_COPIED = (1U << 31). The bitwise checknotifRes¬ifUsageZCCopied != 0checked bit 1 instead of bit 31 and could never evaluate to true, causing the probe on loopback to always fall through toSendZCTrueZeroCopy. Additionally,completionEntry.Resisint32, requiring an unsigned castuint32(notifRes)¬ifUsageZCCopiedto avoid overflow.3. Fix
notifUsageZCCopied uint32 = 1 << 31and updated comparison touint32(notifRes)¬ifUsageZCCopied != 0.parseSendZCResultto evaluate probe CQE outcomes (SendZCUnsupported,SendZCBroken,SendZCNoNotification,SendZCCopyFallback,SendZCTrueZeroCopy).CQE_F_MOREon initial CQE as distinctSendZCNoNotification(opcode accepted but notification unobserved; excluded fromfunctional)."notification CQE wait failed: <err>".rawConn.Controland verifiedfd > 0.SendZCCopyFallbackon loopback as confirmation that SEND_ZC opcode and notification delivery are functional in the kernel. Honest logging:functional=true loopback="copy-fallback (expected)".resolveSendZCPolicy(functional, envVal)keepsprofile.SendZCenabled when the functional probe passes (default unchanged). Final default decision is pending a measured cluster fabric A/B benchmark once the cluster is free (~2026-09-08). Explicit overridesCELERIS_IOURING_SEND_ZC=on|1|trueandoff|0|falseare supported; unrecognized values log a warning and fall back toauto.CELERIS_IOURING_SEND_ZC,CELERIS_IOURING_MULTISHOT_RECV,CELERIS_IOURING_PBUF_COUNT, andCELERIS_MAX_IOURING_TIERinengine/iouring/doc.go, including clamping and registration-failure fallback behavior. Removed duplicate package comment inengine.go.TestParseSendZCResult), constant correctness (TestNotifUsageZCCopiedConstant), live loopback probe execution (TestProbeSendZCLiveLoopback), and policy resolution (TestResolveSendZCPolicy).TestProbeSendZCLiveLoopbackskips cleanly on runners where io_uring or SEND_ZC is unsupported.4. Proof
msa2-client, kernel7.0.0-30-generic):msa2-clientnow report:engine/iouringtest suite passed cleanly onmsa2-client.5. Performance
probeSendZCexecutes at most once during process startup viasync.Once.sendZCMinBytes = 32768, unlinked-only) preserved.6. Not verified
msr1pending until the cluster finishes soak/benchmark; cross-compiled cleanly for arm64).get-json-64k,ws-large-echo, streaming cell, alternating builds, >=3 trials) pending cluster availability (~2026-09-08).