test(agc): reserve the arena host hole the write-tracking checks query #4746
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/4746"
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 boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T20:34:59Z.
What
agc_driver_graphicsfails now and then in the Windows job, on pull requests that do not touch the arena, and passes on a re-run:Three of the runs: 38222544270, 38224130565, 38284199193 (first attempt of each).
The cause is the test, not the exclusion. On Windows the arena is reserved while
libcloads, before any code of the test executable runs, and its host regions are whatever the process had already mapped in the arena interval at that moment. Where Windows places those mappings changes with every start, and on some starts none of them lies in the interval. The arena then has no host hole, andhostWriteWatchExclusionTests(#3594) requires one. #4660 counted 5 such starts in 200, and #4186 saw the same and madeagc_write_trackingprint that its host-hole checks were skipped. So today the host-hole exclusion is checked on most starts, fails one test on the others and is silently not checked by the second.This change makes the hole exist on every start:
agc_write_trackingstarts itself suspended with--host-hole, reserves one allocation granule in the middle of the child's arena interval withVirtualAllocEx, and resumes it. The child's loader has not run yet, so when itslibcreserves the arena that range is already taken and becomes a host region.agc_write_tracking.hostWriteWatchExclusionTestsmade on an enumerated hole (Watched,CollectWritesUncached,UnchangedSince,UnchangedSinceAll) are removed fromagc_driver_graphics: the child makes the same four and eight more. Its checks on ordinary host heap memory stay.No production code changes.
#4660 is open for the same failure and replaces the
Requirewith a printed line. That stops the failure; the exclusion is then still not checked on the starts without a hole. The two touch the same lines ofBdaResources.cpp, so only one of them can go in.Tested
Windows was not run: I have no Windows machine. Everything this change adds is inside
#ifdef _WIN32, so the Windows job on this pull request is the test.agc_write_trackinghas to pass there, and since the child fails when its range is not a host region, a pass means the hole was reserved and queried on that start.agc_driver_graphicscan no longer fail with the message above, because the check is gone from it. A few re-runs of the Windows job would show it holds across address layouts.Linux (CachyOS, GCC 16, Release, CI configure flags), on
main1acfa7f78:agc_write_tracking_testsandagc_driver_graphics_testsbuild;ctest -R "agc_driver_graphics|agc_write_tracking"passes 2 of 2. On Linux the two files compile to what they did before, apart from one added include.WriteTracking.cppandBdaResources.cppwas type-checked withg++ -fsyntax-only -D_WIN32against Wine's Windows headers, with no errors or warnings. That checks names and types only; nothing was linked or run.python3 tools/check_conventions.py --base origin/mainandpython3 tools/check_test_registration.py buildpass;tools/tests/test_check_skips.pypasses 13 of 13.Not tested: that
VirtualAllocExon the suspended child succeeds on the CI runner, and that the child's arena reports the range as a host region. Both are read from the code (Arena()records every region thatVirtualQueryreports as not free as a host region) and both are required by the test, so a wrong assumption fails the Windows job on every run instead of now and then.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-12T20:35:09Z.
@kr4y4 this is an alternative to #4660 for the same failure: it plants the host hole in a child process, so the checks run on every start. I can't run Windows here. Could you run
agc_write_trackingandagc_driver_graphicson this head with--repeat until-fail:50or so, and say whether the child's output shows in the ctest log? IfVirtualAllocExinto the suspended child or the host-region check fails there, it will fail on every run, not now and then.Imported from boykopovar/AnyPS5. Originally posted by github-actions[bot] on 2026-10-12T20:45:07Z.
Other open pull requests touch the same code. Merging one will break the other, or both implement the same thing. If this one builds on them, list them in Depends on.
main)core/libs/prx/libSceAgcDriver/tests/BdaResources.cppL807-829Imported from boykopovar/AnyPS5. Originally posted by kr4y4 on 2026-10-12T21:07:24Z.
Windows run, since the description had none.
Setup: Windows 11 (26200), WinLibs GCC 15.2.0 r7, Release, CI configure flags, an RTX 4070 Laptop GPU and an Intel Raptor Lake-S iGPU. The head
59db660f7merged intomain42496c5e5.agc_write_trackingpasses with--repeat until-fail:100on both GPUs, at about 0.17 s a run, and printswrite tracking tests passed. So theVirtualAllocExon the suspended child and the child's host-region check held on every start.VirtualAllocExcall replaced locally byreserved = true, it fails on both GPUs withthe range reserved before the arena is not an arena host regionand thenthe host-hole child failed. So a pass does mean the hole was reserved and queried.agc_driver_graphicspasses on both GPUs with--repeat until-fail:3.ctest --timeout 120 --parallel 4): 1007 of 1007 on both GPUs.Written with AI assistance.