diff --git a/src/arch/x86_64/kernel/apic.rs b/src/arch/x86_64/kernel/apic.rs index a5fefe4fbd..b8d1b0bf4a 100644 --- a/src/arch/x86_64/kernel/apic.rs +++ b/src/arch/x86_64/kernel/apic.rs @@ -886,10 +886,7 @@ pub fn ipi_tlb_flush() { #[allow(unused_variables)] pub fn wakeup_core(core_id_to_wakeup: CoreId) { #[cfg(all(feature = "smp", not(feature = "idle-poll")))] - if core_id_to_wakeup != core_id() - && !processor::supports_mwait() - && scheduler::take_core_hlt_state(core_id_to_wakeup) - { + if core_id_to_wakeup != core_id() && !processor::supports_mwait() { without_interrupts(|| { let apic_ids = CPU_LOCAL_APIC_IDS.lock(); let local_apic_id = apic_ids[core_id_to_wakeup as usize]; diff --git a/src/arch/x86_64/kernel/core_local.rs b/src/arch/x86_64/kernel/core_local.rs index 9b89a7659b..000b07ca26 100644 --- a/src/arch/x86_64/kernel/core_local.rs +++ b/src/arch/x86_64/kernel/core_local.rs @@ -1,8 +1,6 @@ use alloc::boxed::Box; use core::arch::asm; use core::cell::Cell; -#[cfg(feature = "smp")] -use core::sync::atomic::AtomicBool; use core::sync::atomic::Ordering; use core::{mem, ptr}; @@ -34,8 +32,6 @@ pub(crate) struct CoreLocal { irq_statistics: &'static IrqStatistics, /// The core-local async executor. ex: StaticLocalExecutor, - #[cfg(feature = "smp")] - pub hlt: AtomicBool, /// Queues to handle incoming requests from the other cores #[cfg(feature = "smp")] pub scheduler_input: InterruptTicketMutex, @@ -63,8 +59,6 @@ impl CoreLocal { irq_statistics, ex: StaticLocalExecutor::new(), #[cfg(feature = "smp")] - hlt: AtomicBool::new(false), - #[cfg(feature = "smp")] scheduler_input: InterruptTicketMutex::new(SchedulerInput::new()), }; let this = if core_id == 0 { diff --git a/src/arch/x86_64/kernel/interrupts.rs b/src/arch/x86_64/kernel/interrupts.rs index 6d39f076ef..02c8e3cfec 100644 --- a/src/arch/x86_64/kernel/interrupts.rs +++ b/src/arch/x86_64/kernel/interrupts.rs @@ -82,8 +82,6 @@ pub(crate) fn enable_and_wait() { ); } } else { - #[cfg(feature = "smp")] - crate::CoreLocal::get().hlt.store(true, Ordering::Relaxed); enable_and_hlt(); } } diff --git a/src/scheduler/mod.rs b/src/scheduler/mod.rs index 8731482ace..e665e82cab 100644 --- a/src/scheduler/mod.rs +++ b/src/scheduler/mod.rs @@ -8,8 +8,6 @@ use alloc::sync::Arc; use alloc::vec::Vec; use core::cell::RefCell; use core::ptr; -#[cfg(all(target_arch = "x86_64", feature = "smp"))] -use core::sync::atomic::AtomicBool; use core::sync::atomic::{AtomicI32, AtomicU32, Ordering}; use ahash::RandomState; @@ -40,8 +38,6 @@ static NO_TASKS: AtomicU32 = AtomicU32::new(0); #[cfg(feature = "smp")] static SCHEDULER_INPUTS: SpinMutex>> = SpinMutex::new(Vec::new()); -#[cfg(all(target_arch = "x86_64", feature = "smp"))] -static CORE_HLT_STATE: SpinMutex> = SpinMutex::new(Vec::new()); /// Map between Task ID and Queue of waiting tasks static WAITING_TASKS: InterruptTicketMutex>> = InterruptTicketMutex::new(BTreeMap::new()); @@ -891,19 +887,9 @@ pub(crate) fn add_current_core() { core_id.try_into().unwrap(), &CoreLocal::get().scheduler_input, ); - #[cfg(target_arch = "x86_64")] - CORE_HLT_STATE - .lock() - .insert(core_id.try_into().unwrap(), &CoreLocal::get().hlt); } } -#[inline] -#[cfg(all(target_arch = "x86_64", feature = "smp", not(feature = "idle-poll")))] -pub(crate) fn take_core_hlt_state(core_id: CoreId) -> bool { - CORE_HLT_STATE.lock()[usize::try_from(core_id).unwrap()].swap(false, Ordering::Acquire) -} - #[inline] #[cfg(feature = "smp")] fn get_scheduler_input(core_id: CoreId) -> &'static InterruptTicketMutex {