Device loss under texture streaming (Wobbly Life PPSA29413) #3463

Closed
opened 2026-10-11 10:59:27 +00:00 by exefer · 6 comments
exefer commented 2026-10-11 10:59:27 +00:00 (Migrated from github.com)
Contributor

Imported from boykopovar/AnyPS5. Originally posted by exefer on 2026-10-11T10:59:27Z.


What

While streaming Addressables texture bundles, the driver destroys buffers still referenced by submitted command buffers, then loses the device:

Validation Error: [ VUID-vkDestroyBuffer-buffer-00922 ] | MessageID = 0xe4549c11
vkDestroyBuffer(): can't be called on VkBuffer 0x2d970000002d97 that is currently in use by VkCommandBuffer 0x7f5407b1a4f0
...
[videoout] presentation failed: vkWaitForFences present: Vulkan result -4
terminate called after throwing an instance of 'std::runtime_error'
  what():  vkWaitForFences present: Vulkan result -4

One run instead produced kernel NVRM: Xid (PCI:0000:01:00): 31 ... MMU Fault: ENGINE GRAPHICS HUBCLIENT_PD faulted @ 0x0_9d7a9000. Fault is of type FAULT_PTE ACCESS_TYPE_VIRT_READ, same family (GPU reading unmapped pages), on a run without validation layers.

Follow-up runs after the VUID only show the fence -4 (plus the cascading vkResetFences/vkQueueSubmit/vkBeginCommandBuffer VUIDs that all note a device loss already occurred).

Repro

Wobbly Life (PPSA29413, Unity 2022.3) on Linux (CachyOS), GCC 16.2.1, Intel i5-12400 + NVIDIA RTX 3060 Ti (615.71.09), current main plus closed #1706 rebased locally (needed to get past an earlier select abort; unrelated). Boot the title, let it stream arcade texture bundles for 1-3 minutes. Deterministic-ish location (same bundle area), flaky manifestation: menu/tutorial were reached in some runs, -4 abort in others, Xid 31 once. Bring-up thread: #2211.

Already in tree, not covering it

  • #1113 (bound upload buffers kept alive by recorder batches)
  • #2575 (retire host imports before guest unmap)
  • No open PR matches the 00922 VUID (checked).

AI-assisted: yes

