LEGO Batman: Legacy of the Dark Knight (PPSA16833): sceKernelReleaseDirectMemory of a ~336 MiB render-target block waits forever in GuestAllocationsRequireUnpinned while the GPU is idle (pin abort, or RenderThread 120 s timeout) #7408

Closed
opened 2026-10-18 04:56:18 +00:00 by Tamalero · 10 comments
Tamalero commented 2026-10-18 04:56:18 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-18T04:56:18Z.


LEGO Batman frees a block of about 336 MiB that holds its 2560x1440 render targets at level loads and when the player switches between Performance and Fidelity mode. The free never completes. sceKernelReleaseDirectMemory sits in GuestAllocationsRequireUnpinned → WaitForLeasesAndImports, and every AGC driver thread is idle meanwhile, so no GPU work is left to drop the lease. Whichever timer runs out first ends the title:

  • with the default APS5_PIN_WAIT_MS (60 s): guest allocation … is still pinned by GPU work or an import (waited 60000 ms for the lease)
  • with APS5_PIN_WAIT_MS=180000: Unreal's own watchdog fires first, GameThread timed out waiting for RenderThread after 120.00 secs

4 of 5 desktop runs today ended this way, on two main bases; the fifth died earlier on an unrelated error. Not every level load triggers it: runs 3 and 4 each passed one load before the one that hung. It also happened on an AMD V620 (RADV), so it doesn't depend on the vendor. This looks like the same lease mechanism as #6453, but there the waits end after 15–20 s. Here the wait doesn't end, even with nothing in flight.

Details and logs

Title: LEGO Batman: Legacy of the Dark Knight (PPSA16833 v01.010.000)
Setup: CachyOS, RTX 4090 (NVIDIA 615.78.08), Release. Game files and shader cache on an NVMe SSD for the last two runs. The 2626e5ee7 builds are main plus #7123 only (the guest frame-chain fix, without which LEGO's stack walker crashes first). The 5d9dcc42d builds also carried LEGO's start-up fixes that were unmerged then and are in main now (sampler heap, sceCoredumpConfigDumpMode, the web-browser dialog); the desktop one had #7123 too, the V620 one did not.

Run Base APS5_PIN_WAIT_MS Trigger End
1 5d9dcc42d 60 s (default) end of the first garden area, ~31 min guest allocation 0x115d000000+0x15600000 is still pinned … (waited 60000 ms)
2 5d9dcc42d 180 s loading screen to the next mission guest allocation 0x115ce00000+0x15000000 is still pinned … (waited 180000 ms) ¹
3 2626e5ee7 180 s next map load, ~16 min GameThread timed out waiting for RenderThread after 120.00 secs
4 2626e5ee7 + APS5_NO_RESIDENT_LINEAR=1 180 s Performance → Fidelity in the pause menu GameThread timed out waiting for RenderThread after 120.00 secs
V620 5d9dcc42d 60 s ~1 min after setup guest allocation 0x116ca00000+0x14e00000 is still pinned … (60 s)

¹ A live gcore snapshot paused run 2 for ~5 min during the wait, so its 180 s is not a clean measurement. The snapshot itself is the evidence below.

Where the title waits. This is the same stack in the run-2 snapshot (taken during the freeze) and in the cores of runs 3 and 4. It comes from the same guest call site, app.elf+0x5b564c:

std::_Rb_tree_increment
AgcDriver::Graphics::(anonymous namespace)::WaitForLeasesAndImports(unsigned long, unsigned long)
GuestAllocationsRequireUnpinned_nid_postfix
GuestAllocationsUnmap_nid_postfix
UnmapRegistered(GuestAllocations::Mutation&, void*, unsigned long)
UnmapDirectMemoryViews(std::vector<DirectMemoryView> const&)
sceKernelReleaseDirectMemory
app.elf+0x5b564c

In all three dumps the AGC driver threads are idle in condition-variable waits: Driver::run (both queues), DrawPipeline::run, ReleaseThreadMain and the RegistrationPreparePool workers. Nothing is recording or executing. So the lease that keeps the range pinned belongs to something that isn't running and won't release it on its own. WaitForLeasesAndImports drops the cached address space first, so that holder is ruled out.

