fix(agc): read polled guest labels with acquire loads #20185
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/20185"
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 chitters2004 on 2026-11-14T19:42:20Z.
What
The PM4 wait (
Pm4::WaitSatisfiedUnchecked) and the other guest-label polls read labels throughvolatilepointers, while other threads store those labels atomically. That's a data race, and ThreadSanitizer reports it. The polls are:Submission.cpp;WaitMemory.cpp;WaitStatistics.cpp.They now go through a new
Pm4::LoadLabel(address, bytes), anstd::atomic_refacquire load.movas the volatile read (checked with g++ -O2); on arm64ldrbecomesldar.docs/dev/BUILD.md's TSan note is reworded: polls are acquire loads now, but guest memory is still written with plain stores (copies, replay restores), so TSan still reports those stores against the polls.Tested
ThreadSanitizer, gcc 13 RelWithDebInfo with
ANYPS5_ENABLE_TSAN=ON, Linux, llvmpipe,halt_on_error=0, no suppressions. Same machine, main6786420207vs this branch, 3 runs each:agc_driver_flipagc_driver_pm4_rewind_tracePm4::WaitSatisfiedUnchecked.agc_driver_pm4*test passes under TSan exceptagc_driver_pm4(3 reports) andagc_driver_pm4_replay(1). All four of those reports have a plainmemcpywriter (replay restore), the class this change doesn't touch.74900e8b0f(flip, frame replay, pm4, pm4 replay, guest PM4; 76 tests) went from 45 reports to 28; the remaining 28 all have a plain writer.tools/check_conventions.py --base origin/main: passes.Fork CI on this tree (run 43629894526): the Linux gate and the Windows build pass the listed tests.
memcpywriter (replay restore,GuestMemory::Write) with the now-atomic polls: the writer-side class described above.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)🤖 Generated with Claude Code
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T20:48:42Z.
Review: COMMENTED
Reviewed — comments
The change is consistent with the stated goal, but I could not run the reported checks, so a formal approval is not justified.
What I ran
Reviewed head
0d4d85d8e1af9f53defb66127fde944085cc8951using the prepared diff and pinned reader. No tests or build commands were run.Results
Negative control
Not run; no test command could be run in this review.
Findings
Blocking
None.
Non-blocking
None.
Sources
The acquire-load helper and its changed poll call sites are visible in the pinned PM4 header, wait implementation, submission paths, wait-memory paths, and wait statistics.
Not verified
The PR description reports TSan, convention-check, and CI results, but they were not run here.
review/files.jsonwas unavailable; the manifest lists seven changed files, and all seven changed paths were inspected through the diff and targeted reader ranges. Full file texts were not read. The debt entry and build documentation were checked at their changed sections.To get this to a good state
Nothing is required. Optional: run the reported checks on this head to independently confirm the PR description.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-15T02:41:00Z.
Review: APPROVED
Reviewed — looks good
Nothing blocks this change; the reviewed code and added tests support merging.
What I ran
Reviewed head
e3d9cefb3a6bc4aefbb8736b636d34cb0105d2d0against basemain. I read the prepared description, commit list, manifest, full diff, and all changed lines in the ten changed files usingrepo_read.py's review reader. I also read the relevant wait decoding and guest-memory access context. No commands or tests were run by me; test results below are author-reported.Results
Negative control
Not run; no test modification or injected failure was performed.
Findings
Blocking
None.
Non-blocking
None.
Sources
Behavior claims are based on the reviewed diff and repository files at the specified head; no external links were used.
Not verified
I did not run the test suite, TSan, convention checker, or CI, and did not verify the author-reported runs. I read all changed lines listed in the manifest; no changed file was excluded by the bundle. I did not read every unchanged line of the ten changed files or unrelated repository files.
To get this to a good state
Nothing is required.
Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T13:12:56Z.
Review: COMMENTED
Reviewed — comments
Changes are required before merge: resolve the documented mismatch between wait and label store widths, which means the acquire load may not pair with the publishing store.
What I ran
Reviewed head
2e95be1bfebdda57fcd550801f10c2f503fea1fc. I read the prepared description, commits, manifest, diff, and all ten changed files listed in the manifest. I did not run tests or builds;repo_read.pywas the only reader used. The author reports TSan and CI results in the description; those were not independently run or verified.Results
Findings
Blocking
None. The mismatch is documented as a limitation in the changed debt entry, but the reviewed code does not establish that it causes a concrete defect on this change.
Non-blocking
core/libs/prx/libSceAgcDriver/Execution/include/Pm4.hpp:116anddocs/dev/debt/libSceAgcDriver.md:487.Not verified
files.jsonwas unavailable through the reader; the manifest lists ten changed files and all ten were read. No additional exclusions were inspected.To get this to a good state
Nothing is required. The width mismatch is optional follow-up feedback, as described above.