perf(libkernel): resolve an APR path's directory once and find the file in its listing #11446

Merged
noir39 merged 7 commits from upstream-pr/11446 into main 2026-11-18 23:45:23 +00:00
noir39 commented 2026-10-26 13:51:09 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by noir39 on 2026-10-26T13:51:09Z.


What

sceKernelAprResolveFilepathsToIds* already takes each file's size from a listing of its directory (one directory read instead of one size query per path), but it still resolved every path through ResolvePath, which on Windows asks the file system for each file's attributes (GetFileAttributesW in ResolveHostPath). An absolute path now resolves its directory once, cached by the guest directory, and the file is looked up in that directory's listing.

The fast path is taken only when the listing has an entry whose on-disk name equals the guest's last component exactly. Everything else takes the full resolve as before, so MatchNames still corrects the case and still reports an ambiguous name:

  • a name in other case than on disk, or a key that two on-disk names share (a case-sensitive directory holding E.bin and e.bin; the size query then also skips the listing);
  • a file not in the listing (created since);
  • a relative path, a path ending in ., .. or a separator, a last component containing \ or :, a last component longer than 255 bytes, a path of 1024 bytes or more;
  • a directory or name whose resolve or conversion throws (a name that is not valid UTF-8, a directory that exists only in app0.zar).