<!-- greyfinch-sync:boykopovar/AnyPS5:issue:5800435026 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3463). Originally posted by [exefer](https://github.com/exefer) on 2026-10-11T10:59:27Z. --- ## What While streaming Addressables texture bundles, the driver destroys buffers still referenced by submitted command buffers, then loses the device: ```text Validation Error: [ VUID-vkDestroyBuffer-buffer-00922 ] | MessageID = 0xe4549c11 vkDestroyBuffer(): can't be called on VkBuffer 0x2d970000002d97 that is currently in use by VkCommandBuffer 0x7f5407b1a4f0 ... [videoout] presentation failed: vkWaitForFences present: Vulkan result -4 terminate called after throwing an instance of 'std::runtime_error' what(): vkWaitForFences present: Vulkan result -4 ``` One run instead produced kernel `NVRM: Xid (PCI:0000:01:00): 31 ... MMU Fault: ENGINE GRAPHICS HUBCLIENT_PD faulted @ 0x0_9d7a9000. Fault is of type FAULT_PTE ACCESS_TYPE_VIRT_READ`, same family (GPU reading unmapped pages), on a run without validation layers. Follow-up runs after the VUID only show the fence `-4` (plus the cascading `vkResetFences`/`vkQueueSubmit`/`vkBeginCommandBuffer` VUIDs that all note a device loss already occurred). ## Repro Wobbly Life (PPSA29413, Unity 2022.3) on Linux (CachyOS), GCC 16.2.1, Intel i5-12400 + NVIDIA RTX 3060 Ti (615.71.09), current `main` plus closed #1706 rebased locally (needed to get past an earlier `select` abort; unrelated). Boot the title, let it stream arcade texture bundles for 1-3 minutes. Deterministic-ish location (same bundle area), flaky manifestation: menu/tutorial were reached in some runs, `-4` abort in others, Xid 31 once. Bring-up thread: #2211. ## Already in tree, not covering it - #1113 (bound upload buffers kept alive by recorder batches) - #2575 (retire host imports before guest unmap) - No open PR matches the `00922` VUID (checked). AI-assisted: yes
MarcZX10 commented 2026-10-11 16:40:41 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-11T16:40:41Z.


The VUID confirms a real buffer-lifetime violation, but it does not identify which owner destroys the reported handle. Current sampled-texture uploads keep their staging, tiled, linear and image objects in the recorder batch, and #1113/#2575 cover adjacent upload/import lifetimes. Could you capture the vkDestroyBuffer call stack or the resource owner for the handle in the VUID (for example, break on that handle at destruction)? That would distinguish a separate streaming path from one of the lifetimes already covered, and keep a fix from changing the wrong owner.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6111268799 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3463#issuecomment-6111268799). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-11T16:40:41Z. --- The VUID confirms a real buffer-lifetime violation, but it does not identify which owner destroys the reported handle. Current sampled-texture uploads keep their staging, tiled, linear and image objects in the recorder batch, and #1113/#2575 cover adjacent upload/import lifetimes. Could you capture the `vkDestroyBuffer` call stack or the resource owner for the handle in the VUID (for example, break on that handle at destruction)? That would distinguish a separate streaming path from one of the lifetimes already covered, and keep a fix from changing the wrong owner.
exefer commented 2026-10-11 19:17:15 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by exefer on 2026-10-11T19:17:15Z.


Got it. Chased this down to the owner with a capture rig (LD_PRELOAD shim logging every vkDestroyBuffer handle with caller PCs, resolved offline; zero repo changes, source at the bottom).

Repro

Wobbly Life streaming on the issue-era tree (9a9bd3f + #1706, validation layers): VUID-vkDestroyBuffer-buffer-00922, same bundle area every time, followed by the fence -4. Flaky at roughly one run in three.

Owner

The destroying call stack for the reported handle, top first:

Frame Symbol
0 RetiredImport::_M_dispose() (shared_ptr disposal)
1 importAllocation()
2 ImportMappedRanges()
3 VulkanDevice::ImportGuestMemory()
4 Driver lifecycle lambda (Lifecycle.cpp)

All frames resolve inside libSceAgcDriver.prx, GuestBufferMemory.cpp domain.

Mechanism

When streaming registers a changed range, the old import is dropped from the map (retireImport). Its Vulkan objects survive only if a recorder batch is open (recorder->Keep); otherwise the holder is a local and destroys immediately, on the theory that with no batches in flight all GPU work using it was synchronous. That theory fails here: the retired buffer was still referenced by submitted (not open) command buffers, hence 00922 and then the -4.

So: distinct from #1113 (recorder-kept upload lifetimes, which this path bypasses by construction) and adjacent to #2575 (which orders unmap vs retire, but not retire vs in-flight GPU work). The remaining fix belongs to this file: tie the holder to submission completion instead of open-batch state, or wait before destroying.

Suppression bisect

Bisected 99c1c26..9a9bd3f, every point carrying the #1706 merge (without it the select abort masks everything), 3 validation runs per point unless noted:

Point VUID runs
99c1c26 + #1706 (evidence tree) 2/6
a94f426 (#3429) 1/3
c064e68 (#3425, with pair) 0/3
74f51a4 (#3440), f6d156a (#3435) 0/3 each
c064e68 minus a947303 + 8da461b (revert) 1/1, first run
a11c8f7 (current main; plus #3462 applied locally, without which select stops the title first) 0/3
Post-pair stacks (mixed shim/no-shim/loaded/cold-cache) 0/18

The suppressor is #3425's host-import window pair (a947303 join spans over whole aligned windows, 8da461b fix window at 8 MiB). Reverting just that pair on an otherwise clean tree brings the VUID straight back. It suppresses by retiring far less during streaming growth; the immediate-destroy logic itself is untouched and still live. Not fixed, just rarely triggered now. (Separately: #3472 merged after all of this, so it explains none of the above; it may still matter on current main.)

Also excluded as suppressors along the way: the shim (VUID reproduces with it active), warm shader cache (reproduces fully cold, 83 misses), idle-vs-loaded box (reproduces under load 13-21), and the newer select work.

Happy to test any fix branch against the repro tree (99c1c26 + #1706, kept as a worktree here).

Capture shim source (local-only, zero repo changes)
// Logs every vkDestroyBuffer handle plus caller PCs, then forwards.
// Build: g++ -shared -fPIC -I<repo>/3rdparty/Vulkan-Headers/include shim.cpp -o shim.so -ldl
// Run: LD_PRELOAD=/path/to/shim.so VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ./eboot.elf
// Match the VUID handle against [vkdestroy] lines; resolve PCs offline with
// the [vkmaps] dump in the same log (PC minus mapping base) via addr2line.
#define VK_NO_PROTOTYPES
#include <vulkan/vulkan.h>

#include <cstdio>
#include <cstring>
#include <dlfcn.h>
#include <execinfo.h>
#include <unistd.h>

namespace {

void* VulkanHandle() {
    static void* handle = dlopen("libvulkan.so.1", RTLD_NOW | RTLD_NOLOAD | RTLD_LOCAL);
    if (handle == nullptr) handle = dlopen("libvulkan.so", RTLD_NOW | RTLD_NOLOAD | RTLD_LOCAL);
    return handle;
}

PFN_vkGetDeviceProcAddr RealDeviceGPA() {
    static auto real = (PFN_vkGetDeviceProcAddr)dlsym(VulkanHandle(), "vkGetDeviceProcAddr");
    return real;
}

PFN_vkGetInstanceProcAddr RealInstanceGPA() {
    static auto real = (PFN_vkGetInstanceProcAddr)dlsym(VulkanHandle(), "vkGetInstanceProcAddr");
    return real;
}

void DumpMapsOnce() {
    static bool done = false;
    if (done) return;
    done = true;
    std::fprintf(stderr, "[vkmaps] begin\n");
    if (FILE* maps = std::fopen("/proc/self/maps", "r")) {
        char line[512];
        while (std::fgets(line, sizeof(line), maps) != nullptr) std::fputs(line, stderr);
        std::fclose(maps);
    }
    std::fprintf(stderr, "[vkmaps] end\n");
}

void LoggedDestroy(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* alloc) {
    DumpMapsOnce();
    void* frames[8];
    const int count = backtrace(frames, 8);
    std::fprintf(stderr, "[vkdestroy] buffer=%p pcs=", (void*)buffer);
    for (int i = 0; i < count; ++i) std::fprintf(stderr, "%p ", frames[i]);
    std::fprintf(stderr, "\n");
    const auto real = (PFN_vkDestroyBuffer)RealDeviceGPA()(device, "vkDestroyBuffer");
    real(device, buffer, alloc);
}

PFN_vkVoidFunction MaybeWrap(const char* name, PFN_vkVoidFunction real) {
    if (real != nullptr && std::strcmp(name, "vkDestroyBuffer") == 0) return (PFN_vkVoidFunction)&LoggedDestroy;
    return real;
}

}

extern "C" VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char* name) {
    return MaybeWrap(name, RealDeviceGPA()(device, name));
}

extern "C" VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char* name) {
    return MaybeWrap(name, RealInstanceGPA()(instance, name));
}
<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6112722701 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3463#issuecomment-6112722701). Originally posted by [exefer](https://github.com/exefer) on 2026-10-11T19:17:15Z. --- Got it. Chased this down to the owner with a capture rig (LD_PRELOAD shim logging every `vkDestroyBuffer` handle with caller PCs, resolved offline; zero repo changes, source at the bottom). ## Repro Wobbly Life streaming on the issue-era tree (9a9bd3f + #1706, validation layers): `VUID-vkDestroyBuffer-buffer-00922`, same bundle area every time, followed by the fence `-4`. Flaky at roughly one run in three. ## Owner The destroying call stack for the reported handle, top first: | Frame | Symbol | |---|---| | 0 | `RetiredImport::_M_dispose()` (`shared_ptr` disposal) | | 1 | `importAllocation()` | | 2 | `ImportMappedRanges()` | | 3 | `VulkanDevice::ImportGuestMemory()` | | 4 | Driver lifecycle lambda (`Lifecycle.cpp`) | All frames resolve inside `libSceAgcDriver.prx`, `GuestBufferMemory.cpp` domain. ## Mechanism When streaming registers a changed range, the old import is dropped from the map (`retireImport`). Its Vulkan objects survive only if a recorder batch is open (`recorder->Keep`); otherwise the holder is a local and destroys immediately, on the theory that with no batches in flight all GPU work using it was synchronous. That theory fails here: the retired buffer was still referenced by submitted (not open) command buffers, hence `00922` and then the `-4`. So: distinct from #1113 (recorder-kept upload lifetimes, which this path bypasses by construction) and adjacent to #2575 (which orders unmap vs retire, but not retire vs in-flight GPU work). The remaining fix belongs to this file: tie the holder to submission completion instead of open-batch state, or wait before destroying. ## Suppression bisect Bisected 99c1c26..9a9bd3f, every point carrying the #1706 merge (without it the select abort masks everything), 3 validation runs per point unless noted: | Point | VUID runs | |---|---| | 99c1c26 + #1706 (evidence tree) | 2/6 | | a94f426 (#3429) | 1/3 | | c064e68 (#3425, with pair) | 0/3 | | 74f51a4 (#3440), f6d156a (#3435) | 0/3 each | | c064e68 minus a947303 + 8da461b (revert) | 1/1, first run | | a11c8f7 (current `main`; plus #3462 applied locally, without which `select` stops the title first) | 0/3 | | Post-pair stacks (mixed shim/no-shim/loaded/cold-cache) | 0/18 | The suppressor is #3425's host-import window pair (a947303 join spans over whole aligned windows, 8da461b fix window at 8 MiB). Reverting just that pair on an otherwise clean tree brings the VUID straight back. It suppresses by retiring far less during streaming growth; the immediate-destroy logic itself is untouched and still live. Not fixed, just rarely triggered now. (Separately: #3472 merged after all of this, so it explains none of the above; it may still matter on current `main`.) Also excluded as suppressors along the way: the shim (VUID reproduces with it active), warm shader cache (reproduces fully cold, 83 misses), idle-vs-loaded box (reproduces under load 13-21), and the newer select work. Happy to test any fix branch against the repro tree (99c1c26 + #1706, kept as a worktree here). <details> <summary>Capture shim source (local-only, zero repo changes)</summary> ```cpp // Logs every vkDestroyBuffer handle plus caller PCs, then forwards. // Build: g++ -shared -fPIC -I<repo>/3rdparty/Vulkan-Headers/include shim.cpp -o shim.so -ldl // Run: LD_PRELOAD=/path/to/shim.so VK_INSTANCE_LAYERS=VK_LAYER_KHRONOS_validation ./eboot.elf // Match the VUID handle against [vkdestroy] lines; resolve PCs offline with // the [vkmaps] dump in the same log (PC minus mapping base) via addr2line. #define VK_NO_PROTOTYPES #include <vulkan/vulkan.h> #include <cstdio> #include <cstring> #include <dlfcn.h> #include <execinfo.h> #include <unistd.h> namespace { void* VulkanHandle() { static void* handle = dlopen("libvulkan.so.1", RTLD_NOW | RTLD_NOLOAD | RTLD_LOCAL); if (handle == nullptr) handle = dlopen("libvulkan.so", RTLD_NOW | RTLD_NOLOAD | RTLD_LOCAL); return handle; } PFN_vkGetDeviceProcAddr RealDeviceGPA() { static auto real = (PFN_vkGetDeviceProcAddr)dlsym(VulkanHandle(), "vkGetDeviceProcAddr"); return real; } PFN_vkGetInstanceProcAddr RealInstanceGPA() { static auto real = (PFN_vkGetInstanceProcAddr)dlsym(VulkanHandle(), "vkGetInstanceProcAddr"); return real; } void DumpMapsOnce() { static bool done = false; if (done) return; done = true; std::fprintf(stderr, "[vkmaps] begin\n"); if (FILE* maps = std::fopen("/proc/self/maps", "r")) { char line[512]; while (std::fgets(line, sizeof(line), maps) != nullptr) std::fputs(line, stderr); std::fclose(maps); } std::fprintf(stderr, "[vkmaps] end\n"); } void LoggedDestroy(VkDevice device, VkBuffer buffer, const VkAllocationCallbacks* alloc) { DumpMapsOnce(); void* frames[8]; const int count = backtrace(frames, 8); std::fprintf(stderr, "[vkdestroy] buffer=%p pcs=", (void*)buffer); for (int i = 0; i < count; ++i) std::fprintf(stderr, "%p ", frames[i]); std::fprintf(stderr, "\n"); const auto real = (PFN_vkDestroyBuffer)RealDeviceGPA()(device, "vkDestroyBuffer"); real(device, buffer, alloc); } PFN_vkVoidFunction MaybeWrap(const char* name, PFN_vkVoidFunction real) { if (real != nullptr && std::strcmp(name, "vkDestroyBuffer") == 0) return (PFN_vkVoidFunction)&LoggedDestroy; return real; } } extern "C" VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetDeviceProcAddr(VkDevice device, const char* name) { return MaybeWrap(name, RealDeviceGPA()(device, name)); } extern "C" VKAPI_ATTR PFN_vkVoidFunction VKAPI_CALL vkGetInstanceProcAddr(VkInstance instance, const char* name) { return MaybeWrap(name, RealInstanceGPA()(instance, name)); } ``` </details>
oneandonlydean commented 2026-10-13 07:38:08 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-13T07:38:08Z.


#4017 is on main: an overlapping host import is retired under the GPU lock now. Does PPSA29413 still lose the device under texture streaming on current main?

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6140711817 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3463#issuecomment-6140711817). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-13T07:38:08Z. --- #4017 is on main: an overlapping host import is retired under the GPU lock now. Does PPSA29413 still lose the device under texture streaming on current main?
exefer commented 2026-10-13 21:32:27 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by exefer on 2026-10-13T21:32:27Z.


No. Eight streaming runs on current main 0aa4cb1, all through streaming clean: zero VUID-vkDestroyBuffer, zero fence -4, zero Xid.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6155649736 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3463#issuecomment-6155649736). Originally posted by [exefer](https://github.com/exefer) on 2026-10-13T21:32:27Z. --- No. Eight streaming runs on current `main` 0aa4cb1, all through streaming clean: zero `VUID-vkDestroyBuffer`, zero fence `-4`, zero Xid.
MarcZX10 commented 2026-10-13 21:56:01 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by MarcZX10 on 2026-10-13T21:56:01Z.


Thanks for rerunning the current-main build. The eight clean streaming runs, with no VUID-vkDestroyBuffer, fence -4, or Xid, confirm that #4017 resolves the reported device-loss path. I do not see a remaining code action from this report.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6156031567 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3463#issuecomment-6156031567). Originally posted by [MarcZX10](https://github.com/MarcZX10) on 2026-10-13T21:56:01Z. --- Thanks for rerunning the current-main build. The eight clean streaming runs, with no `VUID-vkDestroyBuffer`, fence `-4`, or Xid, confirm that #4017 resolves the reported device-loss path. I do not see a remaining code action from this report.
oneandonlydean commented 2026-10-14 00:08:16 +00:00 (Migrated from github.com)
Author
Contributor

Imported from boykopovar/AnyPS5. Originally posted by oneandonlydean on 2026-10-14T00:08:16Z.


Closing, since your eight runs on current main came through streaming clean after #4017. Comment here if the device loss comes back.

<!-- greyfinch-sync:boykopovar/AnyPS5:comment:6157864470 --> Imported from [boykopovar/AnyPS5](https://github.com/boykopovar/AnyPS5/issues/3463#issuecomment-6157864470). Originally posted by [oneandonlydean](https://github.com/oneandonlydean) on 2026-10-14T00:08:16Z. --- Closing, since your eight runs on current main came through streaming clean after #4017. Comment here if the device loss comes back.
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#3463
No description provided.