feat: SMP stage 1 (4 harts, per-hart guarded stacks, home-core affinity, IPIs, TLB shootdown, one temporary kernel lock), 4-core storm

This commit is contained in:
2026-10-27 00:56:15 +01:00
parent b87a62475f
commit 2e665fd66e
22 changed files with 995 additions and 230 deletions

View File

@@ -102,8 +102,7 @@ impl<P: Platform> Kernel<P> {
let priority = thread.priority();
if thread.unblock().is_ok() {
self.set_pending_result(tid, Some(result));
let core = self.platform.core_id();
self.scheduler.add(tid, priority, core);
self.make_ready(tid, priority);
}
}
@@ -234,6 +233,8 @@ impl<P: Platform> Kernel<P> {
}
self.block_caller(tid, BlockReason::AwaitingReply);
// Run the server straight away instead of waiting for its turn.
// Only works if it lives on this core (run_now finds it in this
// core's queue only); otherwise make_ready kicked its core.
let core = self.platform.core_id();
if self.scheduler.run_now(core, receiver)
&& self

View File

@@ -10,7 +10,6 @@ impl<P: Platform> Kernel<P> {
entry: types::address::EntryPoint,
stack: types::address::StackPointer,
) -> SyscallOutcome {
use domain::scheduler::Scheduler;
use domain::thread::SavedContext;
let priority = types::bounded::Priority::DEFAULT;
@@ -30,8 +29,8 @@ impl<P: Platform> Kernel<P> {
return SyscallOutcome::Complete(SyscallResult::Error(e));
}
let core = self.platform.core_id();
self.scheduler.add(tid, priority, core);
self.place(tid);
self.make_ready(tid, priority);
SyscallOutcome::Complete(SyscallResult::Value(tid.raw() as usize))
}
@@ -89,7 +88,6 @@ impl<P: Platform> Kernel<P> {
entry: types::address::EntryPoint,
stack: types::address::StackPointer,
) -> SyscallOutcome {
use domain::scheduler::Scheduler;
use domain::thread::SavedContext;
let target_pid = match self.check_cap(
@@ -132,8 +130,8 @@ impl<P: Platform> Kernel<P> {
return SyscallOutcome::Complete(SyscallResult::Error(e));
}
let core = self.platform.core_id();
self.scheduler.add(tid, priority, core);
self.place(tid);
self.make_ready(tid, priority);
SyscallOutcome::Complete(SyscallResult::Value(tid.raw() as usize))
}