What is being freed. The freed block contains the title's 2560x1440 render targets (the log has StorageTexture/Texture lines at 0x115d350000, 0x1167cd0000, 0x116a890000 and 0x1170290000 inside run 1's range). Before run 1's abort, the log also shows the precursor [gpu] leased allocation 0x1171600000+0xc00000 still pinned after 8 recorder syncs, inside the same range. On 2626e5ee7 the same warning appears several times per run, at 0.3–2 MiB ranges.

Ruled out:

  • storage speed: the last two runs read from an SSD
  • the resident linear targets of 88ee39183: run 4 has them off, same result
  • the shader cache state: warm and cold runs both hit it

I haven't identified which object holds the lease. With a pointer to the right counter or holder list, I can add a local diagnostic and rerun. The cores are available locally if a specific value is useful. They contain game memory, so I can't attach them.

Related: #6453 (whole-registry leases make guest unmaps wait; Onimusha, stalls that end), #6182 (oversized registrations kept pinned), #4846 (a 60 s lease wait at exit, closed), #7123.

Tested and written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5906288725 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7408). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-18T04:56:18Z. --- LEGO Batman frees a block of about 336 MiB that holds its 2560x1440 render targets at level loads and when the player switches between Performance and Fidelity mode. The free never completes. `sceKernelReleaseDirectMemory` sits in `GuestAllocationsRequireUnpinned` → `WaitForLeasesAndImports`, and every AGC driver thread is idle meanwhile, so no GPU work is left to drop the lease. Whichever timer runs out first ends the title: - with the default `APS5_PIN_WAIT_MS` (60 s): `guest allocation … is still pinned by GPU work or an import (waited 60000 ms for the lease)` - with `APS5_PIN_WAIT_MS=180000`: Unreal's own watchdog fires first, `GameThread timed out waiting for RenderThread after 120.00 secs` 4 of 5 desktop runs today ended this way, on two `main` bases; the fifth died earlier on an unrelated error. Not every level load triggers it: runs 3 and 4 each passed one load before the one that hung. It also happened on an AMD V620 (RADV), so it doesn't depend on the vendor. This looks like the same lease mechanism as #6453, but there the waits end after 15–20 s. Here the wait doesn't end, even with nothing in flight. <details><summary>Details and logs</summary> **Title:** LEGO Batman: Legacy of the Dark Knight (PPSA16833 v01.010.000) **Setup:** CachyOS, RTX 4090 (NVIDIA 615.78.08), Release. Game files and shader cache on an NVMe SSD for the last two runs. The `2626e5ee7` builds are `main` plus #7123 only (the guest frame-chain fix, without which LEGO's stack walker crashes first). The `5d9dcc42d` builds also carried LEGO's start-up fixes that were unmerged then and are in `main` now (sampler heap, `sceCoredumpConfigDumpMode`, the web-browser dialog); the desktop one had #7123 too, the V620 one did not. | Run | Base | `APS5_PIN_WAIT_MS` | Trigger | End | |---|---|---|---|---| | 1 | `5d9dcc42d` | 60 s (default) | end of the first garden area, ~31 min | `guest allocation 0x115d000000+0x15600000 is still pinned … (waited 60000 ms)` | | 2 | `5d9dcc42d` | 180 s | loading screen to the next mission | `guest allocation 0x115ce00000+0x15000000 is still pinned … (waited 180000 ms)` ¹ | | 3 | `2626e5ee7` | 180 s | next map load, ~16 min | `GameThread timed out waiting for RenderThread after 120.00 secs` | | 4 | `2626e5ee7` + `APS5_NO_RESIDENT_LINEAR=1` | 180 s | Performance → Fidelity in the pause menu | `GameThread timed out waiting for RenderThread after 120.00 secs` | | V620 | `5d9dcc42d` | 60 s | ~1 min after setup | `guest allocation 0x116ca00000+0x14e00000 is still pinned … (60 s)` | ¹ A live `gcore` snapshot paused run 2 for ~5 min during the wait, so its 180 s is not a clean measurement. The snapshot itself is the evidence below. **Where the title waits.** This is the same stack in the run-2 snapshot (taken during the freeze) and in the cores of runs 3 and 4. It comes from the same guest call site, `app.elf+0x5b564c`: ``` std::_Rb_tree_increment AgcDriver::Graphics::(anonymous namespace)::WaitForLeasesAndImports(unsigned long, unsigned long) GuestAllocationsRequireUnpinned_nid_postfix GuestAllocationsUnmap_nid_postfix UnmapRegistered(GuestAllocations::Mutation&, void*, unsigned long) UnmapDirectMemoryViews(std::vector<DirectMemoryView> const&) sceKernelReleaseDirectMemory app.elf+0x5b564c ``` In all three dumps the AGC driver threads are idle in condition-variable waits: `Driver::run` (both queues), `DrawPipeline::run`, `ReleaseThreadMain` and the `RegistrationPreparePool` workers. Nothing is recording or executing. So the lease that keeps the range pinned belongs to something that isn't running and won't release it on its own. `WaitForLeasesAndImports` drops the cached address space first, so that holder is ruled out. **What is being freed.** The freed block contains the title's 2560x1440 render targets (the log has `StorageTexture`/`Texture` lines at `0x115d350000`, `0x1167cd0000`, `0x116a890000` and `0x1170290000` inside run 1's range). Before run 1's abort, the log also shows the precursor `[gpu] leased allocation 0x1171600000+0xc00000 still pinned after 8 recorder syncs`, inside the same range. On `2626e5ee7` the same warning appears several times per run, at 0.3–2 MiB ranges. **Ruled out:** - storage speed: the last two runs read from an SSD - the resident linear targets of 88ee39183: run 4 has them off, same result - the shader cache state: warm and cold runs both hit it I haven't identified which object holds the lease. With a pointer to the right counter or holder list, I can add a local diagnostic and rerun. The cores are available locally if a specific value is useful. They contain game memory, so I can't attach them. Related: #6453 (whole-registry leases make guest unmaps wait; Onimusha, stalls that end), #6182 (oversized registrations kept pinned), #4846 (a 60 s lease wait at exit, closed), #7123. </details> *Tested and written by Claude (AI assistant) on a contributor's machine.*
MarcZX10 commented 2026-10-18 05:09:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T05:09:15Z.


