Commit dab1396
Fix SMP=4 boot hang regression from PR #110
Root cause: After PR #110 (coro-uart), the adaptive timer/UART fd registration
logic would exclude timer fd monitoring when all harts entered WFI state during
early boot. This created a deadlock: harts waited for timer interrupts, but the
timer fd wasn't being polled, preventing wakeup.
Symptom:
- SMP=4 hung after "smp: Brought up 1 node, 4 CPUs" (49 lines of output)
- Never reached "clocksource: Switched to clocksource" or login prompt
- SMP=1 continued to work correctly
Fix:
Introduce boot completion heuristic using peripheral_update_ctr. Consider boot
"incomplete" for the first 5000 scheduler iterations after all harts start.
During this period, always keep timer and UART fds active to ensure harts can
receive timer interrupts even when temporarily in WFI.
Verification:
- SMP=1: Boots successfully to login prompt ✓
- SMP=4: Now completes boot to "Run /init" and login ✓
- Pre-fix SMP=4: Hung at line 49 ✗
- Pre-regression (4552c62): Worked correctly ✓
The fix preserves PR #110's CPU optimization benefits (0.3% idle usage) while
ensuring multi-core boot reliability.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <[email protected]>1 parent a56f5bd commit dab1396
1 file changed
+14
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1203 | 1203 | | |
1204 | 1204 | | |
1205 | 1205 | | |
| 1206 | + | |
| 1207 | + | |
| 1208 | + | |
| 1209 | + | |
| 1210 | + | |
| 1211 | + | |
1206 | 1212 | | |
1207 | 1213 | | |
1208 | | - | |
1209 | | - | |
| 1214 | + | |
| 1215 | + | |
| 1216 | + | |
| 1217 | + | |
| 1218 | + | |
| 1219 | + | |
1210 | 1220 | | |
1211 | 1221 | | |
1212 | 1222 | | |
| |||
1227 | 1237 | | |
1228 | 1238 | | |
1229 | 1239 | | |
1230 | | - | |
| 1240 | + | |
1231 | 1241 | | |
1232 | 1242 | | |
1233 | 1243 | | |
| |||
1236 | 1246 | | |
1237 | 1247 | | |
1238 | 1248 | | |
1239 | | - | |
| 1249 | + | |
1240 | 1250 | | |
1241 | 1251 | | |
1242 | 1252 | | |
| |||
0 commit comments