The directory cache is dropped whenever a path alias changes: libc counts AddPathAlias, RemovePathAlias, BlockPathAlias and AddPathProvider calls (PathAliasGeneration_nid_no_patch), so a save-data mount point rebound to another save resolves into the new directory (the case @MarcZX10 found in the review of #10633, which this PR replaces: #10633 was closed by the open-PR limit and could not be reopened after the branch was rebased).

Tested

Windows 11 Pro 26200, Ryzen 9 5950X, Samsung 980 NVMe, RTX 3080, WinLibs GCC 15.2.0 r7, branch rebased onto main f759e165d9.

  • guest_apr_read_resolve (BUILD_TESTING=ON): absolute paths in one directory and a subdirectory; a name in other case than on disk (b.BIN for B.bin); every resolved id is stat'ed (sceKernelAprGetFileStat) and read through a ReadFile command; the same id for a path resolved again; a file created after its directory was listed; a missing file (error_index, size 0); a 256-byte name (reported missing); two names differing only in case, checked where the host file system keeps both; an alias rebound from one directory to another between two resolves of the same path.
  • ctest -R "guest_apr|guest_ampr|savedata|guest_path|working_directory|guest_directory|realpath|app_archive|fopen_long": 45 of 45 pass; tools/check_conventions.py passes.

Start-up timing. The gain is before the title's first frame, outside the aps5-summary.jsonl frame summaries, so this is the title's own timing of that phase, measured the same way for both builds:

  • Demon's Souls PPSA01342 v1.005 resolves its whole package at start-up through sceKernelAprResolveFilepathsToIds*: about 243,000 paths in ResourcePool::GatherResourceFileInfo, which logs its own duration.
  • Both builds were Release builds of the same tree: main f759e165d9 and this branch on it.
  • The same relinked eboot.elf, the same relinker.exe and the same save; only libs\ was swapped, with its libkernel.prx hash checked against the build.
  • Each build ran from launch until that line plus the first presented frame, then the process was stopped. No input, default environment.
  • The first runs after a library swap rebuild the shader disk cache, so only runs on a warm cache are listed ([shader-disk-cache] totals of at most 7 misses; the cold runs took 1:04 and 1:00 on main while compiling about 2,000 shaders).
Build GatherResourceFileInfo() took Line logged at (s after launch)
main f759e165d9 48.96 s, 46.88 s, 47.86 s 56.5, 54.5, 57.9
this PR e8ba6924a4 7.53 s, 7.48 s, 7.50 s 15.2, 15.1, 15.2

An earlier series on main 4a6005955f gave 47.03 s, 46.82 s and 46.88 s.

Raw log lines
main f759e165d9  [MSG-Init] ResourcePool::GatherResourceFileInfo() took 48.9576s   shader-disk-cache totals: 4024 hits, 7 misses
main f759e165d9  [MSG-Init] ResourcePool::GatherResourceFileInfo() took 46.8830s   shader-disk-cache totals: 4031 hits, 0 misses
main f759e165d9  [MSG-Init] ResourcePool::GatherResourceFileInfo() took 47.8563s   shader-disk-cache totals: 4031 hits, 0 misses
PR   e8ba6924a4  [MSG-Init] ResourcePool::GatherResourceFileInfo() took 7.5289s    shader-disk-cache totals: 4016 hits, 0 misses
PR   e8ba6924a4  [MSG-Init] ResourcePool::GatherResourceFileInfo() took 7.4760s    shader-disk-cache totals: 4016 hits, 0 misses
PR   e8ba6924a4  [MSG-Init] ResourcePool::GatherResourceFileInfo() took 7.4960s    shader-disk-cache totals: 4016 hits, 0 misses

Checklist

  • Based on current main (f759e165d9); no other open PR implements the same functions (tools/pr_overlap.py: no other open PR conflicts with these lines; the shared files it could not compare are libkernel/CMakeLists.txt, libc/src/General.cpp and libc/include/General.hpp, which this PR touches only to add a test case and the alias counter)
  • 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 (PPSA01342 #1283 starts faster)
  • GPUs tested: n/a
  • AI-assisted: yes

🤖 Generated with Claude Code

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5018564427 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11446). Originally posted by [noir39](https://github.com/noir39) on 2026-10-26T13:51:09Z. --- ### What `sceKernelAprResolveFilepathsToIds*` already takes each file's size from a listing of its directory (one directory read instead of one size query per path), but it still resolved every path through `ResolvePath`, which on Windows asks the file system for each file's attributes (`GetFileAttributesW` in `ResolveHostPath`). An absolute path now resolves its directory once, cached by the guest directory, and the file is looked up in that directory's listing. The fast path is taken only when the listing has an entry whose on-disk name equals the guest's last component exactly. Everything else takes the full resolve as before, so `MatchNames` still corrects the case and still reports an ambiguous name: - a name in other case than on disk, or a key that two on-disk names share (a case-sensitive directory holding `E.bin` and `e.bin`; the size query then also skips the listing); - a file not in the listing (created since); - a relative path, a path ending in `.`, `..` or a separator, a last component containing `\` or `:`, a last component longer than 255 bytes, a path of 1024 bytes or more; - a directory or name whose resolve or conversion throws (a name that is not valid UTF-8, a directory that exists only in `app0.zar`). The directory cache is dropped whenever a path alias changes: libc counts `AddPathAlias`, `RemovePathAlias`, `BlockPathAlias` and `AddPathProvider` calls (`PathAliasGeneration_nid_no_patch`), so a save-data mount point rebound to another save resolves into the new directory (the case @MarcZX10 found in the review of #10633, which this PR replaces: #10633 was closed by the open-PR limit and could not be reopened after the branch was rebased). ### Tested <!-- OS, title or homebrew, what was checked. "Not tested" is a valid answer. A performance change: the summary lines of main and of this PR from the same machine and scene, with the traces attached, captured as the Performance report issue form describes. --> Windows 11 Pro 26200, Ryzen 9 5950X, Samsung 980 NVMe, RTX 3080, WinLibs GCC 15.2.0 r7, branch rebased onto `main` `f759e165d9`. - `guest_apr_read_resolve` (`BUILD_TESTING=ON`): absolute paths in one directory and a subdirectory; a name in other case than on disk (`b.BIN` for `B.bin`); every resolved id is stat'ed (`sceKernelAprGetFileStat`) and read through a `ReadFile` command; the same id for a path resolved again; a file created after its directory was listed; a missing file (`error_index`, size 0); a 256-byte name (reported missing); two names differing only in case, checked where the host file system keeps both; an alias rebound from one directory to another between two resolves of the same path. - `ctest -R "guest_apr|guest_ampr|savedata|guest_path|working_directory|guest_directory|realpath|app_archive|fopen_long"`: 45 of 45 pass; `tools/check_conventions.py` passes. **Start-up timing.** The gain is before the title's first frame, outside the `aps5-summary.jsonl` frame summaries, so this is the title's own timing of that phase, measured the same way for both builds: - Demon's Souls PPSA01342 v1.005 resolves its whole package at start-up through `sceKernelAprResolveFilepathsToIds*`: about 243,000 paths in `ResourcePool::GatherResourceFileInfo`, which logs its own duration. - Both builds were Release builds of the same tree: `main` `f759e165d9` and this branch on it. - The same relinked `eboot.elf`, the same `relinker.exe` and the same save; only `libs\` was swapped, with its `libkernel.prx` hash checked against the build. - Each build ran from launch until that line plus the first presented frame, then the process was stopped. No input, default environment. - The first runs after a library swap rebuild the shader disk cache, so only runs on a warm cache are listed (`[shader-disk-cache]` totals of at most 7 misses; the cold runs took 1:04 and 1:00 on `main` while compiling about 2,000 shaders). | Build | `GatherResourceFileInfo() took` | Line logged at (s after launch) | |---|---|---| | `main` `f759e165d9` | 48.96 s, 46.88 s, 47.86 s | 56.5, 54.5, 57.9 | | this PR `e8ba6924a4` | 7.53 s, 7.48 s, 7.50 s | 15.2, 15.1, 15.2 | An earlier series on `main` `4a6005955f` gave 47.03 s, 46.82 s and 46.88 s. <details><summary>Raw log lines</summary> ``` main f759e165d9 [MSG-Init] ResourcePool::GatherResourceFileInfo() took 48.9576s shader-disk-cache totals: 4024 hits, 7 misses main f759e165d9 [MSG-Init] ResourcePool::GatherResourceFileInfo() took 46.8830s shader-disk-cache totals: 4031 hits, 0 misses main f759e165d9 [MSG-Init] ResourcePool::GatherResourceFileInfo() took 47.8563s shader-disk-cache totals: 4031 hits, 0 misses PR e8ba6924a4 [MSG-Init] ResourcePool::GatherResourceFileInfo() took 7.5289s shader-disk-cache totals: 4016 hits, 0 misses PR e8ba6924a4 [MSG-Init] ResourcePool::GatherResourceFileInfo() took 7.4760s shader-disk-cache totals: 4016 hits, 0 misses PR e8ba6924a4 [MSG-Init] ResourcePool::GatherResourceFileInfo() took 7.4960s shader-disk-cache totals: 4016 hits, 0 misses ``` </details> ### Checklist <!-- Rules behind each item: https://github.com/boykopovar/AnyPS5/blob/main/CONTRIBUTING.md --> - [x] Based on current `main` (`f759e165d9`); no other open PR implements the same functions (`tools/pr_overlap.py`: no other open PR conflicts with these lines; the shared files it could not compare are `libkernel/CMakeLists.txt`, `libc/src/General.cpp` and `libc/include/General.hpp`, which this PR touches only to add a test case and the alias counter) - [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 (PPSA01342 #1283 starts faster) - [x] GPUs tested: n/a - [x] AI-assisted: yes 🤖 Generated with [Claude Code](https://claude.com/claude-code)
MarcZX10 commented 2026-10-26 14:04:30 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T14:04:30Z.

Review: CHANGES_REQUESTED


Current main is 263fbcd2d3; this branch's merge base is 6cd36e6517. I checked the merge directly: git merge-tree upstream/main upstream/pr-11446 reports a content conflict in core/libs/tests/GuestAprRead.cpp. Please rebase onto current main and preserve the intervening APR test coverage before asking for a final review. The local focused build could not be configured because SDL2 development files are unavailable here, so I did not run guest_apr_read_tests; the 44/44 Windows test result in the description is author-reported.

The PR is labeled perf, but the required aps5-summary.jsonl before/after lines, attached traces and tools/trace_digest.py output are absent. The title startup timings are useful, but the description says the standard frame summary does not cover this pre-first-frame phase. Please get maintainer direction on an accepted startup measurement format and attach that evidence (or otherwise resolve the perf numbers missing requirement) before merge. I have not treated the timing log as a substitute for the prescribed report.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5653211309 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11446#pullrequestreview-5653211309). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T14:04:30Z. **Review:** CHANGES_REQUESTED --- Current `main` is `263fbcd2d3`; this branch's merge base is `6cd36e6517`. I checked the merge directly: `git merge-tree upstream/main upstream/pr-11446` reports a content conflict in `core/libs/tests/GuestAprRead.cpp`. Please rebase onto current `main` and preserve the intervening APR test coverage before asking for a final review. The local focused build could not be configured because SDL2 development files are unavailable here, so I did not run `guest_apr_read_tests`; the 44/44 Windows test result in the description is author-reported. The PR is labeled `perf`, but the required `aps5-summary.jsonl` before/after lines, attached traces and `tools/trace_digest.py` output are absent. The title startup timings are useful, but the description says the standard frame summary does not cover this pre-first-frame phase. Please get maintainer direction on an accepted startup measurement format and attach that evidence (or otherwise resolve the `perf numbers missing` requirement) before merge. I have not treated the timing log as a substitute for the prescribed report.
MarcZX10 commented 2026-10-26 16:22:04 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-26T16:22:04Z.

Review: CHANGES_REQUESTED


I rechecked exact head e04cf056aca7 against live main 518d36eaec0a. The prior GuestAprRead.cpp merge conflict is resolved, but the current merge base is 1061954c7e55 and main has since changed core/libs/prx/libkernel/CMakeLists.txt, which this PR also modifies. Please sync to current main, preserve the added tests, and rerun the focused APR suite and conventions on the updated tree. The author-reported 44/44 run is on the older 1061954c7 base.

The performance requirement also remains unresolved: the PR reports a startup improvement before the first present, outside the documented frame-trace window. I still do not see a valid same-title/same-scene main/change capture pair and digests. Please get maintainer direction on an accepted reproducible startup benchmark format (same machine, title, startup path, base/head and raw timings) or otherwise resolve the perf numbers missing requirement; I will not treat the current title log as the prescribed trace report.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5655348751 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11446#pullrequestreview-5655348751). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-26T16:22:04Z. **Review:** CHANGES_REQUESTED --- I rechecked exact head `e04cf056aca7` against live `main` `518d36eaec0a`. The prior `GuestAprRead.cpp` merge conflict is resolved, but the current merge base is `1061954c7e55` and `main` has since changed `core/libs/prx/libkernel/CMakeLists.txt`, which this PR also modifies. Please sync to current `main`, preserve the added tests, and rerun the focused APR suite and conventions on the updated tree. The author-reported 44/44 run is on the older `1061954c7` base. The performance requirement also remains unresolved: the PR reports a startup improvement before the first present, outside the documented frame-trace window. I still do not see a valid same-title/same-scene main/change capture pair and digests. Please get maintainer direction on an accepted reproducible startup benchmark format (same machine, title, startup path, base/head and raw timings) or otherwise resolve the `perf numbers missing` requirement; I will not treat the current title log as the prescribed trace report.
adriadam10 commented 2026-10-27 10:21:14 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by adriadam10 on 2026-10-27T10:21:14Z.

Review: DISMISSED


Thanks, the alias invalidation (PathAliasGeneration) looks right and its test covers it. Points to fix:

  • Apr.cpp:151: hostDirectory / name uses the guest's spelling, while _listedSize matches case-folded. On Linux (or a case-sensitive directory) with only B.bin on disk, /apr_resolve/b.BIN returns size 5 but stores a host path that does not exist, so ReadFile and sceKernelAprGetFileStat on that id throw, and b.BIN/B.bin get two ids. Main resolves via MatchNames and gets B.bin (or the ambiguity error). Keep the on-disk name from the listing and take the fast path only when it equals the guest's name; make the test read/stat ids[1].
  • :145/:151 run outside ResolvePathError: on Windows a non-UTF-8 name throws filesystem_error, and a directory that exists only in app0.zar throws NotImplemented where main returns ENOENT. Fall back to the full resolve in both cases.
  • The last component skips Resolve's checks: a name containing : (D:foo.bin drops the root name through operator/), names over MaxName, full paths reaching MaxPath. Fall back to the full resolve for those.
  • The perf label needs the aps5-summary.jsonl lines of main and of the change from the same title, scene and machine plus the tools/trace_digest.py output. If the start-up phase falls outside the frame summary, attach the title's own timing for both builds, the same way for each, in the PR.

Please also sync with current main (libkernel/CMakeLists.txt changed) and rerun the focused APR tests.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5665495312 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11446#pullrequestreview-5665495312). Originally posted by [adriadam10](https://github.com/adriadam10) on 2026-10-27T10:21:14Z. **Review:** DISMISSED --- Thanks, the alias invalidation (`PathAliasGeneration`) looks right and its test covers it. Points to fix: - `Apr.cpp:151`: `hostDirectory / name` uses the guest's spelling, while `_listedSize` matches case-folded. On Linux (or a case-sensitive directory) with only `B.bin` on disk, `/apr_resolve/b.BIN` returns size 5 but stores a host path that does not exist, so ReadFile and `sceKernelAprGetFileStat` on that id throw, and `b.BIN`/`B.bin` get two ids. Main resolves via `MatchNames` and gets `B.bin` (or the ambiguity error). Keep the on-disk name from the listing and take the fast path only when it equals the guest's name; make the test read/stat `ids[1]`. - `:145`/`:151` run outside `ResolvePathError`: on Windows a non-UTF-8 name throws `filesystem_error`, and a directory that exists only in `app0.zar` throws `NotImplemented` where main returns ENOENT. Fall back to the full resolve in both cases. - The last component skips `Resolve`'s checks: a name containing `:` (`D:foo.bin` drops the root name through `operator/`), names over `MaxName`, full paths reaching `MaxPath`. Fall back to the full resolve for those. - The `perf` label needs the `aps5-summary.jsonl` lines of `main` and of the change from the same title, scene and machine plus the `tools/trace_digest.py` output. If the start-up phase falls outside the frame summary, attach the title's own timing for both builds, the same way for each, in the PR. Please also sync with current `main` (`libkernel/CMakeLists.txt` changed) and rerun the focused APR tests.
MarcZX10 commented 2026-10-29 07:22:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-29T07:22:05Z.

Review: CHANGES_REQUESTED


Re-checked — changes requested

The author addressed the previously reported case-folding and fallback issues in the code, and the hosted checks pass on the current PR head. The remaining report and validation are still tied to the branch’s older base; current main has since changed Apr.cpp, and the repository still marks this PR needs rebase and perf numbers missing.

What I ran

  • Read the full PR diff and the author’s response to the earlier review.
  • Compared exact PR head e8ba6924a4170e923d93acfc945c13f3c63314f9 with current upstream main edf6804cf52c62eacafc592dd6142cb4efe5bd05.
  • Ran git merge-tree --write-tree, git diff --check, and python3 tools/check_conventions.py --base upstream/main.
  • Checked hosted CI.
  • Did not build or run the focused test locally; the available build-review tree has no APR test target.

Results

Check Result
Current-main merge preview Clean
git diff --check Pass
Current-main conventions Pass
Hosted Windows, relinker, ASan, macOS/Ubuntu register-context and write-watch, eligibility, labels and report Passed on the current PR head
Hosted Linux product job Skipped
Independent local APR test in this re-check Not run
Unedited local check output
$ git merge-base upstream/main refs/review/upstream-11446
f759e165d9cc3088b196f9b544e038687003fef4
$ git merge-tree --write-tree upstream/main refs/review/upstream-11446
b66355cbc8aca694aacca7f97fc8f128c4f12fcb
$ git rev-list --left-right --count upstream/main...refs/review/upstream-11446
1370 4
$ git diff --check upstream/main...refs/review/upstream-11446
(no output; exit status 0)
$ python3 tools/check_conventions.py --base upstream/main
All conventions checks passed.
$ git diff --name-status <merge-base>..upstream/main -- Apr.cpp, GuestAprRead.cpp
M docs/dev/debt/libc.md
M docs/dev/debt/libkernel.md

Current main also changes core/libs/prx/libkernel/Apr/src/Apr.cpp (the AMM pool implementation), which is the main production file changed by this PR. The merge preview is clean, but the old-base test result does not cover the integrated code.

Negative control

The author reports that the PR’s focused suite passes on its tested tree. I did not independently run a negative control in this re-check.

Findings

Blocking

  • Rebase or merge current main, then rerun the focused APR suite on the integrated head, including a Linux run that exercises case-sensitive names. The reported 45/45 result is from main f759e165d9, and current main changed the same production file since then.
  • The PR is still labeled perf numbers missing. The startup timing table is useful, but it does not provide the two aps5-summary.jsonl lines, attached traces and trace_digest.py results required by the current performance-report rule. Since this measurement ends before the first frame, please get a maintainer decision on an acceptable startup-report format and record it before treating the perf requirement as satisfied.

Non-blocking

  • The 256-byte-name test currently uses a name that cannot exist on the host, so it also passes if the new length guard is removed. A Windows-specific file with 128 two-byte UTF-8 characters would exercise the fast-path fallback while remaining within NTFS’s 255 UTF-16-unit component limit.

Sources

Not verified

I did not independently reproduce the Windows startup timings or the author-reported focused test results.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5694158285 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11446#pullrequestreview-5694158285). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-29T07:22:05Z. **Review:** CHANGES_REQUESTED --- # Re-checked — changes requested The author addressed the previously reported case-folding and fallback issues in the code, and the hosted checks pass on the current PR head. The remaining report and validation are still tied to the branch’s older base; current `main` has since changed `Apr.cpp`, and the repository still marks this PR `needs rebase` and `perf numbers missing`. ## What I ran - Read the full PR diff and the author’s response to the earlier review. - Compared exact PR head `e8ba6924a4170e923d93acfc945c13f3c63314f9` with current upstream `main` `edf6804cf52c62eacafc592dd6142cb4efe5bd05`. - Ran `git merge-tree --write-tree`, `git diff --check`, and `python3 tools/check_conventions.py --base upstream/main`. - Checked hosted CI. - Did not build or run the focused test locally; the available `build-review` tree has no APR test target. ## Results | Check | Result | |---|---| | Current-main merge preview | Clean | | `git diff --check` | Pass | | Current-main conventions | Pass | | Hosted Windows, relinker, ASan, macOS/Ubuntu register-context and write-watch, eligibility, labels and report | Passed on the current PR head | | Hosted Linux product job | Skipped | | Independent local APR test in this re-check | Not run | <details><summary>Unedited local check output</summary> ```text $ git merge-base upstream/main refs/review/upstream-11446 f759e165d9cc3088b196f9b544e038687003fef4 $ git merge-tree --write-tree upstream/main refs/review/upstream-11446 b66355cbc8aca694aacca7f97fc8f128c4f12fcb $ git rev-list --left-right --count upstream/main...refs/review/upstream-11446 1370 4 $ git diff --check upstream/main...refs/review/upstream-11446 (no output; exit status 0) $ python3 tools/check_conventions.py --base upstream/main All conventions checks passed. $ git diff --name-status <merge-base>..upstream/main -- Apr.cpp, GuestAprRead.cpp M docs/dev/debt/libc.md M docs/dev/debt/libkernel.md ``` Current `main` also changes `core/libs/prx/libkernel/Apr/src/Apr.cpp` (the AMM pool implementation), which is the main production file changed by this PR. The merge preview is clean, but the old-base test result does not cover the integrated code. </details> ## Negative control The author reports that the PR’s focused suite passes on its tested tree. I did not independently run a negative control in this re-check. ## Findings ### Blocking - Rebase or merge current `main`, then rerun the focused APR suite on the integrated head, including a Linux run that exercises case-sensitive names. The reported 45/45 result is from `main` `f759e165d9`, and current `main` changed the same production file since then. - The PR is still labeled `perf numbers missing`. The startup timing table is useful, but it does not provide the two `aps5-summary.jsonl` lines, attached traces and `trace_digest.py` results required by the current performance-report rule. Since this measurement ends before the first frame, please get a maintainer decision on an acceptable startup-report format and record it before treating the perf requirement as satisfied. ### Non-blocking - The 256-byte-name test currently uses a name that cannot exist on the host, so it also passes if the new length guard is removed. A Windows-specific file with 128 two-byte UTF-8 characters would exercise the fast-path fallback while remaining within NTFS’s 255 UTF-16-unit component limit. ## Sources - [Current PR head `e8ba6924a4170e923d93acfc945c13f3c63314f9`](https://github.com/boykopovar/AnyPS5/commit/e8ba6924a4170e923d93acfc945c13f3c63314f9) - [Current upstream `main` `edf6804cf52c62eacafc592dd6142cb4efe5bd05`](https://github.com/boykopovar/AnyPS5/commit/edf6804cf52c62eacafc592dd6142cb4efe5bd05) - [Author’s implementation, test and startup-timing update](https://github.com/boykopovar/AnyPS5/pull/11446#issuecomment-6456007110) - [Independent review of the remaining long-name test gap](https://github.com/boykopovar/AnyPS5/pull/11446#issuecomment-6462551346) - [Performance evidence requirements](https://github.com/boykopovar/AnyPS5/blob/edf6804cf52c62eacafc592dd6142cb4efe5bd05/CONTRIBUTING.md#L67-L71) ## Not verified I did not independently reproduce the Windows startup timings or the author-reported focused test results.
XairRrR commented 2026-11-03 21:00:05 +00:00 (Migrated from github.com)

Imported from boykopovar/AnyPS5. Originally posted by XairRrR on 2026-11-03T21:00:05Z.

Review: COMMENTED


Reviewed — comments

The fast path builds and the focused path/APR tests pass on Linux. With main's production files the new guest_apr_read_resolve test fails, and reading the code turned up no new correctness problem. I could not reproduce the Windows start-up gain, and the perf evidence question raised earlier is still open, so this is not an approval.

What I ran

Head e8ba6924a4170e923d93acfc945c13f3c63314f9 merged into main 086c0686c8adff3ee648fdbe34e0b0b647e1d511 (--no-ff). Clean worktree, Debian 13 VM, GCC 14.2.0, Release, Ninja, BUILD_TESTING=ON.

git diff --check 086c0686c8adff3ee648fdbe34e0b0b647e1d511...e8ba6924a4170e923d93acfc945c13f3c63314f9
python3 tools/check_conventions.py --base 086c0686c8adff3ee648fdbe34e0b0b647e1d511
ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "guest_apr|guest_ampr|savedata|guest_path|working_directory|guest_directory|realpath|app_archive|fopen_long"
ninja -C build -j32 -l32 savedata_replace_file_failure_tests
ctest --test-dir build --output-on-failure -R "savedata_replace_file_failure|guest_apr_read_resolve"
# negative control: General.hpp, General.cpp, Apr.cpp from main
ninja -C build -j32 -l32 guest_apr_read_tests
ctest --test-dir build --output-on-failure -R guest_apr_read
# restore the merged files, rebuild, rerun the focused set
ninja -C build -j32 -l32 guest_apr_read_tests savedata_replace_file_failure_tests
ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "<same focused regex>"
git status --porcelain

Results

Check Result
git diff --check clean
check_conventions.py All conventions checks passed
Build (script) OK
Script test run no new failures, no timeouts; the known failures fail on main too and are unrelated (AGC denormal, network)
Focused regex (author's set) 44/44 pass after building savedata_replace_file_failure_tests. The selected build had skipped that executable, so the first run reported it "Not Run".
guest_apr_read_resolve Passed, 0.03 s
Vulkan validation Not applicable (no AGC, shader or VideoOut file)
Worktree after restore git status --porcelain empty

Negative control

I restored core/libs/prx/libc/include/General.hpp, core/libs/prx/libc/src/General.cpp and core/libs/prx/libkernel/Apr/src/Apr.cpp from main, kept the PR's test, and rebuilt.

guest_apr_read_resolve then fails: APR mixed up two names that differ only in case. On main the listing stores one size for E.bin and e.bin on ext4, so the test does catch the ambiguity handling (Apr.cpp:78). The other six guest_apr_read_* cases pass either way.

With the merged files restored and rebuilt, the focused set passes 44/44 again.

Findings

Blocking

None from this review. MarcZX10's open point about the perf evidence still stands. The phase ends before the first frame, so aps5-summary.jsonl lines cannot show it, and the PR keeps the perf numbers missing label until a maintainer accepts the title's own start-up timing or names another format. I have nothing to add to that.

Non-blocking

  • The 256-byte-name check cannot fail (core/libs/tests/GuestAprRead.cpp:146). I confirm thuanquang's point by reading the code; I did not run it with the length guard removed. No file of that name is created, so the full resolve rejects it on main and with the PR alike. Removing the MAX_NAME_LENGTH guard in _listedPath (Apr.cpp:148-160) would go unnoticed. Their suggestion would make the check bite on Windows: create a file of 128 × é (256 UTF-8 bytes) and require that resolving it fails.

What I checked by reading the merged tree, with no problem found:

  • Cache key and id consistency. hostDirectory / guestName (Apr.cpp:184) gives the same string as ResolveHostPath's Child(root, ...) for the direct hit, so a path resolved through the fast path and through the fallback maps to one id.
  • Path providers (SandboxCertificates.cpp, file-level AddPathProvider). They are equivalent: ProvidedPath returns the on-disk file when it exists, and when it does not, the file is absent from the listing and the fallback runs.
  • Blocked mounts. These also stay equivalent. BlockPathAlias bumps the generation, and a blocked directory throws inside the try, which falls back to the full resolve.
  • Generation race. The counter is bumped under the alias mutex before the entries change. ResolveAlias takes that mutex, and the insert at Apr.cpp:179 re-checks the generation, so a directory resolved across an alias change is not cached.
  • Windows names. listedName == guestName compares the native strings case-sensitively, so on NTFS a guest spelling in other case still takes the full resolve, as on main.

Not verified

  • Start-up timing. The 49 s → 7.5 s Demon's Souls figure is Windows-only, and I launched no title, so it is the author's report.
  • Windows-only paths. The FindFirstFileW listing with the try around _addListed, the non-UTF-8 fallback, and the D:-style component are not compiled or run on this Linux machine.
  • The 256-byte-name mutation above was not run.

To get this to a good state

  1. Settle the perf numbers missing requirement with a maintainer: either accept the title's start-up timing table already in the description, or name the format they want.
  2. Optionally, make the long-name test able to fail (the 128 × é file on Windows).
<!-- greyfinch-sync:boykopovar/AnyPS5:review:5759392048 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11446#pullrequestreview-5759392048). Originally posted by [XairRrR](https://github.com/XairRrR) on 2026-11-03T21:00:05Z. **Review:** COMMENTED --- # Reviewed — comments The fast path builds and the focused path/APR tests pass on Linux. With `main`'s production files the new `guest_apr_read_resolve` test fails, and reading the code turned up no new correctness problem. I could not reproduce the Windows start-up gain, and the `perf` evidence question raised earlier is still open, so this is not an approval. ## What I ran Head `e8ba6924a4170e923d93acfc945c13f3c63314f9` merged into `main` `086c0686c8adff3ee648fdbe34e0b0b647e1d511` (`--no-ff`). Clean worktree, Debian 13 VM, GCC 14.2.0, Release, Ninja, `BUILD_TESTING=ON`. ``` git diff --check 086c0686c8adff3ee648fdbe34e0b0b647e1d511...e8ba6924a4170e923d93acfc945c13f3c63314f9 python3 tools/check_conventions.py --base 086c0686c8adff3ee648fdbe34e0b0b647e1d511 ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "guest_apr|guest_ampr|savedata|guest_path|working_directory|guest_directory|realpath|app_archive|fopen_long" ninja -C build -j32 -l32 savedata_replace_file_failure_tests ctest --test-dir build --output-on-failure -R "savedata_replace_file_failure|guest_apr_read_resolve" # negative control: General.hpp, General.cpp, Apr.cpp from main ninja -C build -j32 -l32 guest_apr_read_tests ctest --test-dir build --output-on-failure -R guest_apr_read # restore the merged files, rebuild, rerun the focused set ninja -C build -j32 -l32 guest_apr_read_tests savedata_replace_file_failure_tests ctest --test-dir build -j8 --test-load 32 --output-on-failure -R "<same focused regex>" git status --porcelain ``` ## Results | Check | Result | |---|---| | `git diff --check` | clean | | `check_conventions.py` | All conventions checks passed | | Build (script) | OK | | Script test run | no new failures, no timeouts; the known failures fail on `main` too and are unrelated (AGC denormal, network) | | Focused regex (author's set) | 44/44 pass after building `savedata_replace_file_failure_tests`. The selected build had skipped that executable, so the first run reported it "Not Run". | | `guest_apr_read_resolve` | Passed, 0.03 s | | Vulkan validation | Not applicable (no AGC, shader or VideoOut file) | | Worktree after restore | `git status --porcelain` empty | ## Negative control I restored `core/libs/prx/libc/include/General.hpp`, `core/libs/prx/libc/src/General.cpp` and `core/libs/prx/libkernel/Apr/src/Apr.cpp` from `main`, kept the PR's test, and rebuilt. `guest_apr_read_resolve` then **fails**: `APR mixed up two names that differ only in case`. On `main` the listing stores one size for `E.bin` and `e.bin` on ext4, so the test does catch the ambiguity handling (`Apr.cpp:78`). The other six `guest_apr_read_*` cases pass either way. With the merged files restored and rebuilt, the focused set passes 44/44 again. ## Findings ### Blocking None from this review. MarcZX10's open point about the `perf` evidence still stands. The phase ends before the first frame, so `aps5-summary.jsonl` lines cannot show it, and the PR keeps the `perf numbers missing` label until a maintainer accepts the title's own start-up timing or names another format. I have nothing to add to that. ### Non-blocking - **The 256-byte-name check cannot fail** (`core/libs/tests/GuestAprRead.cpp:146`). I confirm thuanquang's point by reading the code; I did not run it with the length guard removed. No file of that name is created, so the full resolve rejects it on `main` and with the PR alike. Removing the `MAX_NAME_LENGTH` guard in `_listedPath` (`Apr.cpp:148-160`) would go unnoticed. Their suggestion would make the check bite on Windows: create a file of 128 × `é` (256 UTF-8 bytes) and require that resolving it fails. What I checked by reading the merged tree, with no problem found: - **Cache key and id consistency.** `hostDirectory / guestName` (`Apr.cpp:184`) gives the same string as `ResolveHostPath`'s `Child(root, ...)` for the direct hit, so a path resolved through the fast path and through the fallback maps to one id. - **Path providers** (`SandboxCertificates.cpp`, file-level `AddPathProvider`). They are equivalent: `ProvidedPath` returns the on-disk file when it exists, and when it does not, the file is absent from the listing and the fallback runs. - **Blocked mounts.** These also stay equivalent. `BlockPathAlias` bumps the generation, and a blocked directory throws inside the `try`, which falls back to the full resolve. - **Generation race.** The counter is bumped under the alias mutex before the entries change. `ResolveAlias` takes that mutex, and the insert at `Apr.cpp:179` re-checks the generation, so a directory resolved across an alias change is not cached. - **Windows names.** `listedName == guestName` compares the native strings case-sensitively, so on NTFS a guest spelling in other case still takes the full resolve, as on `main`. ## Not verified - **Start-up timing.** The 49 s → 7.5 s Demon's Souls figure is Windows-only, and I launched no title, so it is the author's report. - **Windows-only paths.** The `FindFirstFileW` listing with the `try` around `_addListed`, the non-UTF-8 fallback, and the `D:`-style component are not compiled or run on this Linux machine. - **The 256-byte-name mutation** above was not run. ## To get this to a good state 1. Settle the `perf numbers missing` requirement with a maintainer: either accept the title's start-up timing table already in the description, or name the format they want. 2. Optionally, make the long-name test able to fail (the 128 × `é` file on Windows). <!-- anyps5-bots job=2086 head=e8ba6924a4170e923d93acfc945c13f3c63314f9 -->
MarcZX10 commented 2026-11-14 07:25:05 +00:00 (Migrated from github.com)

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

Review: APPROVED


Reviewed — looks good

The reviewed change is sound on the inspected paths; no verified defect blocks merging.

What I ran

Reviewed head 5c5b61fc844b49358dff28854c5ac87866a83663 using repo_read.py against the prepared bundle and pinned source. No commands or tests were run by me; the description reports Windows 11 tests and timings.

Results

Check Result Note
Diff and changed source review passed Five changed files inspected
Tests in this review not run Author reports 45 of 45 selected tests passing
Performance measurements not run Author reports matched start-up timings

Findings

Blocking

None.

Non-blocking

None.

Not verified

I read all five files marked included in the manifest: core/libs/prx/libc/include/General.hpp, core/libs/prx/libc/src/General.cpp, core/libs/prx/libkernel/Apr/src/Apr.cpp, core/libs/prx/libkernel/CMakeLists.txt, and core/libs/tests/GuestAprRead.cpp. The manifest contains no excluded changed files. I did not run tests or independently verify the reported Windows results, benchmark captures, or behavior on other platforms.

To get this to a good state

Nothing is required.

<!-- greyfinch-sync:boykopovar/AnyPS5:review:5902647988 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/pull/11446#pullrequestreview-5902647988). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-11-14T07:25:05Z. **Review:** APPROVED --- # Reviewed — looks good The reviewed change is sound on the inspected paths; no verified defect blocks merging. ## What I ran Reviewed head `5c5b61fc844b49358dff28854c5ac87866a83663` using `repo_read.py` against the prepared bundle and pinned source. No commands or tests were run by me; the description reports Windows 11 tests and timings. ## Results | Check | Result | Note | |---|---|---| | Diff and changed source review | passed | Five changed files inspected | | Tests in this review | not run | Author reports 45 of 45 selected tests passing | | Performance measurements | not run | Author reports matched start-up timings | ## Findings ### Blocking None. ### Non-blocking None. ## Not verified I read all five files marked included in the manifest: `core/libs/prx/libc/include/General.hpp`, `core/libs/prx/libc/src/General.cpp`, `core/libs/prx/libkernel/Apr/src/Apr.cpp`, `core/libs/prx/libkernel/CMakeLists.txt`, and `core/libs/tests/GuestAprRead.cpp`. The manifest contains no excluded changed files. I did not run tests or independently verify the reported Windows results, benchmark captures, or behavior on other platforms. ## 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!11446
No description provided.