Repository navigation
hle: reserve low VA for known 32-bit startup placeholders - #61
Conversation
|
Other open pull requests change the same files. Check that they do not do the same work, and agree with their authors on which lands first: the other one will then need a rebase.
This comment is kept up to date automatically and removed when the overlap ends. |
simnJS
left a comment
There was a problem hiding this comment.
Thanks for the careful investigation and the clear write-up. The approach looks right:
- The title receives the same kind of placeholder as on the normal path, so mapping and releasing behave the same.
- The split uses
MEM_RELEASE | MEM_PRESERVE_PLACEHOLDERon a strict prefix only. - A failed early reservation falls back cleanly, and the last error is preserved.
- The title-specific size lives in xtp-game.
The tests with real placeholders are appreciated.
Non-blocking suggestions:
- If the 185 MiB request never comes (for example in Series X mode, which is untested), the reserve is held for the whole run. Could the doc on
low_va_reserve_mibsay the size was measured in Series S mode, and could an unused reserve be released? - Capping the reserve's
HighestEndingAddressbelow0x7fff0000would guarantee it never overlaps the range the driver was seen to take. XTP_LOW_VA_RESERVE_MIB=185switches to the on-failure mode instead of reproducing the default. One README sentence would help.- Per CONTRIBUTING, the title could name every area:
hle, game, app: reserve low VA for known 32-bit startup placeholders. - Nit: the SAFETY comment on
allocate_virtualcould say why calling it with any address and flags is sound.
The failing gpu-debug-layer job (message 1419 in draw::tests::a_cbv_fill_reads_an_in_flight_shaders_output_on_the_gpu, xtp-gpu) also fails on main and is unrelated to this PR. We're fixing it on main. I'll merge once that job is green again; no action needed from you.
On an RTX 5070 (driver 32.0.16.1664) the known 1.0.2.1 build stopped about three seconds into start-up, before its front end. While it set up graphics, the title asked XMemVirtualAlloc for one 185 MiB (0x0b900000) placeholder reservation below 4 GiB. VirtualAlloc2 with a highest address of 0xffffffff returned null, and the title's own check broke on it. Creating the host D3D12 device on that driver had left two private 1 GiB reservations at 0x7fff0000 and 0xbfff0000. The largest hole left below 4 GiB was 7.19 MiB. A standalone probe reproduces both reservations around D3D12CreateDevice, and they go when the device is released. Before it maps the image or opens the host GPU, `xtp run --execute` now holds an uncommitted placeholder below 4 GiB of the size the known build is measured to ask for (KnownBuild::low_va_reserve_mib). The first matching 32-bit placeholder request then takes it. The reserve costs address space only, no RAM or commit. Unknown builds get none. XTP_LOW_VA_RESERVE_MIB=<n> holds n MiB instead and hands it out in pieces to 32-bit placeholder requests that the host refuses. 0 turns the reserve off. With the reserve, the title passes that point, shows its first-boot screens and reaches the world on the same machine.
742e168 to
a99cc04
Compare
|
Thanks for the update. I checked a99cc04: its tree is identical to the approved 742e168, and only the commit message changed (the Co-Authored-By trailer was dropped), so my approval stands. The description still says AI tools wrote the change, which covers what CONTRIBUTING asks. The five earlier suggestions remain open and non-blocking, and would be welcome as a follow-up PR. Unless you'd rather do it yourself, I'll rename the title to |
What and why
On an RTX 5070 (driver 32.0.16.1664, Windows 11, 16 GB RAM), the known 1.0.2.1 build stops about three seconds into start-up, before its front end. This happens with a fresh data folder, every time, at the same place.
What fails:
XMemVirtualAllocfor one 185 MiB (0x0b900000) placeholder reservation below 4 GiB.VirtualAlloc2with a highest address of0xffffffff. It returns null, and the title's own check then breaks (int3).Why there is no room:
0x7fff0000and0xbfff0000. Only 16.4 MiB is left free below 4 GiB, and the largest hole is 7.19 MiB.D3D12CreateDeviceon that driver, and they go when the device is released. So they come from the host device, not from XTP or the title.The change:
xtp run --executenow holds an uncommitted placeholder below 4 GiB. Its size is what the known build is measured to ask for (KnownBuild::low_va_reserve_mib, 185 for 1.0.2.1).XTP_LOW_VA_RESERVE_MIB=<n>holdsnMiB instead and hands it out in pieces to 32-bit placeholder requests that the host refuses.0turns the reserve off.With it, the title passes that point on the same machine:
held a low VA placeholder mib=185 automatic=true, thenused the low VA placeholder reserve size=193986560;control handed back to the player).Fixes: none
Depends on: none
Area
crates/xtp-hle/src/modules/xmem.rs: the low reserve (LowVaReserve), its hand-off inXMemVirtualAlloc, the override, and tests.crates/xtp-game/src/lib.rs:KnownBuild::low_va_reserve_mib.apps/xtp/src/run.rs: takes the reserve after identifying the build, in--executemode.README.md:XTP_LOW_VA_RESERVE_MIB.Tests
cargo xtask pr-checkpasses on my machine. fmt, both clippy passes, policy and conventions ran. The test step was run per crate (below), because the app integration tests launchxtp.exe.Tests:
cargo test -p xtp-hle --lib: 192 passed, 2 ignored benchmarks.cargo test -p xtp-game: passed.cargo test -p xtp --bin xtp: 28 passed.What the new tests cover:
Ran on a title: yes, the 1.0.2.1 Xbox Series build in Series S mode, RTX 5070 12 GB, driver 32.0.16.1664, Ryzen 5 5600, 16 GB RAM.
Provenance
Written for XTP from XTP's own code.
What was read to find the cause:
crashes.log;xcl and AnyPS5 were not read for this.
AI assistance:
Checklist
<area>: <summary>; one topic; under 400 changed lines, or the reason is above