kernel: v4 waits for a key in arch_halt(), not a spin (#151)
Build / Image RASPI (push) Successful in 3m9s
Build / Image PC (push) Successful in 4m27s
Build / Image MILKV (push) Successful in 3m18s
Build / v4 tests (32- and 64-bit cells) (push) Successful in 10m27s
Acceptance / Acceptance (pull_request) Successful in 15m15s
Build / Image RASPI (push) Successful in 3m9s
Build / Image PC (push) Successful in 4m27s
Build / Image MILKV (push) Successful in 3m18s
Build / v4 tests (32- and 64-bit cells) (push) Successful in 10m27s
Acceptance / Acceptance (pull_request) Successful in 15m15s
An idle StarshipOS kept a CPU core 100% busy: sk_v4_readline(), with nothing typed, and sk_v4_identity_wait(), headless until Zuse, waited in arch_relax(). Both now halt until the next interrupt (hlt; wfi on aarch64 and riscv64): the heartbeat's timer, ISR-driven on all three, wakes them at 100 Hz, so a key is still seen within a tick. Idle at the prompt, QEMU's CPU: 100% -> 1% of a core on amd64, 1% on aarch64 and riscv64. Acceptance passes: amd64 logs/20261108-005539, aarch64 -005753, riscv64 -010136 (POST 538/538, one dict_hash, 7 ok), the stick loaded high, test-32 (39 programs, 0 failures). FABRIC-3 XLVIII.5. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01GE3SDvQn5EoxdGufk84zz2
This commit is contained in:
@@ -113,7 +113,11 @@ static int sk_v4_readline(void)
|
||||
} else {
|
||||
heartbeat_service();
|
||||
}
|
||||
arch_relax();
|
||||
/* Nothing typed: wait for the next interrupt, not in a spin (#151 -- the spin kept a
|
||||
* CPU core 100% busy at the prompt, and the demo's host with it). The heartbeat's
|
||||
* timer wakes it at 100 Hz, so a key is seen within a tick, as the blink and the
|
||||
* identity beat are. */
|
||||
arch_halt();
|
||||
continue;
|
||||
}
|
||||
if (c == '\r' || c == '\n') {
|
||||
|
||||
@@ -331,7 +331,7 @@ void sk_v4_identity_wait(void)
|
||||
while (!g_zuse_session) {
|
||||
sk_v4_discard_input();
|
||||
sk_v4_identity_beat();
|
||||
arch_relax();
|
||||
arch_halt(); /* headless, until Zuse: wait for the next tick, not a spin (#151) */
|
||||
}
|
||||
sk_v4_discard_input();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user