summaryrefslogtreecommitdiffstats
path: root/rsnix/src/sched.rs
diff options
context:
space:
mode:
Diffstat (limited to 'rsnix/src/sched.rs')
-rw-r--r--rsnix/src/sched.rs13
1 files changed, 7 insertions, 6 deletions
diff --git a/rsnix/src/sched.rs b/rsnix/src/sched.rs
index 39ecb65..0c4938e 100644
--- a/rsnix/src/sched.rs
+++ b/rsnix/src/sched.rs
@@ -201,7 +201,7 @@ const WATCHDOG_SPIN_TICKS: u32 = 1500;
201const WATCHDOG_BOOT_SPIN_TICKS: u32 = 750; 201const WATCHDOG_BOOT_SPIN_TICKS: u32 = 750;
202 202
203/// True once the shell REPL is live (set by main.rs before shell::run()). 203/// True once the shell REPL is live (set by main.rs before shell::run()).
204/// The shell legitimately parks in poll_key with a fixed frame when it is; 204/// The shell legitimately blocks on its message queue once live;
205/// before that, task 0 running boot code must not sit in a fixed frame. 205/// before that, task 0 running boot code must not sit in a fixed frame.
206static SHELL_RUNNING: AtomicBool = AtomicBool::new(false); 206static SHELL_RUNNING: AtomicBool = AtomicBool::new(false);
207 207
@@ -264,16 +264,17 @@ pub fn on_tick(cur: usize) -> usize {
264 TASKS[CURRENT].ticks += 1; 264 TASKS[CURRENT].ticks += 1;
265 // Spin detection: a task whose interrupted frame never moves 265 // Spin detection: a task whose interrupted frame never moves
266 // (identical RSP on every tick) is stuck in a hot loop — no yield, 266 // (identical RSP on every tick) is stuck in a hot loop — no yield,
267 // no sleep, no block. The shell (id 0) legitimately parks in 267 // no sleep, no block. The shell (id 0) legitimately blocks on
268 // poll_key with a fixed frame, and idle (id 1) hlt's; both exempt. 268 // recv_blocking with a fixed frame, and idle (id 1) hlt's; both
269 // exempt.
269 let id = CURRENT; 270 let id = CURRENT;
270 let w = &mut SPIN_WATCH[id]; 271 let w = &mut SPIN_WATCH[id];
271 if w.last_rsp == cur { 272 if w.last_rsp == cur {
272 w.same += 1; 273 w.same += 1;
273 // Background tasks (id >= 2): spinning is never legitimate. 274 // Background tasks (id >= 2): spinning is never legitimate.
274 // Task 0 (shell): exempt once the REPL is live (poll_key parks 275 // Task 0 (shell): exempt once the REPL is live (recv_blocking
275 // with a fixed frame); during the boot phase a fixed frame 276 // parks with a fixed frame); during the boot phase a fixed
276 // means usb/ehci init is wedged on real hardware. 277 // frame means usb/ehci init is wedged on real hardware.
277 let threshold = if id == SHELL_TID && !SHELL_RUNNING.load(Ordering::Relaxed) { 278 let threshold = if id == SHELL_TID && !SHELL_RUNNING.load(Ordering::Relaxed) {
278 WATCHDOG_BOOT_SPIN_TICKS 279 WATCHDOG_BOOT_SPIN_TICKS
279 } else if id >= 2 { 280 } else if id >= 2 {