Repository navigation
tests: xmem commit-on-touch checks read the test's own view, not system commit (TEST-XMEM-COMMIT-CHECK) - #1316
GuilhermeG5 wants to merge 1 commit into
Conversation
…em commit test_physical_pages_commit_on_touch decided whether mapping or touching physical pages charges commit by comparing GetPerformanceInfo's CommitTotal before and after. CommitTotal is system-wide, so another process that commits or frees memory in between moves it: with `ctest -R ^xmem$ --repeat until-fail:500` while a build ran, the check failed at run 20, and with the values printed at run 55, where CommitTotal moved -120 MiB instead of the expected +32 MiB (512 x 64 KiB). When the machine was quiet the growth was 32.6-39.7 MiB: the shim was right. "Mapping them does not charge them" and "writing to 512 of them charges ..." now count the committed (MEM_COMMIT) 64 KiB pages of the test's own view with VirtualQuery, the state commit_mapped_page reads: 0 after mapping, exactly the 512 touched pages after writing. The system-wide growth is printed as information only. Verified: 500 of 500 repeats under a concurrent full build, while the printed system-wide growth ranged from -236 MiB to +313 MiB. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent verification (AI-assisted, overnight review batch):
|
|
Wine follow-up relevant to this test change: on Wine 11.22, main 42537e7 (clang-cl/xwin), xmem / xmem_no_write_watch / xmem_write_watch each fail the touched-page commit-accounting check and two existing read-only-fault checks. The preserved ac7c344 integration build fails those same checks plus three older VirtualQuery/view checks. No game files involved. #983 already records that Wine can leave SEC_RESERVE views reporting MEM_RESERVE after writes, so the new view-based count should also be compared with an unshimmed host control on Wine rather than assume the Windows measurements transfer. This is not a request to relax the Windows assertions or skip protection correctness. Detailed source locations and the remaining fault-handler question: #1608 (comment) . Happy to retest a Wine-aware version. AI-assisted. |
|
Reduced the remaining Wine behaviour to an unshimmed handwritten Win32 host control (no Leonida code, game files, or GPU):
The control uses /EHa and a non-inlined SEH write probe (the initial /EHsc optimized control was not a valid exception-catching control, so its result was discarded). No runtime cause claimed. Possible narrow fixture correction alongside your owned commit-accounting change: establish the “committed read-only page” precondition explicitly with rt::xmem::commit_physical_range on that first page before the protection checks. That would keep the protection assertions meaningful rather than skip them on Wine. I have not changed the owned test or mixed a workaround into the retail probe. Windows first-touch assertions should stay strict. Source locations: runtime/test/xmem_test.cpp:762-769. AI-assisted. |
|
Data point for this PR: on main 0d80bc5 (Windows 11 Pro 26300, RTX 5070 Ti, driver 621.24), AI-assisted. |
|
Tested e668886's change on RTX 3090 (NVIDIA 621.40, Windows 11 26320) at main db1a22d (CPU-only test). |
Requested by Guilherme Correa · project thread
Claimed in the coordination issue as: TEST-XMEM-COMMIT-CHECK
What and why
xmem_testfailed intermittently in full CTest runs (about once in a dozen on our machine). The two checks intest_physical_pages_commit_on_touchthat decide whether mapping or touching physical pages charges commit comparedGetPerformanceInfo().CommitTotalbefore and after. CommitTotal is system-wide: any other process that commits orfrees memory in between moves it. With
ctest -R ^xmem$ --repeat until-fail:500while a build ran, the check failedon run 20, and with the values printed, on run 55 with -120 MiB where +32 MiB (512 x 64 KiB) was expected. It was
never the shim: when the machine was quiet the growth was 32.6-39.7 MiB.
The checks now count the committed (
MEM_COMMIT) 64 KiB pages of the test's own view withVirtualQuery, which isthe state
commit_mapped_pageitself reads: 0 after mapping, exactly the 512 touched pages after writing. Thesystem-wide growth is still printed, as information only. "Allocating those pages does not charge them" keeps
CommitTotal: there is no view to query yet, and its bound (1/8 of the allocation) was not hit.
Overlaps: #417 changes the same check differently (it re-measures CommitTotal on two more page windows when the first
measurement misses). This PR stops depending on the system-wide counter instead. Whichever lands first, I will rebase
the other side's leftovers; I am also happy to fold this into #417 if its author prefers.
Tested
ctest -R ^xmem$ --repeat until-fail:500under a concurrent full build: 500/500 (before: failures at runs 20 and55); the printed system-wide growth ranged from -236 MiB to +313 MiB meanwhile.
xmempasses;--repeat until-fail:100: 100/100.1 failed (
d3d12_execute_indirect_validation, which fails the same way on unmodified main on this machine).GPUs tested: NVIDIA GeForce RTX 2060 SUPER, driver 621.01, Windows 11 10.0.26300 (the test is CPU-only)
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed. (n/a)🤖 Generated with Claude Code