mirror of
https://github.com/pithings/unkernel.git
synced 2026-12-05 17:29:43 +08:00
A user task may now move to another CPU at the reschedule on its way to user mode, where its state is all in pt_regs, and starts there on a fresh stack; switched in on its own CPU it resumes its stack as before. The load balancer and affinity changes move tasks: sched_setaffinity() records the mask at once and the task moves on its way to user mode, instead of failing with EBUSY. A task asleep in a system call stays until it returns. A workqueue rescuer that serves another CPU's per-CPU pool moves there instead of running that CPU's work on its own. The CPU that held a moved task's stack calls the new import wasm_stack_drop(task), and its host forgets that stack. A secondary CPU's host also raises the stop IPI on CPU 0 when the session ends there (exit, trap, fatal error), which the kernel takes even while spinning with interrupts off, so CPU 0 suspends and its host ends the session. kwtest gains move checks (threads spreading from one CPU, register, FP and TLS state across 300 self-moves, affinity changes of a busy and a sleeping thread, queued signals and pipe and futex ping-pong across moves) and `kwtest smp`, which runs only the SMP checks. The kernel side is folded into the sched, kthread and workqueue, and wasm: SMP patches.