d3d12: hold the title watchdog off through waits and loads #621

Open
csj0oe wants to merge 2 commits from upstream-pr/621 into main
csj0oe commented 2026-12-01 14:09:31 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by csj0oe on 2026-12-01T14:09:31Z.


Summary

ProjectScarlett's watchdog crashes the title on purpose when its heartbeat stops for 30 s. Pausing its bit while a title thread waits is not enough on this title:

  • the title clears the bit for its own loading, so a wait held across a load loses the pause;
  • the boot and the world load can leave long gaps with no presents at all.

This re-asserts the bit every 200 ms while a wait is held, and holds a pause whenever the title has not presented for 5 s. The keeper starts in the DLL attach initializer, so the pre-first-present boot gap is covered too; the first layer call and every present update the timestamp. It also pauses around ExecuteCommandLists and the stand-in CreatePipelineState, where a driver compile can outlast the watchdog.

Verification

  • cargo check --release -p tuxbox-d3d12 --tests passes.
  • Series S (ConsoleMode=96) on an RX 7600: the 14.7 min intro crash is gone. The title passed its account picker and loaded the world for about 22 minutes (4,934 presents, 85 ten-second heartbeats) before the run was stopped for cleanup.
  • The 36 s boot crash still reproduced with the keeper starting at the first layer call. Starting it in the attach initializer (second commit) targets that case; the first run with that build is in progress.
  • The fence survey reported no stalled fence during the world-load run.
  • The stall threshold test is in src/tests/title_watchdog.rs.

Trade-off

A title that truly never presents now keeps the pause held instead of being killed. That is deliberate for a load, but it means a genuine hang has to be found through the fence/stall survey rather than through the watchdog. A cap on the hold can be added separately if that becomes the preferred policy.