I traced the current main waiter against the stack. WaitForLeasesAndImports can drop Spaces().current, finish through the newest lease batch (or drain the recorder), and retire overlapping live imports (plus parked imports on Windows). The issue's idle-thread snapshot does not distinguish which path keeps making progress, or whether an import is the remaining holder.

Could you capture a small local-only counter trace for one failing unmap, without attaching the core or game memory? The useful values are the pinned range's use_count before and after each callback; whether the callback dropped the address-space cache, finished a lease serial, drained the recorder, or retired an overlapping import; newestLeaseSerial versus finishedLeaseSerial; and whether Recorder::Active()->Idle() was true. A per-wait summary is enough. If the range stays pinned after the cache is dropped and all overlapping imports are retired, while the recorder is idle and its lease serial is finished, that would point us toward a retained CPU-side lease owner; if the serial keeps advancing, it would show new work is still acquiring leases during the mutation.

That should identify a specific holder/path before changing the lease contract, while keeping the captured data limited to counters and addresses already present in the report.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6245959133 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7408#issuecomment-6245959133). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T05:09:15Z. --- I traced the current `main` waiter against the stack. `WaitForLeasesAndImports` can drop `Spaces().current`, finish through the newest lease batch (or drain the recorder), and retire overlapping live imports (plus parked imports on Windows). The issue's idle-thread snapshot does not distinguish which path keeps making progress, or whether an import is the remaining holder. Could you capture a small local-only counter trace for one failing unmap, without attaching the core or game memory? The useful values are the pinned range's `use_count` before and after each callback; whether the callback dropped the address-space cache, finished a lease serial, drained the recorder, or retired an overlapping import; `newestLeaseSerial` versus `finishedLeaseSerial`; and whether `Recorder::Active()->Idle()` was true. A per-wait summary is enough. If the range stays pinned after the cache is dropped and all overlapping imports are retired, while the recorder is idle and its lease serial is finished, that would point us toward a retained CPU-side lease owner; if the serial keeps advancing, it would show new work is still acquiring leases during the mutation. That should identify a specific holder/path before changing the lease contract, while keeping the captured data limited to counters and addresses already present in the report.
MarcZX10 commented 2026-10-18 05:45:56 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T05:45:56Z.


