Gran Turismo 7 (PPSA01317): deadlock on the garage transition between the idle store (GPU mutex, then guest allocations) and a direct-memory release (guest allocations, then GPU mutex) #28461

Closed
opened 2026-11-30 20:16:15 +00:00 by humanityBG · 0 comments
humanityBG commented 2026-11-30 20:16:15 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by humanityBG on 2026-11-30T20:16:15Z.


What happens

Deadlock between the idle store and a direct-memory release. VulkanDevice::StoreIdleResults takes GuestMemory::GpuMutex() and then waits for the guest allocations lease, while a title thread in sceKernelCheckedReleaseDirectMemory holds the allocations lock in GuestAllocationsUnmap and waits for GpuMutex through the write-watch path of a storage texture kept by the CPU. Every queue then waits behind queue 0 ([pm4 ring] queue 0x.. order behind queue 0 ... has not progressed), the title's Job#0 thread spins waiting for the GPU, and the picture freezes for good. No abort, no FATAL; the log goes silent.

Queue worker 0 (qworker 0x0), no CPU between snapshots 25 min apart:

pthread_mutex_lock
libc  GuestAllocationsAcquire_nid_postfix+0x2a
agc   VulkanDevice::StoreIdleResults+0x64          <- holds GuestMemory::GpuMutex()
agc   Driver::run+0x1f29

A title thread (Updat...), releasing direct memory:

agc   Mutex::lockContended+0x133
agc   GuestMemory::GpuMutexType::block / ::lock    <- waits for GpuMutex
libc  GuestArena::WindowsMappings::watchWrites / collectOwnedWrites / collectResident / remember / collect
libc  GuestArenaCollectWrites_nid_postfix
agc   GuestMemory::TimedAccess::~TimedAccess
agc   Graphics::StorageTexture::AccessKeptByCpu
agc   Graphics::StorageTexture::DeferToMirror
libc  GuestWriteWatchBeginHostWrite_nid_postfix
libc  GuestArenaReset_nid_postfix
libkernel munmap
libc  GuestAllocationsUnmap_nid_postfix             <- inside the guest allocations lock
libkernel UnmapRegistered / UnmapDirectMemoryRange
libkernel sceKernelCheckedReleaseDirectMemory

Title, test or build step

