xcrdapi: prefer live non-zero page tokens when TO_PAGES reads run #465
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/465"
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?
Imported from brcly/TuxBox. Originally posted by DrArroway on 2026-11-29T11:11:52Z.
Summary
Fixes #457 (crediting
@Jerkin42's report and diagnosis).TO_PAGESrequests can point into reused page-token arrays that still hold stale non-zero tokens atEnqueueRequestand are overwritten with new tokens beforeSubmit. Previously,Read::page_tokensonly re-read the array when the enqueue snapshot contained0, and kept every non-zero enqueue entry, causing writes to land in stale pages.runtime/xcrdapi/src/queue.rs: Always re-read the live page-token array viaReadProcessMemorywhen aTO_PAGESrequest runs and prefer every live non-zero entry (merge_page_tokens), falling back to the enqueue snapshot only when an entry was cleared to0or the array is unreadable.runtime/xcrdapi/src/diag.rs: Adddiag::replaced_pageswith its own capped counter so arrays whose non-zero tokens changed afterEnqueueRequestare logged separately from zero-to-nonzerolate_pagesfills (log_page_change).runtime/xcrdapi/src/tests/queue.rs: Add unit tests covering late fills, replaced non-zero tokens, cleared-to-zero fallback, and mixed multi-page arrays.runtime/xcrdapi/guest.cpp&project_tuxbox/verify.py: Extend thexcrdapiguest fixture (pages=3) to enqueue a reused array whose non-zero token is overwritten beforeSubmit, verifying the write lands in the new page and does not overwrite the stale page.Tested
xcrdapiis a storage provider covered by its own guest fixturexcrdapi-read.exe, extended here frompages=2topages=3, plus Rust unit tests inruntime/xcrdapi/src/tests/queue.rs)xcrdapiis CPU/storage-only (tested on both AMD adapters below; native Windows / NVIDIA still need to run if desired)GPU, driver and backend:
1002:73bf), Mesa RADV 26.3.1,GE-Proton11-14(Linux 7.3.6)1002:164e), Mesa RADV 26.3.1,GE-Proton11-14(Linux 7.3.6)Commands run and their results:
Imported from brcly/TuxBox. Originally posted by NickStallman on 2026-11-29T11:20:18Z.
Useful timing: I've queued the full NVIDIA check of
fc69bc23on an RTX 5090 (it includes thexcrdapifixture) and will post it.One data point from my own runs, which neither proves nor disproves #457: our build logs only the zero-to-filled case ("page array #N ... was filled after its request was enqueued"). In four ProjectScarlett runs on the 5090 that ended in a title CPU crash it went past #24577 in each, and every entry in the log's sampled lines was
0x0at enqueue. A replaced non-zero token would not have been logged at all: that build has no line for it. Yourreplaced_pagescounter is what can say whether those crashes are the same thing, so I'll put this branch in my next game build and post what it counts.