aienux
Aienux, the AienOS kernel: boot, scheduling, IPC and capability boundaries. Pre-alpha; host, emulator and physical evidence are labelled separately.
Brought by drakestapleton
aienux / evidence / m3_topology_scheduler_2026-09-24.md
| 1 | # Evidence: timer-driven preemption and deterministic MADT placement in QEMU |
| 2 | |
| 3 | Branch: feat/m3-topology-scheduler |
| 4 | Base: 0b0dc82 (main after PR #104) |
| 5 | Commit under test: the branch tip including |
| 6 | feat(scheduler): timer-driven preemption with MADT-aware placement |
| 7 | |
| 8 | ## Exact successful invocation |
| 9 | |
| 10 | AIENOS_QEMU_VERBOSE=1 AIENOS_QEMU_TIMEOUT=90 bash scripts/qemu_boot_test.sh |
| 11 | |
| 12 | Exit 0, QEMU_BOOT: PASS. |
| 13 | |
| 14 | ## Environment |
| 15 | |
| 16 | - Host: spark-b87b |
| 17 | - QEMU 8.2.2 (Debian 1:8.2.2+ds-0ubuntu1.18), virt machine, gic-version=3, -smp 4 |
| 18 | - Image: aienos-handoff.efi, aarch64-unknown-uefi, --features handoff |
| 19 | |
| 20 | ## Serial proof (raw lines) |
| 21 | |
| 22 | kernel_el: EL1h |
| 23 | mmu: enabled |
| 24 | threads: ok interleave=ABABABABAB |
| 25 | el0: ok write=granted forged=denied fault=contained exit=0 |
| 26 | preempt: ok a=5716769 b=3798659 switches=4 |
| 27 | placement: worker0=class0/core0 worker1=class0/core1 |
| 28 | kernel: alive |
| 29 | |
| 30 | ## What the results demonstrate |
| 31 | |
| 32 | - preempt: the timer IRQ (GIC INTID 30) preempts the EL1 boot context and |
| 33 | round-robins two runnable workers through the 800-byte TrapFrame dispatcher; |
| 34 | both counters advanced (a, b > 0) across 4 switches before the demo quiesced. |
| 35 | - placement: the two workers were placed deterministically from the MADT |
| 36 | efficiency classes. QEMU exposes 4 homogeneous cores (class 0), so |
| 37 | place_task() yields class0/core0 then class0/core1. The heterogeneous path |
| 38 | (class 0 and class 1 cores) is covered by the host test |
| 39 | placement_fills_lowest_class_first_then_wraps. |
| 40 | - context state: the preemption frame is the same full 800-byte TrapFrame |
| 41 | (x0-x30, ELR/SPSR, FPCR/FPSR, q0-q31) guarded by |
| 42 | trap_frame_layout_matches_800_bytes_and_16_byte_alignment, so SIMD/FP state |
| 43 | survives switches. |
| 44 | |
| 45 | ## IRQ model |
| 46 | |
| 47 | The EL1 IRQ trampoline now saves the complete TrapFrame and calls |
| 48 | thread::aienos_irq_dispatcher, which acknowledges the interrupt, re-arms the |
| 49 | timer, ends the interrupt in the GIC, and returns the next frame to restore. |
| 50 | handoff's timer_irq is a pure counter. Vector slot 8 (EL0 containment, PR #104) |
| 51 | and slot 5 (IRQ) routing are unchanged. |
| 52 | |
| 53 | ## Boundary |
| 54 | |
| 55 | Emulator only. QEMU exposes one efficiency class, so cross-class migration is |
| 56 | host-tested, not observed on hardware. No SMP bring-up of secondary cores is |
| 57 | exercised; placement is the deterministic policy the scheduler will apply when |
| 58 | secondary cores are started. |