ax_task/sched/system/cpu/local/
mod.rs1use super::*;
4use crate::sched::system::task_system::TaskSystem;
5mod dispatch_state;
6mod drain_state;
7mod owner_deadline;
8mod owner_dispatch;
9mod owner_idle;
10
11pub(crate) use owner_deadline::{
12 HardTimerServiceClaim, HardTimerServiceStep, KtimerServiceClaim,
13 SchedulerDeadlineRqObservation, SoftTimerExpireBatch,
14};
15
16use crate::sched::system::cpu::remote::SchedulerDeadlinePublicationState;
17
18#[derive(Clone, Copy)]
20#[repr(usize)]
21pub(crate) enum SchedulerDeadlineDerivationSource {
22 ClockEvent,
23 KtimerService,
24 Enqueue,
25 Placement,
26 ScheduleSelection,
27 ScheduleNoSwitch,
28}
29
30#[derive(Debug)]
35pub struct CpuLocal {
36 owner: CpuId,
37 remote: Arc<CpuRemote>,
38 rt_bandwidth: Arc<RootRtBandwidth>,
39 dispatch: dispatch_state::OwnerDispatchState,
40 drain: drain_state::OwnerDrainScratch,
41 _pinned: PhantomPinned,
42}
43
44impl CpuLocal {
45 pub(crate) fn create(
46 owner: CpuId,
47 config: TaskSystemConfig,
48 remote: Arc<CpuRemote>,
49 rt_bandwidth: Arc<RootRtBandwidth>,
50 ) -> Pin<Box<Self>> {
51 debug_assert_eq!(owner, remote.owner());
52 Box::pin(Self {
53 owner,
54 remote,
55 rt_bandwidth,
56 dispatch: dispatch_state::OwnerDispatchState::new(config),
57 drain: drain_state::OwnerDrainScratch::new(config),
58 _pinned: PhantomPinned,
59 })
60 }
61
62 pub const fn owner(&self) -> CpuId {
64 self.owner
65 }
66
67 pub fn is_online(&self) -> bool {
69 self.remote.is_online()
70 }
71
72 pub(crate) fn remote(&self) -> &Arc<CpuRemote> {
73 &self.remote
74 }
75
76 pub(crate) unsafe fn remote_for_owner(&self) -> &'static CpuRemote {
85 unsafe { &*Arc::as_ptr(&self.remote) }
88 }
89}