I found an existing, closely matching fix in open PR #6182. Its regression test reproduces an unmap stuck on a registered range split across 64 MiB host-import windows: each window import owns the same whole registered range, but the waiter retires imports by window overlap, so disjoint windows can keep the range pinned after the overlapping import is retired. The reported 336 MiB block is larger than that default window, and the symptom after recorder syncs is consistent with this path.

I cannot confirm from the report alone that LEGO’s render-target block is registered and served by multiple host-import windows. Could you check whether those addresses have multiple HostImport::ranges owners / whether window imports are active during the stuck unmap? If so, #6182 appears to cover the underlying fix and this would not need a duplicate PR. If the block is not host-imported, the requested per-wait use_count and lease-serial counters would still help identify the remaining owner.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6246231171 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7408#issuecomment-6246231171). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T05:45:56Z. --- I found an existing, closely matching fix in open PR #6182. Its regression test reproduces an unmap stuck on a registered range split across 64 MiB host-import windows: each window import owns the same whole registered range, but the waiter retires imports by window overlap, so disjoint windows can keep the range pinned after the overlapping import is retired. The reported 336 MiB block is larger than that default window, and the symptom after recorder syncs is consistent with this path. I cannot confirm from the report alone that LEGO’s render-target block is registered and served by multiple host-import windows. Could you check whether those addresses have multiple `HostImport::ranges` owners / whether window imports are active during the stuck unmap? If so, #6182 appears to cover the underlying fix and this would not need a duplicate PR. If the block is not host-imported, the requested per-wait `use_count` and lease-serial counters would still help identify the remaining owner.
Tamalero commented 2026-10-18 06:57:32 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-18T06:57:32Z.


@MarcZX100 here is the counter trace you asked for, plus something the memory trace turned up along the way.

Counters. The range stays pinned after the cache is dropped and the overlapping import is retired. The recorder is idle and its lease serial is finished. So by your test, this points to a retained CPU-side lease owner, not new work acquiring leases. The serial never advances during the wait.

A release-ordering problem. sceKernelReleaseDirectMemory frees the physical range before it unmaps the views (DirectMemoryFree, then UnmapDirectMemoryViews). While the unmap waits on this lease, the title allocates the freed pages again and maps them as its command-buffer heap. Then a host import of the old render-target block is created again, still covering those pages. On a fast disk this happens on almost every boot, and the title stops on garbage in its own command buffers. Swapping the two calls removes that crash here (2 of 2 boots past the menu). I'll open that as a separate PR.

Details and logs

Same title (PPSA16833), main 2626e5ee7 + #7123, plus local-only counters (APS5_PIN_DIAG) in GuestAllocationsRequireUnpinned (pinned range and use_count per round) and in WaitForLeasesAndImports (which path each call took, newestLeaseSerial/finishedLeaseSerial, Recorder::Active()->Idle(), whether the active recorder is the lease recorder). The counters are rate-limited to the first 3 rounds and then one line per second.

One failing unmap, start to end: the title releases a 62 MiB slice 0x116aa00000+0x3e00000 of the render-target block 0x1158c00000+0x15c00000.

