pub struct CpuCoreOwner<L: CpuCoreLocalState> { /* private fields */ }Expand description
Scheduler-owned proof state for one CPU’s local resources.
L is deliberately generic instead of type-erased. A subsystem can define
a tracked aggregate containing all CPU-local resources it needs and use that
aggregate as the owner’s payload.
Implementations§
Source§impl<L: CpuCoreLocalState> CpuCoreOwner<L>
impl<L: CpuCoreLocalState> CpuCoreOwner<L>
Sourcepub proof fn new(cpu: CpuId, tracked locals: L) -> tracked res : Self
pub proof fn new(cpu: CpuId, tracked locals: L) -> tracked res : Self
locals.belongs_to_cpu(cpu),ensuresres.cpu() == cpu,res.is_idle(),res.wf(),res.locals() == locals,Creates an idle core with its permanent CPU-local resource aggregate.
Sourcepub closed spec fn current_task(&self) -> Option<Loc>
pub closed spec fn current_task(&self) -> Option<Loc>
Task currently running on this CPU.
Sourcepub open spec fn is_idle(&self) -> bool
pub open spec fn is_idle(&self) -> bool
{ self.current_task() is None }Whether no task is currently associated with this core.
Sourcepub closed spec fn locals(&self) -> L
pub closed spec fn locals(&self) -> L
CPU-local resource aggregate permanently assigned to this core.
Sourcepub closed spec fn locals_key(&self) -> Seq<Loc>
pub closed spec fn locals_key(&self) -> Seq<Loc>
Ordered identities of the CPU-local resources assigned to this core.
Sourcepub closed spec fn wf(&self) -> bool
pub closed spec fn wf(&self) -> bool
The core identity is valid and every local resource belongs to its CPU.
Sourcepub proof fn tracked_schedule_in(tracked &mut self, task: Loc)
pub proof fn tracked_schedule_in(tracked &mut self, task: Loc)
old(self).wf(),old(self).is_idle(),ensuresfinal(self).id() == old(self).id(),final(self).cpu() == old(self).cpu(),final(self).current_task() == Some(task),final(self).locals() == old(self).locals(),final(self).locals_key() == old(self).locals_key(),final(self).wf(),Associates a task with an idle CPU core.
Sourcepub proof fn tracked_schedule_out(tracked &mut self) -> task : Loc
pub proof fn tracked_schedule_out(tracked &mut self) -> task : Loc
old(self).wf(),!old(self).is_idle(),ensuresold(self).current_task() == Some(task),final(self).id() == old(self).id(),final(self).cpu() == old(self).cpu(),final(self).is_idle(),final(self).locals() == old(self).locals(),final(self).locals_key() == old(self).locals_key(),final(self).wf(),Makes this CPU idle and returns the task that was running on it.
Sourcepub proof fn tracked_open(tracked self) -> tracked res : (CpuCoreOwnerHandle<L>, L)
pub proof fn tracked_open(tracked self) -> tracked res : (CpuCoreOwnerHandle<L>, L)
self.wf(),ensuresres.0.id() == self.id(),res.0@ == self@,res.0.wf(),res.0.expected_locals_key() == self.locals_key(),res.1 == self.locals(),res.1.belongs_to_cpu(res.0.cpu()),res.1.local_key() == res.0.expected_locals_key(),Temporarily separates the typed CPU-local state from the core handle.
The caller may update the returned resources, but must eventually call
CpuCoreOwnerHandle::tracked_restore with resources that still
belong to this CPU.