mirror of
https://github.com/pithings/unkernel.git
synced 2026-12-06 05:29:38 +08:00
The five host-device drivers that refused to start on an SMP kernel now work there; every device import still runs on CPU 0, whose host has the devices. kwblk: blk-mq calls ->queue_rq() on the submitting CPU in atomic context, so another CPU's request waits in a list and raises the block interrupt on CPU 0, which submits it before it reaps. kwshm, kwfb, kwinput and kwsnd call their imports from process context through kw_host_call() (at once on CPU 0, else a work item there while the caller sleeps); kwsnd's timer is pinned to CPU 0, and a start or stop triggered on another CPU is sent from a work item on CPU 0, in order. The UP kernel compiles to the same code but for one WARN line number. Host side: BlockHost.raise() sets IRQ 3 with Kernel.setIrqBits(), an atomic OR on a shared memory; its plain read-modify-write could drop an IPI bit another CPU set meanwhile. Tests: UNKERNEL_TEST_CPUS=n runs test/api.test.ts on an SMP kernel (snapshot tests skip), and glimmer-check passes --initrd and --smp to the CLI. The docs describe the funnels, their cost and what snapshots on SMP would need from them.