Gran Turismo 7, PPSA01317 01.710.000. Own decrypted dump, every module unwrapped from SELF, relinked with --windows --to-intel. Run with APS5_SPLIT_TABLE_CALLS=1 (the garage's call table holds 307 targets).

AnyPS5 commit

main a0e55122cb + #24083 + #16935 + #28289 (with #28279, #28280) + #28388; the title needs #24083 and #16935 to reach the garage. Two merge conflicts resolved locally (#24083 in DepthSurface.cpp, #16935 in the sampler cache key), neither in the code above.

System

Windows 11, Intel CPU, RTX 2080 Ti, NVIDIA 617.42, WinLibs GCC 15.2.0, Release.

Steps to reproduce

  1. Boot GT7 to the main menu (warm shader cache).
  2. Enter the garage with an owned car.
  3. The transition picture freezes and never recovers (watched 30+ min).

2 of 2 runs with stack snapshots, the same with and without APS5_ASYNC_DRAW_COMPILE=1 (so not #28289). A third run (cold cache) froze at the same point; no snapshot. Earlier trees (main c75a81520b + #22767 + #24083 + #16935, 2026-11-25) passed the same transition in 3 of 3 runs.

Log

Nothing is logged at the hang. The last game lines before it are ReportPreparedAtUse for shader 0x120af97800 stage 5; the stall watchdog (APS5_STALL_WATCHDOG_SECS=30) reports queues 0x23, 0x2a, 0x2b, 0x4b waiting on queue 0.

What was checked

  • Frames from noninvasive cdb -pv snapshots, then a full dump of the hung process; resolved with nm on the unpatched prx files and each module's ImageBase. The title thread's chain comes from a raw stack scan (dps @rsp), since its stack does not unwind through title code; the frames are in a consistent calling order.
  • Between c75a81520b and a0e55122cb no commit touches AccessKeptByCpu, DeferToMirror, watchWrites or GuestArenaReset, so the path is older. The queue 0 side did change: #26450 (5929fdd938) resumes a yielded idle store without a new quiet period, so StoreIdleResults takes GpuMutex again within ~2 ms. That is a guess at why the window got wider, not tested.
  • The 15 GB dump is kept and can be read for anything else that helps.

AI-assisted: yes.

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:6705359081 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/28461). Originally posted by [humanityBG](https://github.com/humanityBG) on 2026-11-30T20:16:15Z. --- ### What happens Deadlock between the idle store and a direct-memory release. `VulkanDevice::StoreIdleResults` takes `GuestMemory::GpuMutex()` and then waits for the guest allocations lease, while a title thread in `sceKernelCheckedReleaseDirectMemory` holds the allocations lock in `GuestAllocationsUnmap` and waits for `GpuMutex` through the write-watch path of a storage texture kept by the CPU. Every queue then waits behind queue 0 (`[pm4 ring] queue 0x.. order behind queue 0 ... has not progressed`), the title's `Job#0` thread spins waiting for the GPU, and the picture freezes for good. No abort, no `FATAL`; the log goes silent. Queue worker 0 (`qworker 0x0`), no CPU between snapshots 25 min apart: ```text pthread_mutex_lock libc GuestAllocationsAcquire_nid_postfix+0x2a agc VulkanDevice::StoreIdleResults+0x64 <- holds GuestMemory::GpuMutex() agc Driver::run+0x1f29 ``` A title thread (`Updat...`), releasing direct memory: ```text agc Mutex::lockContended+0x133 agc GuestMemory::GpuMutexType::block / ::lock <- waits for GpuMutex libc GuestArena::WindowsMappings::watchWrites / collectOwnedWrites / collectResident / remember / collect libc GuestArenaCollectWrites_nid_postfix agc GuestMemory::TimedAccess::~TimedAccess agc Graphics::StorageTexture::AccessKeptByCpu agc Graphics::StorageTexture::DeferToMirror libc GuestWriteWatchBeginHostWrite_nid_postfix libc GuestArenaReset_nid_postfix libkernel munmap libc GuestAllocationsUnmap_nid_postfix <- inside the guest allocations lock libkernel UnmapRegistered / UnmapDirectMemoryRange libkernel sceKernelCheckedReleaseDirectMemory ``` ### Title, test or build step Gran Turismo 7, PPSA01317 01.710.000. Own decrypted dump, every module unwrapped from SELF, relinked with `--windows --to-intel`. Run with `APS5_SPLIT_TABLE_CALLS=1` (the garage's call table holds 307 targets). ### AnyPS5 commit `main` a0e55122cb + #24083 + #16935 + #28289 (with #28279, #28280) + #28388; the title needs #24083 and #16935 to reach the garage. Two merge conflicts resolved locally (#24083 in `DepthSurface.cpp`, #16935 in the sampler cache key), neither in the code above. ### System Windows 11, Intel CPU, RTX 2080 Ti, NVIDIA 617.42, WinLibs GCC 15.2.0, Release. ### Steps to reproduce 1. Boot GT7 to the main menu (warm shader cache). 2. Enter the garage with an owned car. 3. The transition picture freezes and never recovers (watched 30+ min). 2 of 2 runs with stack snapshots, the same with and without `APS5_ASYNC_DRAW_COMPILE=1` (so not #28289). A third run (cold cache) froze at the same point; no snapshot. Earlier trees (`main` c75a81520b + #22767 + #24083 + #16935, 2026-11-25) passed the same transition in 3 of 3 runs. ### Log Nothing is logged at the hang. The last game lines before it are `ReportPreparedAtUse` for shader `0x120af97800` stage 5; the stall watchdog (`APS5_STALL_WATCHDOG_SECS=30`) reports queues 0x23, 0x2a, 0x2b, 0x4b waiting on queue 0. ### What was checked - Frames from noninvasive `cdb -pv` snapshots, then a full dump of the hung process; resolved with `nm` on the unpatched prx files and each module's ImageBase. The title thread's chain comes from a raw stack scan (`dps @rsp`), since its stack does not unwind through title code; the frames are in a consistent calling order. - Between c75a81520b and a0e55122cb no commit touches `AccessKeptByCpu`, `DeferToMirror`, `watchWrites` or `GuestArenaReset`, so the path is older. The queue 0 side did change: #26450 (5929fdd938) resumes a yielded idle store without a new quiet period, so `StoreIdleResults` takes `GpuMutex` again within ~2 ms. That is a guess at why the window got wider, not tested. - The 15 GB dump is kept and can be read for anything else that helps. AI-assisted: yes.
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#28461
No description provided.