Skip to content

frontend: start up as an ordinary task, not a real-time one - #33

Merged
beebono merged 1 commit into
beebono:mainfrom
abradburne:startup-off-rt
Oct 30, 2026
Merged

beebono merged 1 commit into
beebono:mainfrom
abradburne:startup-off-rt

Conversation

@abradburne

Copy link
Copy Markdown
Contributor

The main thread goes real-time right after the settings are read and then runs to the first frame without a sleep. Under the 200 ms RLIMIT_RTTIME that PipeWire's client module sets, and that any process started from a PipeWire client inherits (a launcher's shelf, for instance), the kernel's RT watchdog kills it with a bare SIGKILL between the settings and SDL_Init whenever that stretch takes more than 200 ms of CPU. Nothing is logged unless kernel.print-fatal-signals is on, so from outside it looks like an instant signal 9 with no crash line.

Reproduced on an RK3566 (Cortex-A55) with the clock capped at 408 MHz: LimitRTTIME=200000 kills DSperate 0.22 s after start, and dmesg shows RT Watchdog Timeout (hard): dsperate. At full clock the same stretch takes 120 ms, so a device half as fast at that moment is enough. A field report on exactly this came in from a handheld running the fork.

The fix moves the OffRealtime guard that already covers the ROM load (rt_budget.h) up to right after latch_worker_sched(), so start-up runs as an ordinary task. The workers take the latched policy themselves in place_current_thread, and the guard still lifts, with a nap, where emulation begins. With it, the same 408 MHz run reaches SDL_Init, and a launch capped at 1.1 GHz reaches its first frame under the 200 ms budget. One visible change: threads started during start-up by SDL and PipeWire no longer inherit the real-time policy; PipeWire's module-rt sets its own.

🤖 Generated with Claude Code

The main thread went real-time right after the settings were read and then
ran to the first frame without a sleep. Under the 200 ms RLIMIT_RTTIME a
PipeWire client passes on to the processes it starts (DSlot's shelf is one),
the kernel's RT watchdog killed it with a bare SIGKILL between the settings
and SDL_Init whenever that stretch took over 200 ms of CPU: on a slow clock,
reproduced at 408 MHz on the RG DS+, and reported from the field on alpha3
as "DSperate stopped at once (signal 9)" with no crash line.

The OffRealtime guard that already covered the ROM load now starts right
after the scheduling latch, so start-up runs as an ordinary task; the workers
take the latched policy themselves, and the guard still lifts, with a nap,
where emulation begins.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@beebono
beebono merged commit 07128ac into beebono:main Oct 30, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants