From fbaa4306e3b10e7323df1db0d60c668b64f4a764 Mon Sep 17 00:00:00 2001 From: Jeremy Soller Date: Wed, 13 Dec 2023 17:19:43 -0700 Subject: [PATCH] Add unblock_no_ipi function and use in context switch --- src/context/context.rs | 5 +---- src/context/switch.rs | 6 +++--- 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/src/context/context.rs b/src/context/context.rs index 28c1959a47..bb6e0cd260 100644 --- a/src/context/context.rs +++ b/src/context/context.rs @@ -294,10 +294,7 @@ impl Context { /// Unblock context, and return true if it was blocked before being marked runnable pub fn unblock(&mut self) -> bool { - if self.status.is_soft_blocked() { - self.status = Status::Runnable; - self.status_reason = ""; - + if self.unblock_no_ipi() { if let Some(cpu_id) = self.cpu_id { if cpu_id != crate::cpu_id() { // Send IPI if not on current CPU diff --git a/src/context/switch.rs b/src/context/switch.rs index 04809a3c87..47e58b63c5 100644 --- a/src/context/switch.rs +++ b/src/context/switch.rs @@ -60,12 +60,12 @@ unsafe fn update_runnable(context: &mut Context, cpu_id: LogicalCpuId) -> bool { regs.set_singlestep(was_singlestep); } - context.unblock(); + context.unblock_no_ipi(); } // Unblock when there are pending signals if context.status.is_soft_blocked() && !context.pending.is_empty() { - context.unblock(); + context.unblock_no_ipi(); } // Wake from sleep @@ -75,7 +75,7 @@ unsafe fn update_runnable(context: &mut Context, cpu_id: LogicalCpuId) -> bool { let current = time::monotonic(); if current >= wake { context.wake = None; - context.unblock(); + context.unblock_no_ipi(); } }