Round / call Path use_count after Serial newest / finished Recorder idle Import overlap / retired
round 0 3
call 1 cache dropped 2
call 2 finish lease serial 3 (briefly 7) 11866 / 11817 → finished yes yes / yes
calls 3 … ~210,000 "nothing to wait for" (yield), alternating with recorder drains 3 throughout 11866 / 11866 yes (yield rounds) no / no
end released after 211,104 rounds, 7,172 ms

A second run with the ordering fix shows the same pattern on the same slice (0x116a800000+0x3e00000): cache drop, one serial finish (35405 → 35461) with an import retired, then use_count=3 with the serial at 35461/35461, the recorder idle and no overlapping import, released after 190,932 rounds / 6,884 ms. In runs 3 and 4 of the report the same wait never ended (RenderThread timeout).

So use_count 3 means the registry plus two owners. Neither is the address-space cache (dropped once, not repopulated: no later cache_drop path) or a lease batch tracked by the serial. One more thing from the import trace: just before the wait ended, a new host import of 0x1158c00000+0x15c00000 was created, covering the slice being unmapped.

Release ordering (APS5_TRACE_MEMORY=1 APS5_TRACE_HOST_IMPORT=1, same run):

[memory] release physical 0x97400000+0x3e00000
[memory] unmap released view 0x116aa00000+0x3e00000
[pin-diag] unmap 0x116aa00000+0x3e00000 pinned range 0x1158c00000+0x15c00000 use_count=3 round=0
...
[memory] allocate physical 0x97400000+0x200000
[memory] map direct 0x10f6e00000+0x200000 phys=0x97400000 prot=0x3f2 flags=0x90
...
[gpu] host import of 0x1158c00000+0x15c00000 ok
[pin-diag] unmap 0x116aa00000+0x3e00000 released after 211104 rounds, 7172 ms
...
AGC driver: unsupported PM4 packet type: header 0x798afea3 at DWORD 34901 of 35168

The title's command buffer at 0x10f6ff0630 lies in the new mapping of 0x97400000…. In the core, that page holds 16-bit image-like rows where packets should be, and those bytes exist nowhere else in host memory. That fits GPU writes through the stale import. All 7,487 file reads of the run (APR, AIO, pread, read) were traced, and none landed within 1 MiB of it.

On an SSD this crash (or the same corruption caught as truncated PM4 packet / sceAgcSetShRegIndirectPatchSetAddress: unexpected packet type) hit 8 of 9 boots, on builds from 5d9dcc42d to 2626e5ee7. On an HDD it hit 0 of 2 tonight on 2626e5ee7, and none of about 20 earlier runs. With the two calls swapped, the same SSD setup passed the menu in 2 of 2 runs, one of them into gameplay.