<!-- greyfinch-sync:brcly/TuxBox:issue:5587414000 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/621). Originally posted by [csj0oe](https://github.com/csj0oe) on 2026-12-01T14:09:31Z. --- ## Summary ProjectScarlett's watchdog crashes the title on purpose when its heartbeat stops for 30 s. Pausing its bit while a title thread waits is not enough on this title: - the title clears the bit for its own loading, so a wait held across a load loses the pause; - the boot and the world load can leave long gaps with no presents at all. This re-asserts the bit every 200 ms while a wait is held, and holds a pause whenever the title has not presented for 5 s. The keeper starts in the DLL attach initializer, so the pre-first-present boot gap is covered too; the first layer call and every present update the timestamp. It also pauses around `ExecuteCommandLists` and the stand-in `CreatePipelineState`, where a driver compile can outlast the watchdog. ## Verification - `cargo check --release -p tuxbox-d3d12 --tests` passes. - Series S (`ConsoleMode=96`) on an RX 7600: the 14.7 min intro crash is gone. The title passed its account picker and loaded the world for about 22 minutes (4,934 presents, 85 ten-second heartbeats) before the run was stopped for cleanup. - The 36 s boot crash still reproduced with the keeper starting at the first layer call. Starting it in the attach initializer (second commit) targets that case; the first run with that build is in progress. - The fence survey reported no stalled fence during the world-load run. - The stall threshold test is in `src/tests/title_watchdog.rs`. ## Trade-off A title that truly never presents now keeps the pause held instead of being killed. That is deliberate for a load, but it means a genuine hang has to be found through the fence/stall survey rather than through the watchdog. A cap on the hold can be added separately if that becomes the preferred policy.
brcly commented 2026-12-01 14:19:24 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by brcly on 2026-12-01T14:19:24Z.


I'm gonna hold on this just now.

In the past 12 hours, I've managed to massively decrease frame time, which has in turn increased FPS (from roughly 0.1-0.2fps to 2-2.5fps).

Which now doesn't present long stalls.

In the event that someone does break something, it's good to still have it so a user's PC doesn't lock up.

<!-- greyfinch-sync:brcly/TuxBox:comment:7314062723 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/621#issuecomment-7314062723). Originally posted by [brcly](https://github.com/brcly) on 2026-12-01T14:19:24Z. --- I'm gonna hold on this just now. In the past 12 hours, I've managed to massively decrease frame time, which has in turn increased FPS (from roughly 0.1-0.2fps to 2-2.5fps). Which now doesn't present long stalls. In the event that someone does break something, it's good to still have it so a user's PC doesn't lock up.
turboheadcrab commented 2026-12-03 16:44:50 +00:00 (Migrated from github.com)

Imported from brcly/TuxBox. Originally posted by turboheadcrab on 2026-12-03T16:44:50Z.


RDNA 4 data point: RX 9070 XT, RADV from Mesa 26.3.1, kernel 7.3.5, GE-Proton, packaged profile. Build: 106120ca + #667 + this PR (4d8e3b69), merged without conflicts. I started a new game from the intro, under the same conditions as a run of 106120ca + #667 alone just before it.

#667 alone #667 + #621
Intro ~7.2 fps ~9.4 fps
After the new game GTT 1.5 → 4.3 GiB, 1–1.7 fps GTT 1.5 → 4.3 GiB, 1.1–1.4 fps
End watchdog exe+0x23CF683, exit 5 at 938 s no watchdog; GPU page fault, device lost, exit 3 at 1,217 s
  • The keeper works on AMD too: the run went through the same slow stretch, minutes at about 1 fps, without the watchdog firing.
  • It still didn't reach the world. The run ended in the gfx page fault JeffreyBytes reported on #669 ([gfxhub] page fault, UTCL2 client TCP, PERMISSION_FAULTS 0x3, on a vkd3d_queue thread). The kernel reset the gfx ring and the device was lost.
  • A second run of the same build (with TUXBOX_GPU_TIMING=1) reproduced it: intro again at about 9.2–9.5 fps, no watchdog, and the same page fault at 890 s.
<!-- greyfinch-sync:brcly/TuxBox:comment:7385375589 --> Imported from [brcly/TuxBox](https://github.com/brcly/TuxBox/pull/621#issuecomment-7385375589). Originally posted by [turboheadcrab](https://github.com/turboheadcrab) on 2026-12-03T16:44:50Z. --- RDNA 4 data point: RX 9070 XT, RADV from Mesa 26.3.1, kernel 7.3.5, GE-Proton, packaged profile. Build: `106120ca` + #667 + this PR (`4d8e3b69`), merged without conflicts. I started a new game from the intro, under the same conditions as a run of `106120ca` + #667 alone just before it. | | #667 alone | #667 + #621 | |---|---|---| | Intro | ~7.2 fps | ~9.4 fps | | After the new game | GTT 1.5 → 4.3 GiB, 1–1.7 fps | GTT 1.5 → 4.3 GiB, 1.1–1.4 fps | | End | watchdog `exe+0x23CF683`, exit 5 at 938 s | **no watchdog**; GPU page fault, device lost, exit 3 at 1,217 s | - The keeper works on AMD too: the run went through the same slow stretch, minutes at about 1 fps, without the watchdog firing. - It still didn't reach the world. The run ended in the gfx page fault JeffreyBytes reported on #669 (`[gfxhub] page fault`, UTCL2 client TCP, `PERMISSION_FAULTS 0x3`, on a `vkd3d_queue` thread). The kernel reset the gfx ring and the device was lost. - A second run of the same build (with `TUXBOX_GPU_TIMING=1`) reproduced it: intro again at about 9.2–9.5 fps, no watchdog, and the same page fault at 890 s.
This pull request cannot be merged automatically due to conflicts.
Merge manually to resolve the conflicts.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'upstream-pr/621:upstream-pr/621'
git switch 'upstream-pr/621'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'main'
git merge --no-ff 'upstream-pr/621'
git switch 'upstream-pr/621'
git rebase 'main'
git switch 'main'
git merge --ff-only 'upstream-pr/621'
git switch 'upstream-pr/621'
git rebase 'main'
git switch 'main'
git merge --no-ff 'upstream-pr/621'
git switch 'main'
git merge --squash 'upstream-pr/621'
git switch 'main'
git merge --ff-only 'upstream-pr/621'
git switch 'main'
git merge 'upstream-pr/621'
git push origin 'main'
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
brcly/TuxBox!621
No description provided.