Repository navigation
Conversation
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Audited and verified. Clean-room compliant.
- Coalesces contiguous physical page mappings into single virtual memory placeholder view mappings via map_view_run in runtime/shims/xmem.cpp.
- Handles partial unmapping inside coalesced views by splitting into prefix/suffix views.
- Test coverage in test_coalesced_run_partial_unmap (xmem_test.cpp) verifies preservation of unmapped/remapped physical backing.
|
Independently tested All 11 new XMem checks pass, The mapping improvement is substantial (4,096 pages: 150.65 ms → 0.60 ms), but I found a significant bulk-unmap regression:
The remap race test also increased from 249 ms to 2,404 ms. The apparent cause is page-by-page Could we introduce a range-aware unmap helper that unmaps each intersecting view once and reconstructs only surviving prefixes and suffixes? That should preserve the mapping speedup without introducing the bulk-unmap regression. |
|
Implemented
AI-assisted: yes |
|
Tested
The wineserver's side of the stall, which I have not seen posted: sampled once a second from outside the sandbox ( One of the four runs had #939's file-backed section switched off ( Not checked here: |
|
Correction to my comment above: the two runs with this pull request presented 5,473 and 6,055 frames, not 10,946 and 12,110. Each present writes two trace lines that contain |
|
Closing as superseded — coalesced physical page views and range-based |
What and why
During retail startup (1.0.2.1), after
CopyDescriptorsSimple, the title callsXMemMapPhysicalPageswith 99,776 contiguous pages (6,236.0 MiB) in a single call. Mapping them one 64 KiB page at a time issues ~100k separateVirtualFree(MEM_PRESERVE_PLACEHOLDER)+MapViewOfFile3calls, which under Wine 11.22 takes longer than 30 seconds and triggers the title's internal 30 s watchdog assert (0x142215c35).This change coalesces contiguous runs of pages from the same
Sectionand consecutive offsets into a singleisolate_placeholder+MapViewOfFile3call, while preserving per-page unmap/remap semantics:MappedPagerecordsview_base,view_pages, andview_protect.unmap_pagesplits a multi-page view when a middle page is unmapped or overwritten, re-mapping the surviving prefix and suffix runs while keeping their backing data intact.map_view_runfails (e.g. pre-split placeholders),XMemMapPhysicalPagesfalls back to mapping that run page-by-page.Testing
test_coalesced_run_partial_unmapinruntime/test/xmem_test.cpp(maps 4 contiguous pages, unmaps a middle page, verifies prefix/suffix data survival, remaps the middle page back, unmaps and frees).ctest -R xmemunder Wine 11.22 (Arch Linux):d3d12_xmem_placed: passed.xmem: 223/228 checks passed, including all 11 checks oftest_coalesced_run_partial_unmap(the 5 existing failures are Wine 11.22VirtualQuery/PAGE_READONLY/ commit-charge checks that also fail onmain).gta6rt.sh --run(with d3d12_xs: device slot 74 returns S_OK instead of reaching ShaderCacheControl, again (RT-SLOT74) #385 + d3d12_xs: accept Xbox ID3D12GraphicsCommandListX IID in CreateCommandListX #445 stack): the 99,776-page (6,236 MiB)XMemMapPhysicalPagescall dropped from >30,000 ms (watchdog hang) to 14 ms, advancing boot through device slot 74,dstorage(CreateStatusArray,CreateQueue1, CPU zlib inflate), and reaching device slot 108.AI-assisted: yes