Tested and written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6246830204 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7408#issuecomment-6246830204). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-18T06:57:32Z. --- @MarcZX100 here is the counter trace you asked for, plus something the memory trace turned up along the way. **Counters.** The range stays pinned after the cache is dropped and the overlapping import is retired. The recorder is idle and its lease serial is finished. So by your test, this points to a retained CPU-side lease owner, not new work acquiring leases. The serial never advances during the wait. **A release-ordering problem.** `sceKernelReleaseDirectMemory` frees the physical range before it unmaps the views (`DirectMemoryFree`, then `UnmapDirectMemoryViews`). While the unmap waits on this lease, the title allocates the freed pages again and maps them as its command-buffer heap. Then a host import of the old render-target block is created again, still covering those pages. On a fast disk this happens on almost every boot, and the title stops on garbage in its own command buffers. Swapping the two calls removes that crash here (2 of 2 boots past the menu). I'll open that as a separate PR. <details><summary>Details and logs</summary> Same title (PPSA16833), `main` `2626e5ee7` + #7123, plus local-only counters (`APS5_PIN_DIAG`) in `GuestAllocationsRequireUnpinned` (pinned range and `use_count` per round) and in `WaitForLeasesAndImports` (which path each call took, `newestLeaseSerial`/`finishedLeaseSerial`, `Recorder::Active()->Idle()`, whether the active recorder is the lease recorder). The counters are rate-limited to the first 3 rounds and then one line per second. **One failing unmap, start to end**: the title releases a 62 MiB slice `0x116aa00000+0x3e00000` of the render-target block `0x1158c00000+0x15c00000`. | Round / call | Path | `use_count` after | Serial newest / finished | Recorder idle | Import overlap / retired | |---|---|---|---|---|---| | round 0 | | 3 | | | | | call 1 | cache dropped | 2 | | | | | call 2 | finish lease serial | 3 (briefly 7) | 11866 / 11817 → finished | yes | yes / yes | | calls 3 … ~210,000 | "nothing to wait for" (yield), alternating with recorder drains | **3** throughout | **11866 / 11866** | yes (yield rounds) | no / no | | end | released after 211,104 rounds, **7,172 ms** | | | | | A second run with the ordering fix shows the same pattern on the same slice (`0x116a800000+0x3e00000`): cache drop, one serial finish (35405 → 35461) with an import retired, then `use_count=3` with the serial at 35461/35461, the recorder idle and no overlapping import, released after 190,932 rounds / 6,884 ms. In runs 3 and 4 of the report the same wait never ended (RenderThread timeout). So `use_count` 3 means the registry plus two owners. Neither is the address-space cache (dropped once, not repopulated: no later `cache_drop` path) or a lease batch tracked by the serial. One more thing from the import trace: just before the wait ended, a new `host import of 0x1158c00000+0x15c00000` was created, covering the slice being unmapped. **Release ordering** (`APS5_TRACE_MEMORY=1 APS5_TRACE_HOST_IMPORT=1`, same run): ``` [memory] release physical 0x97400000+0x3e00000 [memory] unmap released view 0x116aa00000+0x3e00000 [pin-diag] unmap 0x116aa00000+0x3e00000 pinned range 0x1158c00000+0x15c00000 use_count=3 round=0 ... [memory] allocate physical 0x97400000+0x200000 [memory] map direct 0x10f6e00000+0x200000 phys=0x97400000 prot=0x3f2 flags=0x90 ... [gpu] host import of 0x1158c00000+0x15c00000 ok [pin-diag] unmap 0x116aa00000+0x3e00000 released after 211104 rounds, 7172 ms ... AGC driver: unsupported PM4 packet type: header 0x798afea3 at DWORD 34901 of 35168 ``` The title's command buffer at `0x10f6ff0630` lies in the new mapping of `0x97400000…`. In the core, that page holds 16-bit image-like rows where packets should be, and those bytes exist nowhere else in host memory. That fits GPU writes through the stale import. All 7,487 file reads of the run (APR, AIO, `pread`, `read`) were traced, and none landed within 1 MiB of it. On an SSD this crash (or the same corruption caught as `truncated PM4 packet` / `sceAgcSetShRegIndirectPatchSetAddress: unexpected packet type`) hit 8 of 9 boots, on builds from `5d9dcc42d` to `2626e5ee7`. On an HDD it hit 0 of 2 tonight on `2626e5ee7`, and none of about 20 earlier runs. With the two calls swapped, the same SSD setup passed the menu in 2 of 2 runs, one of them into gameplay. </details> *Tested and written by Claude (AI assistant) on a contributor's machine.*
MarcZX10 commented 2026-10-18 14:41:43 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T14:41:43Z.


Thanks for the counter trace and the release-order comparison. That is a distinct, concrete issue from the stalled lease itself: freeing the physical pages before unmapping the guest views lets the title reuse those pages while an old host import still aliases them. The reported repeated SSD failures versus two passes after swapping the order make this a strong candidate for a focused fix. I’ll avoid a parallel implementation while you prepare the separate PR; please link it here when it is open so I can review the change and its regression coverage.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6251215163 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7408#issuecomment-6251215163). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T14:41:43Z. --- Thanks for the counter trace and the release-order comparison. That is a distinct, concrete issue from the stalled lease itself: freeing the physical pages before unmapping the guest views lets the title reuse those pages while an old host import still aliases them. The reported repeated SSD failures versus two passes after swapping the order make this a strong candidate for a focused fix. I’ll avoid a parallel implementation while you prepare the separate PR; please link it here when it is open so I can review the change and its regression coverage.
MarcZX10 commented 2026-10-18 20:07:36 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-18T20:07:36Z.


