perf(zaparoo): reduce launcher startup contention#10
Conversation
|
Warning Review limit reached
More reviews will be available in 58 minutes and 24 seconds. Learn how PR review limits work. To continue reviewing without waiting, enable usage-based billing in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe PR refactors the Zaparoo alternate launcher: it replaces bash-script process spawning with direct ChangesAlt Launcher CRT/TTY/Spawn Refactor + Scheduler Sleep
Sequence Diagram(s)sequenceDiagram
participant user_io_init
participant zaparoo_alt_launcher_start_for_menu
participant alt_launcher_start
participant fork as fork()
participant exec_launcher_child
participant finalize_spawn
participant scheduler_run
participant alt_launcher_scheduler_sleep_enabled
rect rgba(100, 150, 255, 0.5)
Note over user_io_init,alt_launcher_start: Menu bootstrap (native core path)
user_io_init->>zaparoo_alt_launcher_start_for_menu: zaparoo_is_native_core() == true
zaparoo_alt_launcher_start_for_menu->>alt_launcher_start: start=true
alt_launcher_start->>alt_launcher_start: set TTY deadline, CRT fields
end
rect rgba(100, 200, 100, 0.5)
Note over alt_launcher_start,finalize_spawn: Spawn child (direct exec)
alt_launcher_start->>fork: spawn process
fork-->>exec_launcher_child: child: setenv, affinity, setsid, TIOCSCTTY, execv
fork-->>finalize_spawn: parent: switch VT / enable FB or CRT routing, hide menu
end
rect rgba(255, 180, 50, 0.5)
Note over scheduler_run,alt_launcher_scheduler_sleep_enabled: Scheduler sleep gate
scheduler_run->>alt_launcher_scheduler_sleep_enabled: query
alt_launcher_scheduler_sleep_enabled-->>scheduler_run: true (TTY deadline or CRT finish active)
scheduler_run->>scheduler_run: usleep(100)
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related issues
Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
259fb52 to
e4db6cd
Compare
e4db6cd to
89def92
Compare
89def92 to
94f370e
Compare
afe163b to
831f7af
Compare
|
|
||
| int main(int argc, char *argv[]) | ||
| { | ||
| printf("ZAPAROO_T2 main_start_ms=%lu\n", GetTimer(0)); |
There was a problem hiding this comment.
i want to know when main start during boot. is the time we want to save before this line? if yes we should stop looking here.
|
The reason for those changes would be to be a bit faster, but also to enable a way from frontend to override mister and menu with our forks, and go back to normal with a toggle, restoring backups. |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@support/zaparoo/alt_launcher.cpp`:
- Around line 140-181: The s_saved_fb_mode_valid flag is never cleared after
restore_saved_fb_mode() completes, causing save_current_fb_mode() to exit early
on subsequent calls due to its initial guard check. In the
restore_saved_fb_mode() function, after the fprintf and fclose calls that write
and close the framebuffer mode file, add s_saved_fb_mode_valid = false to reset
the flag so that the next CRT session will capture a fresh framebuffer mode
snapshot instead of reusing the stale original one.
In `@user_io.cpp`:
- Around line 1472-1473: The native-core boot path at line 1473 calls
zaparoo_alt_launcher_start_for_menu(), but this function should be mutually
exclusive with zaparoo_alt_launcher_init_for_menu() which is called later at
line 1549. Currently both execute in sequence, resetting launcher state after
spawn setup. Add a guard condition at line 1549 where
zaparoo_alt_launcher_init_for_menu() is called to prevent its execution when the
native-core path was taken (i.e., when zaparoo_is_native_core() was true and the
other conditions at line 1473 were met). This ensures only one of the two
functions executes per boot cycle.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 73f2368f-763f-4107-9844-c13c9439cacc
📒 Files selected for processing (5)
main.cppscheduler.cppsupport/zaparoo/alt_launcher.cppsupport/zaparoo/alt_launcher.huser_io.cpp
Summary
Validation
Hardware validation still needed
Summary by CodeRabbit
New Features
Refactor