perf(agc): trap CPU reads of label readbacks on Linux instead of storing them #19054

Merged
pawcijo merged 22 commits from upstream-pr/19054 into main 2026-11-24 10:32:58 +00:00
pawcijo commented 2026-11-12 17:52:27 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by pawcijo on 2026-11-12T17:52:27Z.


What

Ports the label read traps (2cf5b41ec8) from macOS to Linux. Before a label, a pending linear or small storage image that shares no page with another pending or storing image gets a read trap instead of being stored; the first CPU access stores it.

  • GuestWriteWatch.cpp: a Linux ReadTraps beside the userfaultfd write watch. Trapped pages are PROT_NONE; a SIGSEGV/SIGBUS handler (SA_SIGINFO | SA_RESTART, chained to the previous one; libkernel's fault delivery also calls GuestWriteWatchHandleFault) hands the page to a resolver thread. Host writes and GuestWriteWatchProtect resolve overlapping traps first.
  • A trap is set only on pages known to be read-write: the protection is read from /proc/self/maps at the first trap in a registered range, then follows GuestWriteWatchProtect. Registering memory costs no /proc read.
  • DirectMemory.cpp (sceKernelMprotect, stack protection) and GuestArena.cpp call GuestWriteWatchProtect on Linux too, as on macOS, so a guest mprotect cannot drop a trap.
  • Texture.cpp: the label trap paths are enabled on Linux. On Linux only an image whose store goes over a host import is trapped; one without is stored at the label as before, because its CPU store saw the trapped pages as unmapped and wrote nothing, so a read got stale bytes.
  • Per-label cost (e4f8bedaf1, after the review below): the check that an image shares no page with another pending or storing image is one sorted sweep per label instead of a scan of all pending images per image, on macOS too, and the Linux TrapReads returns as soon as it finds the trap already held. On big_hand_pirate_island a reviewer measured this head at about 252 ms frame p50 against 245 ms on main (310 ms before it), see the comments.
  • Label memo (6e0650ef8c): GuestWriteWatchReadTrapGeneration returns a counter the Linux read traps bump when a trap is dropped or taken by the resolver; an image keeps the generation its trap was confirmed at, so a label calls TrapReads for it again only after the counter moved. While the pending and flushing lists are unchanged and every trapped image passed its checks at the last label, the label skips trapped images outright. The range list is kept on the pending set and rebuilt only when that set changed. On macOS the generation differs on every call, so the label asks as before. The effect on frame time is not measured yet.
  • Host pointer imports (59cea6f125): an import on Linux pinned pages a label read trap had made PROT_NONE; NVIDIA reports the failed pin as VK_ERROR_OUT_OF_DEVICE_MEMORY, and three in a row lower the import budget for the rest of the run (Cyberpunk 2077 intro at about 6 instead of 51 presents per 10 s, see the comments). ImportWatched now opens the same host write over the import as on macOS, so the traps on its range are resolved first and none is set while the driver pins the pages.
  • Host pointer imports by driver (05dc8b4a69): on RADV a submission fails with VK_ERROR_DEVICE_LOST while a host pointer import has a PROT_NONE page (see the comments). A label read trap is now set only where every import over the image's pages is a dma-buf, or where the driver is NVIDIA's proprietary one (ReadTrapsOverHostPointerImportsUsable), which pins the pages at import and has dma-buf imports off; that is observed in runs, not documented. Other drivers store those images at the label as on main.
  • Draw committer and label traps (6efccc8efe, reworked in 815baabafb): with the traps on, PPSA03974 stopped presenting about 20 s into its intro (see the comments). The draw pipeline's committer runs a queued item without the GPU mutex while the item keeps its read ranges; when it touched a trapped page it waited for the resolver, and ResolveLabelTrap waited for DrawPipeline::HeldReads over that range, which only the blocked committer could clear. The Linux read traps now record which thread waits in each fault slot (GuestWriteWatchAwaitsReadTrap), and ResolveLabelTrap still stores first but stops waiting on held reads when the committer is the thread blocked on a trap (LabelTrapResolveWaits). A page no queued item holds is stored before the committer reads it; one a queued item holds comes back unstored, as the label store leaves it on main. The bypass stays GPU mutex holders only. Whether this was the PPSA03974 hang is not yet shown by a run.
  • APS5_NO_LABEL_READ_TRAP=1 keeps the store at the label. Gaps are in the fragment debt/changes/perf-agc-linux-label-read-traps.md (for debt/libc.md and debt/libSceAgcDriver.md).

Tests: linux_read_trap_* (new, no GPU, skips without the userfaultfd watch). The read trap part of agc_small_tiled_shadow_label now runs on Linux; its case of a small image inside a large tiled one first passes one label, because since 44df0c5fbc a label stores an image on its first write and that store took the small image with it, which contradicted the case on every platform. Not run on macOS. On lavapipe the whole test skips (host imports unavailable), so CI covers the Linux traps only through linux_read_trap_*. agc_driver_label_trap_committer_resolve (new, Linux, no GPU) traps two pages and queues an item that holds reads over one of them and reads both: the held page must read back unstored, the other stored, and it fails when the resolver waits on held reads regardless of the blocked committer. agc_read_trap_import_submit (new, Linux, GPU; adapted from a probe posted in the comments) makes one page of an import PROT_NONE as a label read trap does and requires a fill of an unrelated buffer and of another page of the import to succeed; it runs over a host pointer import only where ReadTrapsOverHostPointerImportsUsable keeps traps on them and over a udmabuf dma-buf import where the device can import one, and skips otherwise. agc_read_traps_over_host_pointer_imports_driver (new) checks the driver table, and a new BdaResources case checks that an import is trappable over a host pointer import only where the driver allows it, not past its import and not once it is gone; its dma-buf side runs only where dma-buf imports are on, so not on NVIDIA. agc_write_tracking_host_pointer_import_over_read_traps (new, Linux) checks that an import over a trapped range runs with no trap on its pages, that no trap is set during it, that the kernel can read the pages and that the trapped bytes were stored first; it fails without the import fix. agc_driver_label_ordered_flush switches the read traps off for itself: a trapped image is not stored at the label, so it never takes the ordered flush that test counts.

Related open PRs that change the macOS read traps this mirrors: #15729 (conflicts on the debt/libSceAgcDriver.md entry), #18848, #16884. Whichever lands later should carry its change to the other platform.

Tested

Linux 7.0.0-43-generic, NVIDIA GeForce RTX 3070 Ti, driver 595.99.02, Intel Core i5-14600K.

Head 815baabafb (merged main e825fa1492; committer and label trap fix):

  • ctest -R 'agc_driver_label_trap_committer_resolve|agc_read_trap_import_submit|agc_read_traps_over_host_pointer_imports_driver|agc_host_import_sparse|bda|label|storage|shadow|write_back|writeback|read_trap|write_tracking|linear_target|draw_pipeline|queued|mprotect|kernel_stack_protect|protection_report|write_watch' -V with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1: 215/215 passed. Insert instance layer "VK_LAYER_KHRONOS_validation" is in the log, no was not found but was requested, 0 VUID-. Not rerun on main at this head. Not run on PPSA03974, PPSA21564 or AMD here.
  • python3 tools/check_conventions.py --base origin/main and python3 tools/debt_fold.py --check: passed. main's macos-drawn-linear-label-trap.md fragment changed the same "Label read traps" entry, so its sentence is folded into this branch's fragment and that file is removed.

Head 794cd8fc8d (adds agc_read_trap_import_submit):

  • ctest -R agc_read_trap_import_submit -V with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1: passed. The host pointer case ran and passed; the dma-buf case did not run, since this driver's vkAllocateMemory refuses the udmabuf import (VK_ERROR_OUT_OF_DEVICE_MEMORY). The layer is inserted, 0 VUID-. Not run on AMD.
  • python3 tools/check_conventions.py --base origin/main: passed.

Head a3703fcf50 (merged main 0766863ef6; debt entries moved to a fragment, dma-buf case added to agc_host_import_sparse):

  • ctest -R 'agc_read_traps_over_host_pointer_imports_driver|agc_host_import_sparse|bda|label|storage|shadow|write_back|writeback|read_trap|write_tracking' -V with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1: 146/146 passed. Insert instance layer "VK_LAYER_KHRONOS_validation" is in the log, no was not found but was requested, 0 VUID-. agc_graphics_profile_draw (no Vulkan instance) passes. Not rerun on main at this head. Not run on AMD or on Cyberpunk 2077 here.
  • python3 tools/check_conventions.py --base origin/main and python3 tools/debt_fold.py --check: passed.

Head 05dc8b4a69 (host pointer imports by driver):

  • ctest -R 'agc_read_traps_over_host_pointer_imports_driver|bda|label|storage|shadow|write_back|writeback|read_trap|write_tracking' -V with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1: 136/136 passed. Insert instance layer "VK_LAYER_KHRONOS_validation" is in the log, no was not found but was requested, 0 VUID-. agc_graphics_profile_draw (no Vulkan instance) passes. Not rerun on main at this head. Not run on AMD or on Cyberpunk 2077 here.
  • python3 tools/check_conventions.py --base origin/main: passed.

Head 59cea6f125 (import fix):

  • ctest -R 'label|storage|shadow|write_back|writeback|read_trap|write_tracking' -V with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation, VK_LOADER_DEBUG=layer, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1: 125/125 passed (5 skipped on this device), among them the new agc_write_tracking_host_pointer_import_over_read_traps. Insert instance layer "VK_LAYER_KHRONOS_validation" is in the log, no was not found but was requested, 0 VUID-. Not rerun on main at this head. Not run on Cyberpunk 2077 here.
  • python3 tools/check_conventions.py --base origin/main: passed.

Head 6e0650ef8c (merged main 5e58891ed2):

  • AGC: ctest -R 'label|storage|shadow|write_back|writeback|read_trap|write_tracking' -V with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (layer 1.4.341), VK_LOADER_DEBUG=layer, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1: 124/124 passed, among them all three agc_driver_label_ordered_flush*, agc_small_tiled_shadow_label and the ten linux_read_trap_* (new: linux_read_trap_generation). Insert instance layer "VK_LAYER_KHRONOS_validation" is in the log, no was not found but was requested, 0 VUID-. This set was not rerun on main at this head, so there is no side-by-side log; with 0 VUID- on the change it adds none.
  • linux_read_trap_threads: 20/20 runs; agc_small_tiled_shadow_label: 5/5 runs.
  • python3 tools/check_conventions.py --base origin/main: passed.
  • No speed measurement of mine on this head or on e4f8bedaf1 (big_hand_pirate_island at 3840x2160 locks up this 8 GB machine); the reviewer's numbers for e4f8bedaf1 are in the comments. The numbers below are from 055ee969b4. Not run on macOS.

Earlier head 055ee969b4, base f92cd1c990:

  • ctest -R linux_read_trap: 7/7 passed; linux_read_trap_threads 30/30 runs.
  • AGC, same 34 focused tests (labels, storage, shadows, write-back of agc_driver_recorder_tests) on main and this PR with VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation (layer 1.4.341), VK_LOADER_DEBUG=layer, ANYPS5_NO_SHADER_CACHE=1, ANYPS5_REQUIRE_VULKAN=1, ctest -V: both 34/34 passed (3 skipped on this device), Insert instance layer "VK_LAYER_KHRONOS_validation" in all 34, no was not found but was requested, 0 VUID- in both logs.
  • python3 tools/check_conventions.py --base origin/main: passed.

The speed figures below are from 055ee969b4 against f92cd1c990 and predate both the review that found the slowdown on big_hand_pirate_island and its fix. PPSA21564 01.007.000, title screen (title_controller_ship) with no input, warm shader and pipeline caches, APS5_TRACE_SECONDS=60:20, runs alternated main / PR / main / PR, each ended by timeout 100 (exit 124). The title ignores APS5_OUTPUT_RESOLUTION and renders 3840x2160.

run commit presents / 20 s frame p50 / p90 / p99 GPU busy per present
1 main f92cd1c990 336 59.1 / 63.8 / 71.2 ms 50.0 ms
2 PR 055ee969b4 366 54.4 / 58.8 / 63.1 ms 45.0 ms
3 main f92cd1c990 334 59.8 / 64.3 / 69.7 ms 50.4 ms
4 PR 055ee969b4 366 54.4 / 58.0 / 61.1 ms 44.9 ms

[storage] label write-backs per 10 s: about 3,940 (16.5 GB) on main, 25 to 35 (14 to 20 MB) with this PR. In all four captures the graphics queue worker's event buffer filled after about 13 s (trace_dropped, totals_full: false), so the summary totals are complete but the traces lack that thread's last 6 s.

{"commit":"f92cd1c990a5","dirty":false,"env":{"APS5_NET_DISCONNECTED":"1","APS5_NO_PAD_INPUT":"1","APS5_OUTPUT_RESOLUTION":"1920x1080","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"60:20"},"gpu":"NVIDIA GeForce RTX 3070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 7.0.0-43-generic","cpu":"Intel(R) Core(TM) i5-14600K","cpu_threads":20,"memory_mib":31769,"title_id":"PPSA21564","title":"ASTRO BOT","content_version":"01.007.000","resolution":"3840x2160","window":{"spec":"seconds 60:20","first_present":1579,"ms":20010.829},"presents":336,"frame_ms":{"p50":59.069,"p90":63.777,"p99":71.249,"max":90.139},"gpu_busy_ms_per_present":49.996,"worker_busy_pct":{"queue worker 0x0":80.103,"queue worker 0x40":99.675,"queue worker 0x48":70.325,"queue worker 0x3a":0.000},"top_phases_ms_per_frame":{"Driver.Packet":148.080,"Driver.Packet.memory_wait":86.882,"Recorder.WaitSerial":37.065,"Driver.Packet.prepare_memory":26.287,"Driver.Present":16.094,"VideoOut.Flip":16.079,"VideoOut.Flip.present":16.049,"Driver.Present.render_fence_wait":15.943},"owned_draw_counts":{},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":13.947,"events_lost":108007,"totals_full":false}},"trace":"aps5-trace-f92cd1c990a5-260164.json.gz"}
{"commit":"055ee969b4dc","dirty":false,"env":{"APS5_NET_DISCONNECTED":"1","APS5_NO_PAD_INPUT":"1","APS5_OUTPUT_RESOLUTION":"1920x1080","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"60:20"},"gpu":"NVIDIA GeForce RTX 3070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 7.0.0-43-generic","cpu":"Intel(R) Core(TM) i5-14600K","cpu_threads":20,"memory_mib":31769,"title_id":"PPSA21564","title":"ASTRO BOT","content_version":"01.007.000","resolution":"3840x2160","window":{"spec":"seconds 60:20","first_present":1689,"ms":20051.044},"presents":366,"frame_ms":{"p50":54.406,"p90":58.759,"p99":63.122,"max":70.217},"gpu_busy_ms_per_present":44.965,"worker_busy_pct":{"queue worker 0x0":80.056,"queue worker 0x40":99.773,"queue worker 0x48":69.893,"queue worker 0x3a":0.000},"top_phases_ms_per_frame":{"Driver.Packet":136.466,"Driver.Packet.memory_wait":80.809,"Recorder.WaitSerial":31.670,"Driver.Packet.prepare_memory":21.175,"Driver.Present":15.126,"VideoOut.Flip":15.119,"VideoOut.Flip.present":15.090,"Driver.Present.render_fence_wait":14.967},"owned_draw_counts":{},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":13.340,"events_lost":150688,"totals_full":false}},"trace":"aps5-trace-055ee969b4dc-261372.json.gz"}
{"commit":"f92cd1c990a5","dirty":false,"env":{"APS5_NET_DISCONNECTED":"1","APS5_NO_PAD_INPUT":"1","APS5_OUTPUT_RESOLUTION":"1920x1080","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"60:20"},"gpu":"NVIDIA GeForce RTX 3070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 7.0.0-43-generic","cpu":"Intel(R) Core(TM) i5-14600K","cpu_threads":20,"memory_mib":31769,"title_id":"PPSA21564","title":"ASTRO BOT","content_version":"01.007.000","resolution":"3840x2160","window":{"spec":"seconds 60:20","first_present":1549,"ms":20040.977},"presents":334,"frame_ms":{"p50":59.754,"p90":64.324,"p99":69.654,"max":73.083},"gpu_busy_ms_per_present":50.404,"worker_busy_pct":{"queue worker 0x0":80.326,"queue worker 0x40":99.751,"queue worker 0x48":70.502,"queue worker 0x3a":0.000},"top_phases_ms_per_frame":{"Driver.Packet":149.558,"Driver.Packet.memory_wait":87.836,"Recorder.WaitSerial":37.163,"Driver.Packet.prepare_memory":26.556,"Driver.Present":16.105,"VideoOut.Flip":16.099,"VideoOut.Flip.present":16.066,"Driver.Present.render_fence_wait":15.954},"owned_draw_counts":{},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":13.821,"events_lost":112728,"totals_full":false}},"trace":"aps5-trace-f92cd1c990a5-262210.json.gz"}
{"commit":"055ee969b4dc","dirty":false,"env":{"APS5_NET_DISCONNECTED":"1","APS5_NO_PAD_INPUT":"1","APS5_OUTPUT_RESOLUTION":"1920x1080","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"60:20"},"gpu":"NVIDIA GeForce RTX 3070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 7.0.0-43-generic","cpu":"Intel(R) Core(TM) i5-14600K","cpu_threads":20,"memory_mib":31769,"title_id":"PPSA21564","title":"ASTRO BOT","content_version":"01.007.000","resolution":"3840x2160","window":{"spec":"seconds 60:20","first_present":1671,"ms":20016.976},"presents":366,"frame_ms":{"p50":54.433,"p90":58.034,"p99":61.135,"max":62.850},"gpu_busy_ms_per_present":44.864,"worker_busy_pct":{"queue worker 0x0":78.888,"queue worker 0x40":99.781,"queue worker 0x48":68.220,"queue worker 0x3a":0.000},"top_phases_ms_per_frame":{"Driver.Packet":134.678,"Driver.Packet.memory_wait":79.132,"Recorder.WaitSerial":32.552,"Driver.Packet.prepare_memory":21.305,"Driver.Present":15.262,"VideoOut.Flip":15.253,"VideoOut.Flip.present":15.225,"Driver.Present.render_fence_wait":15.111},"owned_draw_counts":{},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":13.272,"events_lost":152699,"totals_full":false}},"trace":"aps5-trace-055ee969b4dc-263079.json.gz"}

Traces: attached below.

aps5-trace-f92cd1c990a5-260164.json.gz
aps5-trace-055ee969b4dc-261372.json.gz
aps5-trace-f92cd1c990a5-262210.json.gz
aps5-trace-055ee969b4dc-263079.json.gz

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 and the licence notice of code adapted from upstream (see AGENTS.md)
  • 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: NVIDIA GeForce RTX 3070 Ti, driver 595.99.02, Linux 7.0.0-43-generic (Ubuntu)
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5282466740 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19054). Originally posted by [pawcijo](https://github.com/pawcijo) on 2026-11-12T17:52:27Z. --- ### What Ports the label read traps (2cf5b41ec8) from macOS to Linux. Before a label, a pending linear or small storage image that shares no page with another pending or storing image gets a read trap instead of being stored; the first CPU access stores it. - `GuestWriteWatch.cpp`: a Linux `ReadTraps` beside the `userfaultfd` write watch. Trapped pages are `PROT_NONE`; a SIGSEGV/SIGBUS handler (`SA_SIGINFO | SA_RESTART`, chained to the previous one; libkernel's fault delivery also calls `GuestWriteWatchHandleFault`) hands the page to a resolver thread. Host writes and `GuestWriteWatchProtect` resolve overlapping traps first. - A trap is set only on pages known to be read-write: the protection is read from `/proc/self/maps` at the first trap in a registered range, then follows `GuestWriteWatchProtect`. Registering memory costs no `/proc` read. - `DirectMemory.cpp` (`sceKernelMprotect`, stack protection) and `GuestArena.cpp` call `GuestWriteWatchProtect` on Linux too, as on macOS, so a guest `mprotect` cannot drop a trap. - `Texture.cpp`: the label trap paths are enabled on Linux. On Linux only an image whose store goes over a host import is trapped; one without is stored at the label as before, because its CPU store saw the trapped pages as unmapped and wrote nothing, so a read got stale bytes. - Per-label cost (e4f8bedaf1, after the review below): the check that an image shares no page with another pending or storing image is one sorted sweep per label instead of a scan of all pending images per image, on macOS too, and the Linux `TrapReads` returns as soon as it finds the trap already held. On `big_hand_pirate_island` a reviewer measured this head at about 252 ms frame p50 against 245 ms on `main` (310 ms before it), see the comments. - Label memo (6e0650ef8c): `GuestWriteWatchReadTrapGeneration` returns a counter the Linux read traps bump when a trap is dropped or taken by the resolver; an image keeps the generation its trap was confirmed at, so a label calls `TrapReads` for it again only after the counter moved. While the pending and flushing lists are unchanged and every trapped image passed its checks at the last label, the label skips trapped images outright. The range list is kept on the pending set and rebuilt only when that set changed. On macOS the generation differs on every call, so the label asks as before. The effect on frame time is not measured yet. - Host pointer imports (59cea6f125): an import on Linux pinned pages a label read trap had made `PROT_NONE`; NVIDIA reports the failed pin as `VK_ERROR_OUT_OF_DEVICE_MEMORY`, and three in a row lower the import budget for the rest of the run (Cyberpunk 2077 intro at about 6 instead of 51 presents per 10 s, see the comments). `ImportWatched` now opens the same host write over the import as on macOS, so the traps on its range are resolved first and none is set while the driver pins the pages. - Host pointer imports by driver (05dc8b4a69): on RADV a submission fails with `VK_ERROR_DEVICE_LOST` while a host pointer import has a `PROT_NONE` page (see the comments). A label read trap is now set only where every import over the image's pages is a dma-buf, or where the driver is NVIDIA's proprietary one (`ReadTrapsOverHostPointerImportsUsable`), which pins the pages at import and has dma-buf imports off; that is observed in runs, not documented. Other drivers store those images at the label as on `main`. - Draw committer and label traps (6efccc8efe, reworked in 815baabafb): with the traps on, PPSA03974 stopped presenting about 20 s into its intro (see the comments). The draw pipeline's committer runs a queued item without the GPU mutex while the item keeps its read ranges; when it touched a trapped page it waited for the resolver, and `ResolveLabelTrap` waited for `DrawPipeline::HeldReads` over that range, which only the blocked committer could clear. The Linux read traps now record which thread waits in each fault slot (`GuestWriteWatchAwaitsReadTrap`), and `ResolveLabelTrap` still stores first but stops waiting on held reads when the committer is the thread blocked on a trap (`LabelTrapResolveWaits`). A page no queued item holds is stored before the committer reads it; one a queued item holds comes back unstored, as the label store leaves it on `main`. The bypass stays GPU mutex holders only. Whether this was the PPSA03974 hang is not yet shown by a run. - `APS5_NO_LABEL_READ_TRAP=1` keeps the store at the label. Gaps are in the fragment `debt/changes/perf-agc-linux-label-read-traps.md` (for `debt/libc.md` and `debt/libSceAgcDriver.md`). Tests: `linux_read_trap_*` (new, no GPU, skips without the `userfaultfd` watch). The read trap part of `agc_small_tiled_shadow_label` now runs on Linux; its case of a small image inside a large tiled one first passes one label, because since 44df0c5fbc a label stores an image on its first write and that store took the small image with it, which contradicted the case on every platform. **Not run on macOS.** On lavapipe the whole test skips (host imports unavailable), so CI covers the Linux traps only through `linux_read_trap_*`. `agc_driver_label_trap_committer_resolve` (new, Linux, no GPU) traps two pages and queues an item that holds reads over one of them and reads both: the held page must read back unstored, the other stored, and it fails when the resolver waits on held reads regardless of the blocked committer. `agc_read_trap_import_submit` (new, Linux, GPU; adapted from a probe posted in the comments) makes one page of an import `PROT_NONE` as a label read trap does and requires a fill of an unrelated buffer and of another page of the import to succeed; it runs over a host pointer import only where `ReadTrapsOverHostPointerImportsUsable` keeps traps on them and over a udmabuf dma-buf import where the device can import one, and skips otherwise. `agc_read_traps_over_host_pointer_imports_driver` (new) checks the driver table, and a new BdaResources case checks that an import is trappable over a host pointer import only where the driver allows it, not past its import and not once it is gone; its dma-buf side runs only where dma-buf imports are on, so not on NVIDIA. `agc_write_tracking_host_pointer_import_over_read_traps` (new, Linux) checks that an import over a trapped range runs with no trap on its pages, that no trap is set during it, that the kernel can read the pages and that the trapped bytes were stored first; it fails without the import fix. `agc_driver_label_ordered_flush` switches the read traps off for itself: a trapped image is not stored at the label, so it never takes the ordered flush that test counts. Related open PRs that change the macOS read traps this mirrors: #15729 (conflicts on the `debt/libSceAgcDriver.md` entry), #18848, #16884. Whichever lands later should carry its change to the other platform. ### Tested Linux 7.0.0-43-generic, NVIDIA GeForce RTX 3070 Ti, driver 595.99.02, Intel Core i5-14600K. Head 815baabafb (merged `main` e825fa1492; committer and label trap fix): - `ctest -R 'agc_driver_label_trap_committer_resolve|agc_read_trap_import_submit|agc_read_traps_over_host_pointer_imports_driver|agc_host_import_sparse|bda|label|storage|shadow|write_back|writeback|read_trap|write_tracking|linear_target|draw_pipeline|queued|mprotect|kernel_stack_protect|protection_report|write_watch' -V` with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`: 215/215 passed. `Insert instance layer "VK_LAYER_KHRONOS_validation"` is in the log, no `was not found but was requested`, 0 `VUID-`. Not rerun on `main` at this head. **Not run on PPSA03974, PPSA21564 or AMD here.** - `python3 tools/check_conventions.py --base origin/main` and `python3 tools/debt_fold.py --check`: passed. `main`'s `macos-drawn-linear-label-trap.md` fragment changed the same "Label read traps" entry, so its sentence is folded into this branch's fragment and that file is removed. Head 794cd8fc8d (adds `agc_read_trap_import_submit`): - `ctest -R agc_read_trap_import_submit -V` with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`: passed. The host pointer case ran and passed; the dma-buf case did not run, since this driver's `vkAllocateMemory` refuses the udmabuf import (`VK_ERROR_OUT_OF_DEVICE_MEMORY`). The layer is inserted, 0 `VUID-`. Not run on AMD. - `python3 tools/check_conventions.py --base origin/main`: passed. Head a3703fcf50 (merged `main` 0766863ef6; debt entries moved to a fragment, dma-buf case added to `agc_host_import_sparse`): - `ctest -R 'agc_read_traps_over_host_pointer_imports_driver|agc_host_import_sparse|bda|label|storage|shadow|write_back|writeback|read_trap|write_tracking' -V` with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`: 146/146 passed. `Insert instance layer "VK_LAYER_KHRONOS_validation"` is in the log, no `was not found but was requested`, 0 `VUID-`. `agc_graphics_profile_draw` (no Vulkan instance) passes. Not rerun on `main` at this head. **Not run on AMD or on Cyberpunk 2077 here.** - `python3 tools/check_conventions.py --base origin/main` and `python3 tools/debt_fold.py --check`: passed. Head 05dc8b4a69 (host pointer imports by driver): - `ctest -R 'agc_read_traps_over_host_pointer_imports_driver|bda|label|storage|shadow|write_back|writeback|read_trap|write_tracking' -V` with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`: 136/136 passed. `Insert instance layer "VK_LAYER_KHRONOS_validation"` is in the log, no `was not found but was requested`, 0 `VUID-`. `agc_graphics_profile_draw` (no Vulkan instance) passes. Not rerun on `main` at this head. **Not run on AMD or on Cyberpunk 2077 here.** - `python3 tools/check_conventions.py --base origin/main`: passed. Head 59cea6f125 (import fix): - `ctest -R 'label|storage|shadow|write_back|writeback|read_trap|write_tracking' -V` with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation`, `VK_LOADER_DEBUG=layer`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`: 125/125 passed (5 skipped on this device), among them the new `agc_write_tracking_host_pointer_import_over_read_traps`. `Insert instance layer "VK_LAYER_KHRONOS_validation"` is in the log, no `was not found but was requested`, 0 `VUID-`. Not rerun on `main` at this head. Not run on Cyberpunk 2077 here. - `python3 tools/check_conventions.py --base origin/main`: passed. Head 6e0650ef8c (merged `main` 5e58891ed2): - AGC: `ctest -R 'label|storage|shadow|write_back|writeback|read_trap|write_tracking' -V` with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (layer 1.4.341), `VK_LOADER_DEBUG=layer`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`: 124/124 passed, among them all three `agc_driver_label_ordered_flush*`, `agc_small_tiled_shadow_label` and the ten `linux_read_trap_*` (new: `linux_read_trap_generation`). `Insert instance layer "VK_LAYER_KHRONOS_validation"` is in the log, no `was not found but was requested`, 0 `VUID-`. **This set was not rerun on `main` at this head**, so there is no side-by-side log; with 0 `VUID-` on the change it adds none. - `linux_read_trap_threads`: 20/20 runs; `agc_small_tiled_shadow_label`: 5/5 runs. - `python3 tools/check_conventions.py --base origin/main`: passed. - **No speed measurement of mine on this head or on e4f8bedaf1** (`big_hand_pirate_island` at 3840x2160 locks up this 8 GB machine); the reviewer's numbers for e4f8bedaf1 are in the comments. The numbers below are from 055ee969b4. Not run on macOS. Earlier head 055ee969b4, base f92cd1c990: - `ctest -R linux_read_trap`: 7/7 passed; `linux_read_trap_threads` 30/30 runs. - AGC, same 34 focused tests (labels, storage, shadows, write-back of `agc_driver_recorder_tests`) on `main` and this PR with `VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation` (layer 1.4.341), `VK_LOADER_DEBUG=layer`, `ANYPS5_NO_SHADER_CACHE=1`, `ANYPS5_REQUIRE_VULKAN=1`, `ctest -V`: both 34/34 passed (3 skipped on this device), `Insert instance layer "VK_LAYER_KHRONOS_validation"` in all 34, no `was not found but was requested`, 0 `VUID-` in both logs. - `python3 tools/check_conventions.py --base origin/main`: passed. The speed figures below are from 055ee969b4 against f92cd1c990 and predate both the review that found the slowdown on `big_hand_pirate_island` and its fix. PPSA21564 01.007.000, title screen (`title_controller_ship`) with no input, warm shader and pipeline caches, `APS5_TRACE_SECONDS=60:20`, runs alternated main / PR / main / PR, each ended by `timeout 100` (exit 124). The title ignores `APS5_OUTPUT_RESOLUTION` and renders 3840x2160. | run | commit | presents / 20 s | frame p50 / p90 / p99 | GPU busy per present | |---|---|---|---|---| | 1 | main f92cd1c990 | 336 | 59.1 / 63.8 / 71.2 ms | 50.0 ms | | 2 | PR 055ee969b4 | 366 | 54.4 / 58.8 / 63.1 ms | 45.0 ms | | 3 | main f92cd1c990 | 334 | 59.8 / 64.3 / 69.7 ms | 50.4 ms | | 4 | PR 055ee969b4 | 366 | 54.4 / 58.0 / 61.1 ms | 44.9 ms | `[storage]` label write-backs per 10 s: about 3,940 (16.5 GB) on main, 25 to 35 (14 to 20 MB) with this PR. In all four captures the graphics queue worker's event buffer filled after about 13 s (`trace_dropped`, `totals_full: false`), so the summary totals are complete but the traces lack that thread's last 6 s. ```json {"commit":"f92cd1c990a5","dirty":false,"env":{"APS5_NET_DISCONNECTED":"1","APS5_NO_PAD_INPUT":"1","APS5_OUTPUT_RESOLUTION":"1920x1080","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"60:20"},"gpu":"NVIDIA GeForce RTX 3070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 7.0.0-43-generic","cpu":"Intel(R) Core(TM) i5-14600K","cpu_threads":20,"memory_mib":31769,"title_id":"PPSA21564","title":"ASTRO BOT","content_version":"01.007.000","resolution":"3840x2160","window":{"spec":"seconds 60:20","first_present":1579,"ms":20010.829},"presents":336,"frame_ms":{"p50":59.069,"p90":63.777,"p99":71.249,"max":90.139},"gpu_busy_ms_per_present":49.996,"worker_busy_pct":{"queue worker 0x0":80.103,"queue worker 0x40":99.675,"queue worker 0x48":70.325,"queue worker 0x3a":0.000},"top_phases_ms_per_frame":{"Driver.Packet":148.080,"Driver.Packet.memory_wait":86.882,"Recorder.WaitSerial":37.065,"Driver.Packet.prepare_memory":26.287,"Driver.Present":16.094,"VideoOut.Flip":16.079,"VideoOut.Flip.present":16.049,"Driver.Present.render_fence_wait":15.943},"owned_draw_counts":{},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":13.947,"events_lost":108007,"totals_full":false}},"trace":"aps5-trace-f92cd1c990a5-260164.json.gz"} {"commit":"055ee969b4dc","dirty":false,"env":{"APS5_NET_DISCONNECTED":"1","APS5_NO_PAD_INPUT":"1","APS5_OUTPUT_RESOLUTION":"1920x1080","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"60:20"},"gpu":"NVIDIA GeForce RTX 3070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 7.0.0-43-generic","cpu":"Intel(R) Core(TM) i5-14600K","cpu_threads":20,"memory_mib":31769,"title_id":"PPSA21564","title":"ASTRO BOT","content_version":"01.007.000","resolution":"3840x2160","window":{"spec":"seconds 60:20","first_present":1689,"ms":20051.044},"presents":366,"frame_ms":{"p50":54.406,"p90":58.759,"p99":63.122,"max":70.217},"gpu_busy_ms_per_present":44.965,"worker_busy_pct":{"queue worker 0x0":80.056,"queue worker 0x40":99.773,"queue worker 0x48":69.893,"queue worker 0x3a":0.000},"top_phases_ms_per_frame":{"Driver.Packet":136.466,"Driver.Packet.memory_wait":80.809,"Recorder.WaitSerial":31.670,"Driver.Packet.prepare_memory":21.175,"Driver.Present":15.126,"VideoOut.Flip":15.119,"VideoOut.Flip.present":15.090,"Driver.Present.render_fence_wait":14.967},"owned_draw_counts":{},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":13.340,"events_lost":150688,"totals_full":false}},"trace":"aps5-trace-055ee969b4dc-261372.json.gz"} {"commit":"f92cd1c990a5","dirty":false,"env":{"APS5_NET_DISCONNECTED":"1","APS5_NO_PAD_INPUT":"1","APS5_OUTPUT_RESOLUTION":"1920x1080","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"60:20"},"gpu":"NVIDIA GeForce RTX 3070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 7.0.0-43-generic","cpu":"Intel(R) Core(TM) i5-14600K","cpu_threads":20,"memory_mib":31769,"title_id":"PPSA21564","title":"ASTRO BOT","content_version":"01.007.000","resolution":"3840x2160","window":{"spec":"seconds 60:20","first_present":1549,"ms":20040.977},"presents":334,"frame_ms":{"p50":59.754,"p90":64.324,"p99":69.654,"max":73.083},"gpu_busy_ms_per_present":50.404,"worker_busy_pct":{"queue worker 0x0":80.326,"queue worker 0x40":99.751,"queue worker 0x48":70.502,"queue worker 0x3a":0.000},"top_phases_ms_per_frame":{"Driver.Packet":149.558,"Driver.Packet.memory_wait":87.836,"Recorder.WaitSerial":37.163,"Driver.Packet.prepare_memory":26.556,"Driver.Present":16.105,"VideoOut.Flip":16.099,"VideoOut.Flip.present":16.066,"Driver.Present.render_fence_wait":15.954},"owned_draw_counts":{},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":13.821,"events_lost":112728,"totals_full":false}},"trace":"aps5-trace-f92cd1c990a5-262210.json.gz"} {"commit":"055ee969b4dc","dirty":false,"env":{"APS5_NET_DISCONNECTED":"1","APS5_NO_PAD_INPUT":"1","APS5_OUTPUT_RESOLUTION":"1920x1080","APS5_TRACE_DIR":"<path>","APS5_TRACE_SECONDS":"60:20"},"gpu":"NVIDIA GeForce RTX 3070 Ti","driver":"NVIDIA 595.99.02","os":"Linux 7.0.0-43-generic","cpu":"Intel(R) Core(TM) i5-14600K","cpu_threads":20,"memory_mib":31769,"title_id":"PPSA21564","title":"ASTRO BOT","content_version":"01.007.000","resolution":"3840x2160","window":{"spec":"seconds 60:20","first_present":1671,"ms":20016.976},"presents":366,"frame_ms":{"p50":54.433,"p90":58.034,"p99":61.135,"max":62.850},"gpu_busy_ms_per_present":44.864,"worker_busy_pct":{"queue worker 0x0":78.888,"queue worker 0x40":99.781,"queue worker 0x48":68.220,"queue worker 0x3a":0.000},"top_phases_ms_per_frame":{"Driver.Packet":134.678,"Driver.Packet.memory_wait":79.132,"Recorder.WaitSerial":32.552,"Driver.Packet.prepare_memory":21.305,"Driver.Present":15.262,"VideoOut.Flip":15.253,"VideoOut.Flip.present":15.225,"Driver.Present.render_fence_wait":15.111},"owned_draw_counts":{},"trace_dropped":true,"trace_dropped_threads":{"queue worker 0x0":{"events_full_after_s":13.272,"events_lost":152699,"totals_full":false}},"trace":"aps5-trace-055ee969b4dc-263079.json.gz"} ``` Traces: attached below. [aps5-trace-f92cd1c990a5-260164.json.gz](https://github.com/user-attachments/files/34762310/aps5-trace-f92cd1c990a5-260164.json.gz) [aps5-trace-055ee969b4dc-261372.json.gz](https://github.com/user-attachments/files/34762324/aps5-trace-055ee969b4dc-261372.json.gz) [aps5-trace-f92cd1c990a5-262210.json.gz](https://github.com/user-attachments/files/34762328/aps5-trace-f92cd1c990a5-262210.json.gz) [aps5-trace-055ee969b4dc-263079.json.gz](https://github.com/user-attachments/files/34762340/aps5-trace-055ee969b4dc-263079.json.gz) ### 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) and the licence notice of code adapted from upstream (see AGENTS.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: NVIDIA GeForce RTX 3070 Ti, driver 595.99.02, Linux 7.0.0-43-generic (Ubuntu) - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-11-18 15:36:22 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-18T15:36:22Z.

Review: COMMENTED


Reviewed — comments

This review identified material uncertainty in the Linux signal-handler and mapping-protection lifecycle, and several changed files were not fully read.

What I ran

No tests or builds were run. I reviewed the prepared diff and used the pinned repository reader for targeted source ranges.

Results

Check Result Note
Prepared diff review passed Inspected all diff sections
Targeted source review passed Focused on read trap handling and integration
Tests and build not run No execution performed

Findings

Blocking

None verified.

Non-blocking

None.

Not verified

The complete changed-file text was not read for VulkanDevice.cpp, GuestBufferMemory.cpp, Texture.cpp, and Recorder.cpp; their relevant hunks were inspected in diff.patch. For GuestWriteWatch.cpp, the added trap implementation and exported entry points were inspected in the diff, along with targeted head ranges for the surrounding watch and API paths. The full 580-line change was not read at the pinned head. Most other changed files were inspected through the prepared diff, not by reading every changed line from their head versions. No build, test, signal-chain integration, hardware, or console behavior was verified. The description's reported results are author supplied and were not run here.

To get this to a good state

Nothing is required. Optional: run the focused Linux read trap and AGC import tests on the current head, including with Vulkan validation enabled.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5959779558 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19054#pullrequestreview-5959779558). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-18T15:36:22Z. **Review:** COMMENTED --- # Reviewed — comments This review identified material uncertainty in the Linux signal-handler and mapping-protection lifecycle, and several changed files were not fully read. ## What I ran No tests or builds were run. I reviewed the prepared diff and used the pinned repository reader for targeted source ranges. ## Results | Check | Result | Note | |---|---|---| | Prepared diff review | passed | Inspected all diff sections | | Targeted source review | passed | Focused on read trap handling and integration | | Tests and build | not run | No execution performed | ## Findings ### Blocking None verified. ### Non-blocking None. ## Not verified The complete changed-file text was not read for `VulkanDevice.cpp`, `GuestBufferMemory.cpp`, `Texture.cpp`, and `Recorder.cpp`; their relevant hunks were inspected in `diff.patch`. For `GuestWriteWatch.cpp`, the added trap implementation and exported entry points were inspected in the diff, along with targeted head ranges for the surrounding watch and API paths. The full 580-line change was not read at the pinned head. Most other changed files were inspected through the prepared diff, not by reading every changed line from their head versions. No build, test, signal-chain integration, hardware, or console behavior was verified. The description's reported results are author supplied and were not run here. ## To get this to a good state Nothing is required. Optional: run the focused Linux read trap and AGC import tests on the current head, including with Vulkan validation enabled.
MarcZX10 commented 2026-11-20 05:39:33 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T05:39:33Z.

Review: COMMENTED


Reviewed — no blocking findings

The prepared diff and targeted source review at 6efccc8efe835e8d27e74aba613538bbbdac09c7 found no verified blocking defect; I did not run checks, and several changed files remain unread.

What I ran

  • Head reviewed: 6efccc8efe835e8d27e74aba613538bbbdac09c7.
  • Read the prepared description, commit list, manifest, and relevant diff hunks; used the pinned reader to inspect Linux read-trap logic and selected changed code.
  • No tests or builds were run. The test results in the PR description are author-reported.

Results

Check Result Note
Targeted source review passed No verified blocking defect
Build and tests not run Reported results are author-supplied
Full changed-file review not run Several changed files were not read

Findings

Blocking

None verified in the code inspected.

Non-blocking

None.

Not verified

The full text of VulkanDevice.cpp, GuestBufferMemory.cpp, Texture.cpp, and Recorder.cpp was not read. The relevant hunks in GuestBufferMemory.cpp were inspected via the pinned reader, but the rest of that changed file was not. Other changed files were not read in full, including the added tests and the larger GuestWriteWatch.cpp addition beyond the portions noted above. No build, tests, or runtime checks were performed. The author reports focused test runs and convention checks in the PR description; those were not rerun here.

Files read: description.md, commits.md, manifest.json, diff.patch, README.md, and portions of GuestWriteWatch.cpp and GuestBufferMemory.cpp. Also inspected targeted diff hunks for DrawPipeline.cpp, GuestMemory.cpp, Texture.cpp, VulkanDevice.cpp, and BdaResources.cpp. Files excluded from direct reading: VulkanDevice.cpp, Texture.cpp, Recorder.cpp, and the deleted debt fragment; full texts of other included changed files were not all reviewed.

To get this to a good state

Nothing is required. The author-reported tests and convention checks remain unverified in this review.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5988055584 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19054#pullrequestreview-5988055584). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T05:39:33Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The prepared diff and targeted source review at `6efccc8efe835e8d27e74aba613538bbbdac09c7` found no verified blocking defect; I did not run checks, and several changed files remain unread. ## What I ran - Head reviewed: `6efccc8efe835e8d27e74aba613538bbbdac09c7`. - Read the prepared description, commit list, manifest, and relevant diff hunks; used the pinned reader to inspect Linux read-trap logic and selected changed code. - No tests or builds were run. The test results in the PR description are author-reported. ## Results | Check | Result | Note | |---|---|---| | Targeted source review | passed | No verified blocking defect | | Build and tests | not run | Reported results are author-supplied | | Full changed-file review | not run | Several changed files were not read | ## Findings ### Blocking None verified in the code inspected. ### Non-blocking None. ## Not verified The full text of `VulkanDevice.cpp`, `GuestBufferMemory.cpp`, `Texture.cpp`, and `Recorder.cpp` was not read. The relevant hunks in `GuestBufferMemory.cpp` were inspected via the pinned reader, but the rest of that changed file was not. Other changed files were not read in full, including the added tests and the larger `GuestWriteWatch.cpp` addition beyond the portions noted above. No build, tests, or runtime checks were performed. The author reports focused test runs and convention checks in the PR description; those were not rerun here. Files read: `description.md`, `commits.md`, `manifest.json`, `diff.patch`, `README.md`, and portions of `GuestWriteWatch.cpp` and `GuestBufferMemory.cpp`. Also inspected targeted diff hunks for `DrawPipeline.cpp`, `GuestMemory.cpp`, `Texture.cpp`, `VulkanDevice.cpp`, and `BdaResources.cpp`. Files excluded from direct reading: `VulkanDevice.cpp`, `Texture.cpp`, `Recorder.cpp`, and the deleted debt fragment; full texts of other included changed files were not all reviewed. ## To get this to a good state Nothing is required. The author-reported tests and convention checks remain unverified in this review.
MarcZX10 commented 2026-11-20 09:47:41 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-20T09:47:41Z.

Review: COMMENTED


Reviewed — no blocking findings

The inspected changes show no verified blocking defect, but this review is incomplete because several changed files were excluded or not read and no checks were run.

What I ran

Reviewed head d4ce495f8e8c8f60883828214fd1acde321f7b1d using the prepared review bundle and the pinned repository reader. No test, build, or convention command was run.

Results

Check Result Note
Changed hunks not run Inspected selected hunks and source paths
Tests and build not run No commands executed

Findings

Blocking

None verified in the inspected code.

Non-blocking

None.

Not verified

The complete review is not verified: VulkanDevice.cpp, GuestBufferMemory.cpp, Texture.cpp, and Recorder.cpp were excluded from the review folder. I inspected selected ranges of GuestWriteWatch.cpp, GuestBufferMemory.cpp, Texture.cpp, and DrawPipeline.cpp; I did not read every changed file marked included in the manifest. Tests, build, convention checks, macOS behavior, AMD behavior, and performance at this head were not run or confirmed. The author-reported test results in the description were not independently run.

To get this to a good state

Nothing is required to address a verified defect. To support a formal decision, complete inspection of all changed files and run the relevant checks on this head.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5990683892 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19054#pullrequestreview-5990683892). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-20T09:47:41Z. **Review:** COMMENTED --- # Reviewed — no blocking findings The inspected changes show no verified blocking defect, but this review is incomplete because several changed files were excluded or not read and no checks were run. ## What I ran Reviewed head `d4ce495f8e8c8f60883828214fd1acde321f7b1d` using the prepared review bundle and the pinned repository reader. No test, build, or convention command was run. ## Results | Check | Result | Note | |---|---|---| | Changed hunks | not run | Inspected selected hunks and source paths | | Tests and build | not run | No commands executed | ## Findings ### Blocking None verified in the inspected code. ### Non-blocking None. ## Not verified The complete review is not verified: `VulkanDevice.cpp`, `GuestBufferMemory.cpp`, `Texture.cpp`, and `Recorder.cpp` were excluded from the review folder. I inspected selected ranges of `GuestWriteWatch.cpp`, `GuestBufferMemory.cpp`, `Texture.cpp`, and `DrawPipeline.cpp`; I did not read every changed file marked included in the manifest. Tests, build, convention checks, macOS behavior, AMD behavior, and performance at this head were not run or confirmed. The author-reported test results in the description were not independently run. ## To get this to a good state Nothing is required to address a verified defect. To support a formal decision, complete inspection of all changed files and run the relevant checks on this head.
MarcZX10 commented 2026-11-21 01:20:21 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T01:20:21Z.

Review: COMMENTED


Reviewed — no blocking findings

Nothing blocks this change based on the inspected code; the Linux read-trap implementation and its label and import integration are not fully verified because several large changed files were excluded from the prepared review bundle.

What I ran

No commands or tests were run. I inspected the prepared diff and targeted source ranges at head 815baabafbc8a501f741e03bc4b10a30ddc0b113.

Results

Check Result Note
Prepared diff review passed Changed hunks inspected
Tests not run Author-reported runs only
Excluded source review not run Full files were not read

Findings

Blocking

None in the code inspected.

Non-blocking

None.

Not verified

I read the description, commits, manifest, prepared diff, and included changed files: DrawPipeline.hpp, ReadTrapsOverHostPointerImports.hpp, DrawPipeline.cpp, GuestMemory.cpp, Context.hpp, GuestBufferMemory.hpp, Texture.hpp, BdaResources.cpp, HostImportSparseDmaBuf.cpp, ReadTrapImportSubmit.cpp, ReadTrapsOverHostPointerImports.cpp, WriteTracking.cpp, the three changed CMake test files, LabelOrderedFlush.cpp, LabelTrapCommitterResolve.cpp, GuestWriteWatch.hpp, GuestArena.cpp, DirectMemory.cpp, LinuxReadTraps.cpp, and perf-agc-linux-label-read-traps.md.

VulkanDevice.cpp, GuestBufferMemory.cpp, Texture.cpp, and Recorder.cpp were excluded from the prepared full-text bundle; I read only targeted ranges of the first three and one line of Recorder.cpp. The deleted debt fragment was not read. I did not run tests, convention checks, or verify the reported device and game behavior.

To get this to a good state

Nothing is required. Optional: review the remaining changed ranges in the excluded files and run the focused checks on this head before relying on the reported results.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6001729611 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19054#pullrequestreview-6001729611). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T01:20:21Z. **Review:** COMMENTED --- # Reviewed — no blocking findings Nothing blocks this change based on the inspected code; the Linux read-trap implementation and its label and import integration are not fully verified because several large changed files were excluded from the prepared review bundle. ## What I ran No commands or tests were run. I inspected the prepared diff and targeted source ranges at head `815baabafbc8a501f741e03bc4b10a30ddc0b113`. ## Results | Check | Result | Note | |---|---|---| | Prepared diff review | passed | Changed hunks inspected | | Tests | not run | Author-reported runs only | | Excluded source review | not run | Full files were not read | ## Findings ### Blocking None in the code inspected. ### Non-blocking None. ## Not verified I read the description, commits, manifest, prepared diff, and included changed files: `DrawPipeline.hpp`, `ReadTrapsOverHostPointerImports.hpp`, `DrawPipeline.cpp`, `GuestMemory.cpp`, `Context.hpp`, `GuestBufferMemory.hpp`, `Texture.hpp`, `BdaResources.cpp`, `HostImportSparseDmaBuf.cpp`, `ReadTrapImportSubmit.cpp`, `ReadTrapsOverHostPointerImports.cpp`, `WriteTracking.cpp`, the three changed CMake test files, `LabelOrderedFlush.cpp`, `LabelTrapCommitterResolve.cpp`, `GuestWriteWatch.hpp`, `GuestArena.cpp`, `DirectMemory.cpp`, `LinuxReadTraps.cpp`, and `perf-agc-linux-label-read-traps.md`. `VulkanDevice.cpp`, `GuestBufferMemory.cpp`, `Texture.cpp`, and `Recorder.cpp` were excluded from the prepared full-text bundle; I read only targeted ranges of the first three and one line of `Recorder.cpp`. The deleted debt fragment was not read. I did not run tests, convention checks, or verify the reported device and game behavior. ## To get this to a good state Nothing is required. Optional: review the remaining changed ranges in the excluded files and run the focused checks on this head before relying on the reported results.
MarcZX10 commented 2026-11-21 10:05:52 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-21T10:05:52Z.

Review: COMMENTED


Reviewed — comments

The review inspected the prepared diff at c53e84a189ed6c06c1d84ffbd1d1f1854f4cd502; a concrete trap lifecycle defect needs correction, and no checks were run independently.

What I ran

Read the prepared review bundle and targeted source context using repo_read.py; no tests or build commands were run.

Results

Check Result Note
Source review failed Trap registration can discard active traps without restoring pages
Tests not run Author-reported runs were not repeated
Build not run No build performed

Findings

Blocking

  • core/libs/prx/libc/src/GuestWriteWatch.cpp:1506 erases overlapping active traps in Registered() without calling restore(). If a watched range is registered again while a read trap overlaps it, the trap record is removed but its pages remain PROT_NONE; later faults can no longer find a trap to resolve, so access can hang or fail. Restore the removed traps before discarding them, while preserving protection tracking for the newly registered range.

Non-blocking

None.

Not verified

Read changed files listed as included in manifest.json and inspected targeted head source around the excluded large files. Full text excluded by the prepared bundle: Execution/src/VulkanDevice.cpp, Graphics/src/GuestBufferMemory.cpp, Graphics/src/Texture.cpp, and tests/Recorder.cpp; those were read only at relevant hunks through repo_read.py. The deleted debt fragment has no new text. No runtime checks, build, or independent test run was performed; author-reported tests were not independently verified.

To get this to a good state

Restore active overlapping traps during registration and add a regression test that re-registers a range overlapping a trapped page, then verifies that access resolves or the page is restored.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6004527469 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19054#pullrequestreview-6004527469). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-21T10:05:52Z. **Review:** COMMENTED --- # Reviewed — comments The review inspected the prepared diff at `c53e84a189ed6c06c1d84ffbd1d1f1854f4cd502`; a concrete trap lifecycle defect needs correction, and no checks were run independently. ## What I ran Read the prepared review bundle and targeted source context using `repo_read.py`; no tests or build commands were run. ## Results | Check | Result | Note | |---|---|---| | Source review | failed | Trap registration can discard active traps without restoring pages | | Tests | not run | Author-reported runs were not repeated | | Build | not run | No build performed | ## Findings ### Blocking - `core/libs/prx/libc/src/GuestWriteWatch.cpp:1506` erases overlapping active traps in `Registered()` without calling `restore()`. If a watched range is registered again while a read trap overlaps it, the trap record is removed but its pages remain `PROT_NONE`; later faults can no longer find a trap to resolve, so access can hang or fail. Restore the removed traps before discarding them, while preserving protection tracking for the newly registered range. ### Non-blocking None. ## Not verified Read changed files listed as included in `manifest.json` and inspected targeted head source around the excluded large files. Full text excluded by the prepared bundle: `Execution/src/VulkanDevice.cpp`, `Graphics/src/GuestBufferMemory.cpp`, `Graphics/src/Texture.cpp`, and `tests/Recorder.cpp`; those were read only at relevant hunks through `repo_read.py`. The deleted debt fragment has no new text. No runtime checks, build, or independent test run was performed; author-reported tests were not independently verified. ## To get this to a good state Restore active overlapping traps during registration and add a regression test that re-registers a range overlapping a trapped page, then verifies that access resolves or the page is restored.
MarcZX10 commented 2026-11-23 01:39:50 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-11-23T01:39:50Z.

Review: COMMENTED


Reviewed — comments

Nothing blocks this review; the points below are optional.

What I ran

Reviewed head 46f01f71b72b9a8774c0c826de5eff6644bdeab7 against the prepared diff. No commands or tests were run.

Results

Check Result Note
Diff and targeted code review passed Reviewed change logic and selected callers
Tests not run Results in the description are author reported

Findings

Blocking

None.

Non-blocking

  • The host pointer import allowlist is based on observed NVIDIA behavior, and the description notes it is undocumented. The submit test covers the reported device, but behavior on other NVIDIA driver versions and AMD remains unverified. Consider keeping the limitation explicit and extending coverage as those drivers are tested.

Not verified

The complete text of these changed files was not read: core/libs/prx/libSceAgcDriver/tests/Recorder.cpp and core/libs/prx/libc/src/GuestWriteWatch.cpp; targeted ranges of GuestWriteWatch.cpp were read. core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp, core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp, and core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp were read through the pinned-head reader at relevant ranges. No tests were run; macOS and AMD behavior, PPSA03974 behavior, and the final performance effect of the label memo were not verified. The deleted debt fragment has no head text to read.

To get this to a good state

Nothing is required. Optional: add coverage for NVIDIA driver versions and AMD before broadening the host pointer import allowlist.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:6015684378 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/19054#pullrequestreview-6015684378). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-23T01:39:50Z. **Review:** COMMENTED --- # Reviewed — comments Nothing blocks this review; the points below are optional. ## What I ran Reviewed head `46f01f71b72b9a8774c0c826de5eff6644bdeab7` against the prepared diff. No commands or tests were run. ## Results | Check | Result | Note | |---|---|---| | Diff and targeted code review | passed | Reviewed change logic and selected callers | | Tests | not run | Results in the description are author reported | ## Findings ### Blocking None. ### Non-blocking - The host pointer import allowlist is based on observed NVIDIA behavior, and the description notes it is undocumented. The submit test covers the reported device, but behavior on other NVIDIA driver versions and AMD remains unverified. Consider keeping the limitation explicit and extending coverage as those drivers are tested. ## Not verified The complete text of these changed files was not read: `core/libs/prx/libSceAgcDriver/tests/Recorder.cpp` and `core/libs/prx/libc/src/GuestWriteWatch.cpp`; targeted ranges of `GuestWriteWatch.cpp` were read. `core/libs/prx/libSceAgcDriver/Execution/src/VulkanDevice.cpp`, `core/libs/prx/libSceAgcDriver/Graphics/src/GuestBufferMemory.cpp`, and `core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp` were read through the pinned-head reader at relevant ranges. No tests were run; macOS and AMD behavior, PPSA03974 behavior, and the final performance effect of the label memo were not verified. The deleted debt fragment has no head text to read. ## To get this to a good state Nothing is required. Optional: add coverage for NVIDIA driver versions and AMD before broadening the host pointer import allowlist.
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!19054
No description provided.