1#[derive(Clone, Copy, Debug, Eq, PartialEq, thiserror::Error)]
5pub enum PiWaitStateError {
6 #[error("waiter is the physical lock owner")]
8 WaiterOwnsLock,
9 #[error("first waiter observed stale scheduler lock ownership")]
11 StaleSchedulerOwnership,
12 #[error("owned lock disagrees with its scheduler waiter graph")]
14 PhysicalOwnerMismatch,
15 #[error("ownerless handoff has no selected scheduler waiter")]
17 OwnerlessSelectionMissing,
18 #[error("waiter or physical owner has already exited")]
20 ExitedParticipant,
21 #[error("waiter is already blocked on a PI lock")]
23 WaiterAlreadyBlocked,
24}
25
26#[derive(Clone, Copy, Debug, Eq, PartialEq, thiserror::Error)]
28pub enum TaskError {
29 #[error("invalid task-system configuration")]
31 InvalidConfiguration,
32 #[error("invalid CPU count: {0}")]
34 InvalidCpuCount(usize),
35 #[error("CPU {0} is outside the configured topology")]
37 InvalidCpu(u32),
38 #[error("CPU-local owner mismatch: expected {expected}, got {actual}")]
40 CpuOwnerMismatch {
41 expected: u32,
43 actual: u32,
45 },
46 #[error("CPU-local scheduler owner is already borrowed")]
48 CpuOwnerBorrowed,
49 #[error("CPU {0} is already online")]
51 CpuAlreadyOnline(u32),
52 #[error("CPU {0} is not online")]
54 CpuOffline(u32),
55 #[error("CPU {0} is not quiescent enough to go offline")]
57 CpuNotQuiescent(u32),
58 #[error("CPU {0} is the last online CPU")]
60 LastOnlineCpu(u32),
61 #[error("invalid nice value: {0}")]
63 InvalidNice(i8),
64 #[error("invalid real-time priority: {0}")]
66 InvalidRtPriority(u8),
67 #[error("round-robin quantum must be non-zero")]
69 InvalidRoundRobinQuantum,
70 #[error(
72 "invalid deadline parameters: runtime={runtime_ns}, deadline={deadline_ns}, \
73 period={period_ns}"
74 )]
75 InvalidDeadline {
76 runtime_ns: u64,
78 deadline_ns: u64,
80 period_ns: u64,
82 },
83 #[error("unsupported deadline flags: {0:#x}")]
85 UnsupportedDeadlineFlags(u32),
86 #[error("deadline admission would exceed the configured root-domain capacity")]
88 DeadlineAdmission,
89 #[error("deadline affinity must cover the complete online root domain")]
91 DeadlineAffinity,
92 #[error("unknown or stale thread identifier")]
94 StaleThreadId,
95 #[error("executor owner mismatch: expected thread {expected:#x}, got {actual:#x}")]
97 ExecutorOwnerMismatch {
98 expected: u64,
100 actual: u64,
102 },
103 #[error("invalid thread-state transition from {from:?} to {to:?}")]
105 InvalidTransition {
106 from: crate::thread::ThreadState,
108 to: crate::thread::ThreadState,
110 },
111 #[error("thread is already queued")]
113 AlreadyQueued,
114 #[error("thread is not ready to be queued")]
116 NotReady,
117 #[error("thread must be exited before it can be reaped")]
119 NotExited,
120 #[error("CPU has no runnable or idle thread")]
122 NoRunnableThread,
123 #[error("timer capacity is exhausted")]
125 TimerCapacity,
126 #[error("scheduler thread capacity is exhausted")]
128 ThreadCapacity,
129 #[error("thread affinity excludes the CPU owning an active sleep timer")]
131 ActiveTimerAffinity,
132 #[error("task runtime is not initialized")]
134 NotInitialized,
135 #[error("runtime returned an invalid task object handle")]
137 InvalidRuntimeHandle,
138 #[error("operation requires a scheduler safe point")]
140 UnsafeContext,
141 #[error("invalid priority-inheritance state")]
143 InvalidPiState,
144 #[error("invalid priority-inheritance wait state: {0}")]
146 InvalidPiWaitState(PiWaitStateError),
147 #[error("priority-inheritance dependency cycle")]
149 PiCycle,
150 #[error("priority-inheritance chain exceeds the configured depth {limit}")]
152 PiChainLimit {
153 limit: usize,
155 },
156 #[error("thread resources are still referenced")]
158 ThreadBusy,
159 #[error("runtime resource operation failed with status {0}")]
161 RuntimeFailure(u32),
162}
163
164#[derive(Clone, Copy, Debug, Eq, PartialEq, thiserror::Error)]
166pub enum MembarrierError {
167 #[error("membarrier facility is not registered for the current address space")]
169 NotRegistered,
170 #[error(transparent)]
172 Task(#[from] TaskError),
173}