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 / own-gpu-driver / rung2 / RUNBOOK.md
| 1 | # L332 rung 2, window 0: give the GPU to our driver for a few minutes, read it, give it back |
| 2 | |
| 3 | Purpose: the smallest real step. Prove we can take the GB10 away from NVIDIA's driver and give it back, measure how long |
| 4 | that takes (nvidia.ko has never been reloaded on this box since boot, so nobody knows), and let our module `aien-gpu` |
| 5 | read the chip's identity and set up its memory area. Our module writes nothing to the GPU in window 0. |
| 6 | |
| 7 | Scheduled by: the coordinator (ledger line "L332 window 0"). Run only inside that window. Hands-off: nothing needs a |
| 8 | person at the machine unless the box fails to come back from a reboot (see Recovery). |
| 9 | |
| 10 | ## What goes down, and for how long |
| 11 | Everything that uses the GPU, from part 1 until the restore reboot at the end of part 2. The four NVIDIA modules are |
| 12 | nvidia_drm, nvidia_modeset, nvidia_uvm, nvidia (lsmod). Holders of /dev/nvidia* on 2026-10-21 22:0xZ (`sudo fuser -v`): |
| 13 | - aien-serve-http pid 2587647 (the 35B on 18091, owner L306/L387 server lane), |
| 14 | - qwen36_stroke_g pid 2613825 (motor stroke work, L312 lane), |
| 15 | - nvidia-persistenced pid 1816 (root service, enabled; fails harmlessly while the modules are held back). |
| 16 | Plus anything the judge or a window starts meanwhile. Stop order: the coordinator stops the chip jobs and the 35B server |
| 17 | (owners restart them after the restore reboot); persistenced is left alone (the reboot handles it). |
| 18 | Expected time down: two reboots plus about 2 minutes of steps. Reboot-to-ssh time on this box is not measured (journal |
| 19 | gaps are not clean reboots); part 2 logs boot time and uptime, so this window measures it. |
| 20 | |
| 21 | ## Why a reboot and not "unload the driver" |
| 22 | NVIDIA's display part has a worker that spins forever on this headless box (L158: nvEvoWaitForCoreNotifier). Unloading |
| 23 | `nvidia_modeset` waits for that worker, so the unload would most likely hang with the GPU half torn down (INFERRED from |
| 24 | ~/handoffs/fixer-modeset-kthread.md item 2; not tested). So the GPU is freed by booting once with NVIDIA's modules held |
| 25 | back. Revised 2026-10-26 (NoNvDriver review): the hold-back is self-reverting (`window-boot.sh`). GRUB_DEFAULT=0 stays; |
| 26 | a one-shot custom.cfg entry `aien-gpu-window` (today's command line plus `aien.gpuwindow=1 systemd.watchdog_sec=30 |
| 27 | panic=10 oops=panic`) is chosen for exactly one boot by `grub-reboot`. In that boot only, aien-gpu-window-hold.service |
| 28 | writes the hold-back file to /run/modprobe.d (tmpfs) before udev and modules-load, and aien-gpu-window-lease.service |
| 29 | reboots after 25 minutes. Any later boot, planned or not, is today's boot with NVIDIA; no file to delete by hand. The |
| 30 | old /etc/modprobe.d file survived a crash and pinned every later boot to "no NVIDIA". The NVIDIA modules are not in the |
| 31 | initramfs (checked, fail-closed, by part 1 and by `window-boot.sh check`). Alternative not chosen: kexec with |
| 32 | `modprobe.blacklist=` on the command line (no file, faster) because the GPU state after a kexec without a firmware reset |
| 33 | is UNKNOWN on GB10. |
| 34 | |
| 35 | ## Facts checked on 2026-10-21 (read-only) |
| 36 | - Secure Boot disabled, lockdown none, module signatures not enforced: the unsigned aien_gpu.ko loads (taints). |
| 37 | - aien_gpu.ko vermagic 7.0.0-1019-nvidia = running kernel. |
| 38 | - kernel.panic = 0: a kernel panic would freeze the box until power-cycled. Part 2 sets kernel.panic=10 and |
| 39 | panic_on_oops=1 (runtime only, gone at the next boot) before our module touches the chip, so a bad register read |
| 40 | reboots the box on its own. |
| 41 | - GB10 = 000f:01:00.0, 10de:2e12, BAR0 64 MiB at 0x24000000. |
| 42 | |
| 43 | ## Steps |
| 44 | Scripts in this directory, each line timed into window0-<UTC>.log (window0-current.log points at it). |
| 45 | Prep (changes the boot config, needs Drake's go): `./window-boot.sh check` (read-only, any time), then |
| 46 | `./window-boot.sh install --yes` (adds the inert GRUB entry and the two units; normal boots are unchanged). |
| 47 | 0. Any time before the window: `./window0-pre.sh` (no --go) checks the module, Secure Boot, initramfs and lists holders. |
| 48 | 1. Window opens; coordinator stops the GPU users; `./window0-pre.sh --go`: records lsmod, nvidia-smi, cmdline, module |
| 49 | hash, refuses if anything but persistenced still holds the GPU, runs `window-boot.sh check` and `arm --yes` and |
| 50 | reboots into the one-shot window entry. |
| 51 | 2. After ssh is back: `./window0-post.sh`: refuses unless this is the window boot; logs boot time; checks no nvidia |
| 52 | module and no driver on the GPU; sets panic auto-reboot; insmod aien_gpu allow_bind=1; aien_gpu_check (identity, |
| 53 | firmware size, arena mmap pattern); rmmod; optional FLR recovery test (`AIEN_W0_FLR=1`, Drake decides); removes the |
| 54 | /run hold-back file; timed `modprobe nvidia nvidia_uvm` + first nvidia-smi answer (NVIDIA's load-to-ready baseline); |
| 55 | Omega gpu_launch_cost_test --reps 3 (first open after load, timed); prints WINDOW0 PASS or FAIL; normal reboot. |
| 56 | 3. After the restore reboot: `lsmod | grep -c ^nvidia` = 4, `nvidia-smi -L` lists the GPU, no aien.gpuwindow=1 on the |
| 57 | command line, `./window-boot.sh status` shows no next_entry; owners restart their servers; commit the log; window |
| 58 | closes. `./window-boot.sh uninstall --yes` when no more windows are planned. |
| 59 | |
| 60 | ## Recovery |
| 61 | - Anything odd during part 2: `sudo rmmod aien_gpu` if loaded, then `sudo reboot` (the next boot is the default entry). |
| 62 | - Box does not come back within 10 minutes after part 1's reboot: the 30 s hardware watchdog (SBSA, armed by systemd |
| 63 | from the command line) resets a hung boot, and the default entry with NVIDIA comes up. Whether an SBSA reset also |
| 64 | resets GSP/SEC2 is NOT_RUN; if ssh never answers, a power cycle at the wall is the only step left (Drake, physical). |
| 65 | - Window overruns: the lease reboots the box 25 minutes into the window boot. |
| 66 | - Kernel panic or oops while our module reads the chip: auto-reboot after 10 s (command line, so it holds from the first |
| 67 | instruction, not only after part 2 sets it), back to today's boot. |
| 68 | |
| 69 | ## Gate (window 0 PASS when all hold) |
| 70 | - aien-gpu: PMC_BOOT_0 read (not 0, not all-ones), firmware 75,012,080 bytes, arena mmap pattern PASS, rmmod clean. |
| 71 | - PMC_BOOT_42 logged. window1-pre.sh refuses unless CHIP_ID = (BOOT_42 >> 20) & 0x3ff is 0x1AB (GB10B), because the |
| 72 | window-1 package carries GB10B images only; the Spark reports sm_121, which in 580.173.02 points at GB20B (0x1BB) |
| 73 | rather than GB10B (Thor, T264). Until window 0 reads it, the chip identity is unmeasured. |
| 74 | - After the reload: nvidia-smi lists the GPU; Omega launch-cost test exit 0. |
| 75 | - After the restore reboot: four modules back, not the window boot, no next_entry. |
| 76 | - Log committed under evidence/own-gpu-driver/rung2/, pass or fail. |
| 77 | |
| 78 | ## Window 1: start NVIDIA's GSP firmware with our own code |
| 79 | Only after window 0 PASS (part 1 refuses otherwise). Same take-away and give-back as window 0 (reboot with NVIDIA held |
| 80 | back, restore reboot), so the same people stop the same GPU users. |
| 81 | |
| 82 | What our code does to the chip, all of it from the source lines quoted in native/kernel/gpu/gsp_mmio.h and |
| 83 | gpu/contract/gb10_gsp.devc: builds the start-up package in memory the GPU can read (L192 builder), writes one 868-byte |
| 84 | signed packet into SEC2's mailbox memory, rings SEC2 once, waits for SEC2 to hand control to GSP, writes the GSP-RM |
| 85 | version into one register, then only reads: GSP's status messages until "INIT_DONE" or 30 s. |
| 86 | |
| 87 | Why this cannot harm the chip: the GPU checks NVIDIA's signature on the firmware itself (the chain of trust lives in |
| 88 | SEC2 and the boot ROM; we hand over NVIDIA's signed images byte for byte, pinned by SHA-256). Our module lets user space |
| 89 | reach only the 12 start-up registers (6 of them writable), only with allow_boot=1, and rings the SEC2 doorbell once per |
| 90 | load. What can go wrong is that GSP is left stopped or half started until the GPU is reset. |
| 91 | |
| 92 | UNKNOWN until this window (said out loud): |
| 93 | - whether the restore reboot resets the GB10's GSP and SEC2 fully. If it does not, NVIDIA's driver fails after the |
| 94 | restore reboot (part 3 shows it) and the fix is a full power cycle at the wall: Drake, physical. That would also keep |
| 95 | the 35B server down until then. This is the one real cost; the coordinator weighs it when scheduling. |
| 96 | - whether SEC2 accepts the packet with Linux's driver absent (inventory 14.5), whether GSP-FMC accepts our WprMeta and |
| 97 | heap, whether our GspSystemInfo values (rung2/system_info.txt, each tagged with its source) are what GSP-RM needs, |
| 98 | whether GSP-RM asks for a CPU sequencer run before INIT_DONE (window 1 records it and stops; handling it is window 2). |
| 99 | |
| 100 | Steps (each line timed into window1-<UTC>.log, window1-current.log points at it): |
| 101 | 0. Before the window: `make -C native/linux/aien-gpu all tools sim-test` (sim test PASS), the package |
| 102 | `./window1-package.sh <dir>` (WINDOW1_PACKAGE: PASS), then `./window1-pre.sh <dir>` (checks only). |
| 103 | 1. Window opens, GPU users stopped: `./window1-pre.sh <dir> --go` (blacklist file, reboot). |
| 104 | 2. After ssh is back: `./window1-post.sh`: deletes the file, aborts if any NVIDIA module is loaded, sets panic |
| 105 | auto-reboot, insmod aien_gpu allow_bind=1 allow_boot=1 arena_mib=<package size + 9> heap_mib=512, runs |
| 106 | aien_gsp_boot (register trace with times, plan, every status message, GSP log buffers, verdict) into |
| 107 | window1-<UTC>-run/, prints WINDOW1 PASS or STOPPED, reboots WITHOUT rmmod. |
| 108 | 3. After the restore reboot: `./window1-check.sh` (four NVIDIA modules, nvidia-smi answers, file gone, aien_gpu not |
| 109 | loaded): WINDOW1 RESTORE PASS. Owners restart their servers. Commit the log and the run directory, pass or fail. |
| 110 | |
| 111 | Recovery: as window 0. If part 3 fails (nvidia-smi does not list the GPU after the restore reboot), reboot once more; |
| 112 | if it still fails, the GPU needs a power cycle (Drake, physical), and nothing else is tried on the chip until then. |
| 113 | |
| 114 | Gate (window 1 PASS): aien_gsp_boot verdict INIT-DONE, register trace inside the allowlist, WINDOW1 RESTORE PASS. |
| 115 | Any other verdict is still a result: it names the step that stopped (SEC2, mask, lockdown, FMC code, core, queue). |
| 116 | |
| 117 | ## Later windows (each needs its own prepared step and its own request) |
| 118 | 1. (window 1 above.) |
| 119 | 2. The RPC subset from docs/numeric/DRIVER_FLOOR.md and one channel (gpu/contract/gb10_chan.devc). |
| 120 | 3. Omega on aien-gpu through L202's typed handles: golden tokens identical to nvidia.ko, per-word timing and start time side by side. |