Thanks for opening #7448 and adding the release-order regression. The report now supports a distinct consequence of the long lease: the physical range can be reused while old views still exist, and the ordering change keeps it allocated until those views are unmapped. I reviewed the checked-release precheck and left a concurrency question on #7448 about two simultaneous checked releases using the same view snapshot; that case should be clarified or covered before treating the PR as complete. The original long wait itself remains a separate issue.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6254551586 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7408#issuecomment-6254551586). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-18T20:07:36Z. --- Thanks for opening #7448 and adding the release-order regression. The report now supports a distinct consequence of the long lease: the physical range can be reused while old views still exist, and the ordering change keeps it allocated until those views are unmapped. I reviewed the checked-release precheck and left a concurrency question on #7448 about two simultaneous checked releases using the same view snapshot; that case should be clarified or covered before treating the PR as complete. The original long wait itself remains a separate issue.
Tamalero commented 2026-10-18 20:20:11 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-18T20:20:11Z.


@MarcZX100 the release-order fix is up as #7448 (unmap the views first, then free; a regression test that fails on main). For the lease wait itself I'll test #6182 on the same title next and report whether the waits go away.

Tested and written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6254679827 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7408#issuecomment-6254679827). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-18T20:20:11Z. --- @MarcZX100 the release-order fix is up as #7448 (unmap the views first, then free; a regression test that fails on `main`). For the lease wait itself I'll test #6182 on the same title next and report whether the waits go away. *Tested and written by Claude (AI assistant) on a contributor's machine.*
Tamalero commented 2026-10-18 20:54:01 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-18T20:54:01Z.


@MarcZX100 results for #6182 on the same title, on current main fb9a1eb8f + #7448 + the local counters, one run each, same route (into gameplay, then Performance → Fidelity):

Build Longest wait The render-target release 64 MiB window imports over the block
+ #6182 (2f540fa6d) 637 ms 113 ms: cache drop, serial finish + import retired, one drain yes
without #6182 1,082 ms 313 ms: same start, then use_count=3 with the recorder idle and the serial finished for 1,076 rounds yes

So window imports do cover LEGO's render-target block (the 64 MiB host import entries inside the pinned range), and #6182's path applies. But on current main the long wait didn't reproduce without #6182 either: on 2626e5ee7 the same pattern lasted 6.9 s, or never ended (the RenderThread timeouts in the report). Something in the ~300 commits since then shortens it; fd301c78a (releasing settle-retired imports after the overlap block of a pin wait) looks like the most likely candidate. With one run each I can't attribute the 113 vs 313 ms difference to #6182. I'll keep the counters in my LEGO builds, and post again if a multi-second wait shows up on current main.

Tested and written by Claude (AI assistant) on a contributor's machine.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6255023647 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7408#issuecomment-6255023647). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-18T20:54:01Z. --- @MarcZX100 results for #6182 on the same title, on current `main` `fb9a1eb8f` + #7448 + the local counters, one run each, same route (into gameplay, then Performance → Fidelity): | Build | Longest wait | The render-target release | 64 MiB window imports over the block | |---|---|---|---| | + #6182 (`2f540fa6d`) | 637 ms | 113 ms: cache drop, serial finish + import retired, one drain | yes | | without #6182 | 1,082 ms | 313 ms: same start, then `use_count=3` with the recorder idle and the serial finished for 1,076 rounds | yes | So window imports do cover LEGO's render-target block (the 64 MiB `host import` entries inside the pinned range), and #6182's path applies. But on current `main` the long wait didn't reproduce without #6182 either: on `2626e5ee7` the same pattern lasted 6.9 s, or never ended (the RenderThread timeouts in the report). Something in the ~300 commits since then shortens it; `fd301c78a` (releasing settle-retired imports after the overlap block of a pin wait) looks like the most likely candidate. With one run each I can't attribute the 113 vs 313 ms difference to #6182. I'll keep the counters in my LEGO builds, and post again if a multi-second wait shows up on current `main`. *Tested and written by Claude (AI assistant) on a contributor's machine.*
oneandonlydean commented 2026-10-20 06:52:25 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T06:52:25Z.


