test(agc): invalidate the guest page cache in the depth fixtures #20134

Merged
oneandonlydean merged 2 commits from upstream-pr/20134 into main 2026-11-14 19:35:10 +00:00
oneandonlydean commented 2026-11-14 17:32:02 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-11-14T17:32:02Z.


What

The Windows job intermittently fails agc_driver_graphics and agc_graphics_profile_draw at the Require in tests/DepthSurfaceReuse.cpp (TestPartiallyResidentPlanes).

Cause: TestReadOnlyStalePlaneFlush and TestPartiallyResidentPlanes map pages with raw VirtualAlloc and mprotect, which GuestMemory's page cache does not see. A freed fixture can leave a stale readable run at an address the next fixture reuses, so the unmapped hole page can read as mapped and the partially resident refusal never fires.

Change (test only): the fixtures call GuestAllocationsInvalidate after each mapping change, and TestPartiallyResidentPlanes checks the hole page reads as unmapped before relying on it, so a stale cache fails at that line.

Tested

Linux (release build): agc_driver_graphics passes. Windows (local CI on this head, ed84e19ba9, on main 5358c307c0): full ctest passes, including agc_driver_graphics and agc_graphics_profile_draw.

Checklist

  • Based on current main; no other open PR implements the same functions
  • One topic per PR; follow-ups go in a new PR
  • No comments in code except technical debt
  • Unimplemented paths throw (NotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file
  • No notes, investigation .md files or images added to the repository (attach them to this PR)
  • New third-party code is a submodule built from source
  • Generic behaviour, not specific to one title
  • Depends on: none
  • Fixes: none
  • Unblocks: none
  • GPUs tested: n/a (test fixture only)
  • AI-assisted: yes
<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5314248087 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20134). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-11-14T17:32:02Z. --- ### What The Windows job intermittently fails `agc_driver_graphics` and `agc_graphics_profile_draw` at the Require in `tests/DepthSurfaceReuse.cpp` (TestPartiallyResidentPlanes). Cause: TestReadOnlyStalePlaneFlush and TestPartiallyResidentPlanes map pages with raw VirtualAlloc and mprotect, which GuestMemory's page cache does not see. A freed fixture can leave a stale readable run at an address the next fixture reuses, so the unmapped hole page can read as mapped and the partially resident refusal never fires. Change (test only): the fixtures call GuestAllocationsInvalidate after each mapping change, and TestPartiallyResidentPlanes checks the hole page reads as unmapped before relying on it, so a stale cache fails at that line. ### Tested Linux (release build): `agc_driver_graphics` passes. Windows (local CI on this head, ed84e19ba9, on main 5358c307c0): full ctest passes, including `agc_driver_graphics` and `agc_graphics_profile_draw`. ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main`; no other open PR implements the same functions - [x] One topic per PR; follow-ups go in a new PR - [x] No comments in code except [technical debt](https://github.com/boykopovar/AnyPS5/blob/main/docs/dev/CONVENTIONS.md) - [x] Unimplemented paths throw (`NotImplemented_nid_no_patch`); silent stubs are listed under Silent stubs in their library's [technical debt](https://github.com/boykopovar/AnyPS5/tree/main/docs/dev/debt) file - [x] No notes, investigation `.md` files or images added to the repository (attach them to this PR) - [x] New third-party code is a submodule built from source - [x] Generic behaviour, not specific to one title - [x] Depends on: none - [x] Fixes: none - [x] Unblocks: none - [x] GPUs tested: n/a (test fixture only) - [x] AI-assisted: yes
MarcZX10 commented 2026-11-14 19:05:17 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-14T19:05:17Z.

Review: APPROVED


Reviewed — looks good

The reviewed change at ed84e19ba95ddfa215ed783aa1a364db3bce5f95 adds explicit GuestMemory cache invalidation around fixture mapping changes and asserts the intended hole remains unmapped; no concrete defect was found in the inspected code.

What I ran

No commands or tests were run. I reviewed the prepared diff and read the changed test file, the invalidator implementation, and the committed-range implementation at the pinned head. The author reports a Linux release run; it was not independently run here.

Results

Check Result Note
Diff and targeted source review passed One changed file inspected
Automated tests not run Windows loop remains unverified

Findings

Blocking

None.

Non-blocking

None.

Not verified

The reported Linux test was not independently run, and the intermittent Windows failure was not reproduced. No other changed files were excluded: files.json was not available in the supplied reader interface; the manifest lists one changed file and marks its full text included.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5906606488 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/20134#pullrequestreview-5906606488). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-14T19:05:17Z. **Review:** APPROVED --- # Reviewed — looks good The reviewed change at `ed84e19ba95ddfa215ed783aa1a364db3bce5f95` adds explicit GuestMemory cache invalidation around fixture mapping changes and asserts the intended hole remains unmapped; no concrete defect was found in the inspected code. ## What I ran No commands or tests were run. I reviewed the prepared diff and read the changed test file, the invalidator implementation, and the committed-range implementation at the pinned head. The author reports a Linux release run; it was not independently run here. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted source review | passed | One changed file inspected | | Automated tests | not run | Windows loop remains unverified | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified The reported Linux test was not independently run, and the intermittent Windows failure was not reproduced. No other changed files were excluded: `files.json` was not available in the supplied reader interface; the manifest lists one changed file and marks its full text included. ## To get this to a good state Nothing is required.
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
boykopovar/AnyPS5!20134
No description provided.