d3d12-hle: publish xasync status before removing CALLS entry (D3D12-HLE-XASYNC-WAIT-STATUS-RACE) (carry of #3395) #3438
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!3438
Loading…
Reference in a new issue
No description provided.
Delete branch "carry/3395"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Carry of #3395 by @blud (same commits, head
8b0fb0a84), opened only so the branch can be brought up to date with main: the original branch does not allow maintainer edits and main moved. Credit stays with the author; #3395 will be closed in favour of this one.Already done on
8b0fb0a84: independent review ACCEPTED (lot 1), local tests green, in-game run of 300 s on an RTX 3090 PASS without cost (Enlighted), CI locale green on main6b5ceb934(Oreo).Original description:
Claimed in the coordination issue as:
D3D12-HLE-XASYNC-WAIT-STATUS-RACE(originally claimed in #2570, addressing the CI completion-race finding ond3d12/crates/leonida-hle/src/modules/xasync.rs).What and why
In
d3d12/crates/leonida-hle/src/modules/xasync.rs(complete_call),release(block)previously removedblockfromCALLSand invokedOP_CLEANUPbefore storing the terminalsizeandstatus. When a concurrentXAsyncGetStatus(block, true)arrived in that window,call(block)returnedNone, skipped waiting oncall.done, and readE_PENDINGinstead of the completed status (observed in CI onmodules::xasync::tests::run_returns_the_work_result).This fixes the ordering in two places:
complete_call: forresult < 0 || required_size == 0, runsOP_CLEANUPbefore publishingsizeandstatus(preserving the block-lifetime invariant so no caller can observe completion or freeblockbeforeOP_CLEANUPfinishes), then removesblockfromCALLSaftersize.storeandstatus.store(while still holdingcall.done), so a waiter inXAsyncGetStatus(block, true)can never missCALLSand readE_PENDING.XAsyncBegin: after acquiringleft.doneon an existing entry, re-checksis_current(&left, block)before requiringzeroed(block)and callingrelease(block), so reusing a failed/no-result block immediately after observing terminal status never spuriously returnsE_INVALIDARG.Tested
main:modules::xasync::tests::get_status_wait_never_observes_pending_during_completionfails deterministically with zero timeout dependence (call must stay in CALLS while status is still E_PENDING, and the concurrent waiter observesE_PENDINGinstead ofE_ABORT).leonida/main99e0bc1ce):cargo test -p leonida-hle --locked modules::xasync—14passed,0failed (covers bothE_ABORTandS_OK, verifying both the zero-timeoutCALLS-during-OP_CLEANUPinvariant and the threaded waiter).cargo test -p leonida-hle --locked—259unit tests +1integration test (no_dll_planting) passed,0failed.python -I scripts/check_no_game_data.py d3d12/crates/leonida-hle/src/modules/xasync.rs— exit0.APPROVE.@merzleckeieron Wine 11.22 MSVC — confirmed red onmain(call must stay in CALLS while status is still E_PENDING) and all14XAsync tests green with the fix.GPUs tested: n/a (
leonida-hleCPU/concurrency unit tests, no game files or GPU needed).AI-assisted: yes — Gemini 4 Neon via Antigravity (implementation, regression test, and a separate read-only reviewer subagent using Gemini 4 Neon).
Checklist
main(99e0bc1ce) and merges cleanly.docs/design.md, with how it was confirmed (n/a: no translator rule changed).🤖 Generated with Claude Code
Merging. Tree checked equal to main
99817c3a0+8b0fb0a84;cargo test -p leonida-hle --lockedon that merge: 279 passed, 0 failed. In-game run PASS on an RTX 3090 (Enlighted), independent review ACCEPTED.🤖 Generated with Claude Code