#7448 (a70080967) now unmaps the views before the range goes back to the physical allocator, so a long GuestAllocationsRequireUnpinned wait no longer lets another allocation take pages that are still mapped. Could you retry the title on current main and say whether the 336 MiB release still hangs at level load or on the Performance/Fidelity switch? If it's gone we'll close this.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6285199591 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7408#issuecomment-6285199591). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T06:52:25Z. --- #7448 (a70080967) now unmaps the views before the range goes back to the physical allocator, so a long `GuestAllocationsRequireUnpinned` wait no longer lets another allocation take pages that are still mapped. Could you retry the title on current main and say whether the 336 MiB release still hangs at level load or on the Performance/Fidelity switch? If it's gone we'll close this.
Tamalero commented 2026-10-20 11:16:02 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by Tamalero on 2026-10-20T11:16:02Z.


@oneandonlydean retried on current main 35fa2bdd8 (contains #7448). LEGO Batman: Legacy of the Dark Knight (PPSA16833), Linux, RTX 4090, plain main with no local patches:

  • Level load (Falcone map → snow mountain): no hang. There was no still pinned by GPU work abort and no RenderThread timeout. The log has 7 [gpu] leased allocation … still pinned after 8 recorder syncs notices, each one cleared on its own.
  • Performance → Fidelity switch: applied, no hang, the same as above.
  • A second run on the same main plus #7963 loaded straight into the snow mountain from a save, also with no hang.
  • A third run on plain main loaded into the snow mountain again and played there for several minutes, with no hang either.

So the 336 MiB release no longer hangs here. Fine to close from my side. Three sessions in all; if it comes back on a longer play session I'll reopen with a log.

Tested and written by Claude (AI assistant) on a contributor's machine.

Image
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6289622419 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7408#issuecomment-6289622419). Originally posted by [Tamalero](https://github.com/Tamalero) on 2026-10-20T11:16:02Z. --- @oneandonlydean retried on current `main` 35fa2bdd8 (contains #7448). LEGO Batman: Legacy of the Dark Knight (PPSA16833), Linux, RTX 4090, plain `main` with no local patches: - **Level load** (Falcone map → snow mountain): no hang. There was no `still pinned by GPU work` abort and no RenderThread timeout. The log has 7 `[gpu] leased allocation … still pinned after 8 recorder syncs` notices, each one cleared on its own. - **Performance → Fidelity switch:** applied, no hang, the same as above. - A second run on the same `main` plus #7963 loaded straight into the snow mountain from a save, also with no hang. - A third run on plain `main` loaded into the snow mountain again and played there for several minutes, with no hang either. So the 336 MiB release no longer hangs here. Fine to close from my side. Three sessions in all; if it comes back on a longer play session I'll reopen with a log. *Tested and written by Claude (AI assistant) on a contributor's machine.* <img width="2226" height="1289" alt="Image" src="https://github.com/user-attachments/assets/4d462a7d-8b45-430b-b349-cc74e21aa7f8" />
oneandonlydean commented 2026-10-20 12:22:20 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-20T12:22:20Z.


Thanks for the retries on current main. The 336 MiB release no longer hangs across the level load, the Fidelity switch or a few minutes of play, which matches #7448 (a700809679), now on main. Closing as fixed; please reopen with a log if it comes back on a longer session.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6290732359 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/7408#issuecomment-6290732359). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-20T12:22:20Z. --- Thanks for the retries on current `main`. The 336 MiB release no longer hangs across the level load, the Fidelity switch or a few minutes of play, which matches #7448 (a700809679b), now on `main`. Closing as fixed; please reopen with a log if it comes back on a longer session.
Sign in to join this conversation.
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#7408
No description provided.