Repository navigation
d3d12: a geometry tile dropped while slot-133 shadows guard it reopens them too (RT-NULL-VTABLE-P4E683D6) - #2471
Open
robot00f wants to merge 1 commit into
Conversation
…s them too (RT-NULL-VTABLE-P4E683D6) The geometry watch makes a title tile read-only to see the title's writes; a page of it can also be one a slot-133 shadow keeps read-only. A write fault and a kernel write already have the shadows reopen the tile, but release(), the last cell over it going away, opened the pages and only left a title_memory_map entry for the next refresh: a write-back in between still took them for unchanged and copied the shadow's older bytes over the title's write. release() now calls a reopener the layer installs, over the tile, with the watch's mutex released (the fault handler takes a shadow's lock and then this mutex); the layer points it at the shadows' reopen_range. Test: geometry_writes_test, on private pages, negative control included (5 checks fail with the call removed).
lixonik
reviewed
Nov 27, 2026
lixonik
left a comment
Contributor
There was a problem hiding this comment.
Reviewed and locally tested at 1de863bca (merged cleanly onto main ec91d695c).
Verification
- Environment: Windows 11, MSVC 19.44, NVIDIA GeForce RTX 5070 (driver 610.88, Vulkan 1.4.341;
VK_LAYER_KHRONOS_validationnot installed locally). ctest:geometry_writes,d3d12_existing_heap,d3d12_existing_heap_no_write_watch,d3d12_title_window_write_back, andd3d12_title_window_write_back_faultall passed (5/5).scripts/check_no_game_data.pyandgit diff --check: clean.
Review notes
- Lock ordering looks sound across all
geometry_writes::release()callers:release()restores protections and erases the cell unders.mutex, unlockss.mutex, and only then invokesreopen_shadow_ranges()(g_shadow_pages_lockshared -->ShadowPages::lock_exclusive -->geometry_writes::notify), matchingshadow_write_fault's order. BothShadowPages::reopen_all()andShadowPages::update_aliased()already releaseShadowPages::lock_before callingrelease_cells()/geometry_writes::release(), andGeometryViewsonly holds its own mutex. - Keeping
reopen(va, it->second)befores.cells.erase(it)avoids leaving a pagePAGE_READONLYwith no live cell to answer a concurrent write fault. There is still a narrow concurrent window betweenreopen()making the page writable andreopen_ranges()acquiringShadowPages::lock_where another thread'sShadowPages::write_back()(e.g., ifrelease()runs on the async geometry refresher thread) could observekProtectedbefore the reopen lands, though that is much tighter than leavingkProtectedstale until the next refresh. - No blocking issues found.
AI-assisted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
d3d12: a geometry tile dropped while slot-133 shadows guard it reopens them too (RT-NULL-VTABLE-P4E683D6)
Claimed in the coordination issue as: RT-NULL-VTABLE-P4E683D6.
What and why
The geometry watch (
runtime/src/title_geometry_watch.h) makes a title tile read-only so it sees the title's writes to it. A 4 KiB page of that tile can also be one a slot-133 shadow (ShadowPagesinruntime/shims/d3d12_vulkan_device.cpp) keeps read-only: both guard the title's geometry, each queries and protects under its own lock.Two of the three ways a tile is opened again already tell the shadows, and the third did not:
shadow_write_faultasks the watch first, and when the watch reopened the whole 64 KiB tile (tile_reopened) every shadow over it callsreopen_range(commitba626820);open_shadow_pagesdoes the same for the range, rounded out to the tiles the watch reopened;release): it made the pages writable and only left atitle_memory_map::changedentry, whose effect reaches the shadows at their nextrefresh().Between that opening and the next refresh,
ShadowPages::write_backstill sees the page askProtected, itsheld()predicate is false, and it copies the shadow's older bytes over the title's write. That is the measured shape of+0x4e683d6: the title read an object at[arg+0x10], found its vtable word zero ([rcx] = 0, fault at address0x0,rax = 0) and called through it. The stop only happened in the run that hadLEONIDA_GEOMETRY_MB=2048, the only one where the geometry watch guarded thousands of 64 KiB tiles; the run without it went past that point.What
release()now calls a reopener the layer installs, over the tile whose pages it just made writable, with the watch's mutex released: the fault handler takes a shadow's lock and then the watch's mutex, so calling the shadows under it would invert the order and deadlock. The D3D12 layer points the reopener atreopen_shadow_ranges, the same shadow halfopen_shadow_pagesused. The journal entry stays, for shadows that cover a page of the tile but are not open at the time.Test
runtime/test/geometry_writes_test.cpp(ctest -R ^geometry_writes$), on a private allocation, no GPU and no game data:notify), which takes the watch's mutex: a release that called it with the mutex held deadlocks there (ctest reports the timeout);Negative control: with the reopener call removed, the test fails 5 checks (
calls == 1, the two range checks, the mutex check and the two-holder case).Which GPU
Measured on the card of the report: GeForce GTX 1050 Ti, NVIDIA 582.28, Windows 10 Pro 19045.
geometry_writes_testpasses there, andd3d12_existing_heap(the slot-133 shadow test) fails exactly as it does onmain—texture memory unavailable: 2048 bytes, alignment 1024, type bits 0x0 (vk format 9 256x8), the case #1894 fixes; with that head applied it passes 3/3 with this change. So nothing new fails here.AI-assisted (OpenCode, DeepSeek).