Repository navigation
hle_svc: cap the application pool's answers at launch (DM_APP_POOL) - #1104
oliverames wants to merge 1 commit into
Conversation
|
Thanks. I'm not landing this one in tonight's run: |
|
Follow-up from MKW v1.0.0 on Newt (iPhone 17 Pro Max, iOS 27.2 / 24B119), installed host The allocation call preceding the reduced-pool crash is
The 7 GiB and 8 GiB runs confirmed the cap in the host log, selected heaps reported as 5.43 GB and 6.43 GB, and failed at that same instruction before menus. Their retrieved memstat files were stale; I withdraw the earlier 7 GiB footprint claim. Those runs establish the heap/log/crash result only. The 9 GiB control selected a 7.43 GB heap, passed this initialization failure, and reached rendering frame 114/pass 1408 before exiting. With Local evidence is preserved under |
|
The next SDK layer explains the reduced-cap failure without a new phone run.
Both saved 7 GiB and 8 GiB crash register sets contain This is a static diagnosis supported by the saved crash registers, not a live capture of the returned Result. It narrows the problem: the host heap adapts to the pool cap, but this RootHeap request remains 7126 MiB across the two failing caps. A smaller pool answer alone cannot make those plans work. The 9 GiB run gets past this initialization step but still exits later during rendering, as reported above. |
|
@seedds I updated this experimental PR for the current upstream code while continuing the Switch 2 games running on iPhone work. Head d9c9081 merges main at 019a822 and adds the missing sorted DM_APP_POOL documentation row. The pool implementation is unchanged. The environment-table check and all 11 documentation tests pass. Targeted LLVM 23.1.4 analysis covers hle_svc.c and the four fixtures flagged by the original failed job, with no findings in those five files and no baseline growth. Hosted CI still needs to finish. I am keeping this in draft in line with your request for a game to get through on a phone. The earlier Mario Kart World run adapted its heap size but crashed before gameplay, so it does not satisfy that requirement. The current DKB iPhone 17 Pro Max comparisons have no pool override. This PR is not a resolution control or a demonstrated gameplay fix. |
|
This branch conflicted with main in The earlier clang-tidy failure (three |
6644ded to
333c90e
Compare
|
@seedds Flagging from my open-PR index of my 32 open PRs here: this one stays draft pending the honest stopping point: Mario Kart World adapted to the smaller memory plan and then crashed in SDK init, so the patch stays deliberately just the cap. The description above is still the full picture, nothing new from me. Happy to rebase, split or retitle whenever review suits. |
|
@seedds Marking this ready for review now, so it stops waiting in draft on me. The remaining item from the description is still open: the smaller-plan investigation (Mario Kart World accepted the smaller memory plan, then crashed at SDK init), which is a discussion more than a wait. It can carry on alongside a review instead of ahead of it. The description stays the source of truth; happy to rebase, split or retitle whenever review suits. |
333c90e to
54e75f8
Compare
…or Switch 2 games on devices with smaller per-process limits An iPhone 17 Pro Max gives a process 8192 MiB of resident memory hard, every memstat row this session; a Switch 2 game plans 9-10 GB application pools (Donkey Kong Bananza's profile app_pool 0x240000000, Mario Kart World's 0x263000000) and its world-map load spikes past what the device will charge. The games' own engines plan from the pool answers, so the honest fix available to the host is to answer a smaller pool and watch whether their memory plan adapts. DM_APP_POOL=<bytes> caps every application-pool answer (GetInfo Total-non-System, the SetHeapSize ResultLimitReached guard, the MapPhysicalMemory pool limit) at the smaller of the two. Logged once at the first query, so the log says what the game was playing with. - Mario Kart World v1.0.0 (iPhone 17 Pro Max, release build): with the cap at 0x180000000, the game planned a 4.43 GB heap instead of its 7.98 GB answer under the uncapped profile, and booted into its own SDK init: it accepted the smaller pool plan as designed and continued until its own region sizing crashed in its SDK (main+0x3e8b58's structure init at [x0+0x10] with x0 null walk from its main+0xcf2xxx init chain - patched area untouched): something it sizes from the full console pool is still asked for too eagerly; the memstat log carries the trail. - Donkey Kong Bananza v458752 on the same device with the cap at 0x1c0000000: pending (recording now); pending-evidence to be added to this PR when the run reports. The default is unchanged: without DM_APP_POOL every game continues to see its profile's app_pool.
54e75f8 to
cd0700a
Compare
|
Closing this. Main fixed the real problem another way in 865cc35: a game whose pool doesn't fit the phone's limit keeps its guest memory in files, and Mario Kart World finishes races on 8 GB iPhones that way. The cap never got a game through (RootHeap asked for 7,126 MiB at every cap I tried), so you were right that it was an experiment knob and not a fix. |
What and why
An iPhone 17 Pro Max gives a process a hard 8192 MiB of resident memory (measured second-by-second with DM_MEMSTAT this session: phys_footprint + os_proc_available_memory = 8192 MiB in every row; jetsam 'per-process-limit' agrees). A Switch 2 game plans a 9-10 GB application pool (DKB profile app_pool 0x240000000, MKW 0x263000000) and its loads spike past what the device will charge a single process.
The games' engines plan from the pool answers (GetInfo total-from-non-system, the SetHeapSize ResultLimitReached guard, the MapPhysicalMemory pool limit), so one honest host fix available before any game-side surgery is to answer a smaller pool and see whether the memory plan adapts.
DM_APP_POOL= caps every application-pool answer to min(profile app_pool, cap) and is logged once at the first query, so every launch's log names what game played under what budget. Default unchanged: without DM_APP_POOL, every game sees its profile's app_pool as today.
Result with the cap (Mario Kart World v1.0.0, iPhone release build, pool cap 0x180000000):
The patch is purposely nothing else: no docs row for DM_GAME_APP_POOL, and the Switch 1 32-bit app_pool is unchanged.
Checked
scripts/regress.py check --gamesreport (this changes the host, which every game uses): not stated.Front ends
None: no front end has to act on this.
Docs
docs/reference/<subsystem>.mdentry, andpython3 dm/tools/docs_symptoms.pywas run (the symptom index). Not ticked: the diff touches onlydm/host/hle_svc.c, and the description says the patch has no docs row for the new switch.dmsh_chain.py --headerwas run anddm/gfx/nvn/dmsh_chain.his part of the change. Not applicable: no chain tool changed (the diff isdm/host/hle_svc.conly).