interplane.Get Omega
Read in your language

omega-gpu-driver

aien-dev/omega-gpu-driver

Brought by drakestapleton

branch main Branches Tags History

omega-gpu-driver / window / README.md

101 lines · 9321 bytes Raw Blame History Source

OwnDriver window procedure (W0 identity, D2, D3)

Status: NOT_RUN on the GB10. W0 has run read-only beside the live 35B (EXERCISED, host). Nothing in W1..W7 or R has touched the GB10. The unchanged scripts have run end to end against a simulated machine under /tmp (tests/window_sim.sh, EXERCISED host simulator; tests/mutants-window.sh removes one safety step at a time and the simulator must catch it). Every step below stops the resident 35B on 127.0.0.1:18091, resets the GPU and reboots the Spark twice. It runs only in an exclusive window that Drake opens for this job.

Identity-only window

Use sh window/d2-pre.sh --check W0 for the read-only preflight. The physical test uses sh window/d2-pre.sh --go W0 and requires the existing approval record to include stage: W0. Keep the tested checkout in place through both reboots. It must contain the pinned build/omc, the matching build/w0, and no build/ogd. The temporary boot unit uses this checkout. A changed identity executable aborts the test before device binding.

The identity step reads the PCI identity and three documented registers, then releases the device and requests a normal reboot. It records whether port 18091 was idle or held the recognized service. Restoration preserves that state. If the normal boot fails to restore the GPU, the script records the failure and leaves recovery to the operator. This mode budgets two reboots. A PASS in the simulator covers control flow only.

What the window does to the machine

Approval

Main writes /home/drakestapleton/handoffs/OwnDriver/window/APPROVED when Drake opens the window. The file lives there and not in /tmp, because /tmp is emptied at every boot (D /tmp in tmpfiles.d). It must contain:

window: <Drake's words, or the BOARD line that quotes them>
reset: approved
reboot: approved

W1 and W2 refuse without all three lines. R deletes the file at the end (one approval, one window).

Steps

StepScriptWhat it doesEnds with
W0sh window/d2-pre.shRead-only. Checks the firmware sha256, logs the sha256 of every script and binary, checks that build/omc matches tools/omc.pin and that build/fw matches fw.manifest. Checks the device identity (10de:2e12), that group 20 holds only 000f:01:00.0, that nvgrace-gpu-vfio-pci does not alias 2e12, and that the initramfs has no nvidia modules. Records the privilege baseline and runs privcheck. Checks that the live 35B launch record (argv, cwd, env names, coordinator key) equals the restore recipe. Lists GPU users and the chip lock.exit 0
W1sh window/d2-pre.sh --go [D2\|D3]Repeats W0, then needs APPROVED and takes /tmp/aien-gb10.lock (flock -n; refuses if any GPU job holds it). Posts to BOARD, sends TERM to the 35B and waits until nvidia-smi shows no compute app. Saves the kernel.panic values, writes the hold-back file, installs and enables the unit, and sets state run D2. A failure before the reboot removes the window files and runs R.reboot
W2unit → d2-run.sh --go D2Sets state restore and deletes the hold-back file first, so any later boot is a normal one that ends in R. Needs APPROVED and the chip lock, and checks that no nvidia module is loaded. Sets kernel.panic=10 and panic_on_oops=1 (an oops reboots into R). Runs modprobe vfio-pci, sets driver_override, binds through drivers_probe, and checks /dev/vfio/20 is root:root:600.
W3Runtime PM: power/control=on and runtime_status=active before any BAR access. build/w0 reads config identity, BOOT_0/BOOT_1/BOOT_42 and the GSP falcon state (read-only), then build/ogd ident.
W4build/ogd boot: GSP boot to INIT_DONE, static info, unload.
W5build/ogd hello: objects, channel, one semaphore release, teardown.
W6 (D3 only)build/ogd exec ... -- $D3_CMD, where D3_CMD is the CUDApp chip-gate command line. W1 stores it in d3-cmd.
W7EXIT trapUnbinds vfio-pci (GPU reset), clears driver_override and sets power/control=auto. Then by default reboots, and the unit runs R. With RESTORE_PATH=rebind it runs R in place.reboot
Runit → d2-restore.sh --goR0: if the hold-back file is still there, removes it and reboots. R1: loads the nvidia modules, binds the device and checks that nvidia-smi -L lists the GB10. Any failure takes ONE reboot fallback (reboot-fallback-used), then R runs again. R2: starts nvidia-persistenced and restores the saved sysctls. R3: restarts the 35B with start-35b-batch.sh and the recorded env, waits for /v1/models (up to 900 s), runs one greedy chat, and requires exactly one aien-serve-http on the GPU. R4: removes the unit, runs privcheck against the baseline, removes markers, state and APPROVED, and posts BOARD WINDOW CLOSED.

Each driver step (W3 ident, W4, W5, W6) runs only if build/ogd modes lists it. Otherwise it is logged NOT_RUN: build/ogd has no '<mode>' mode and the window goes straight to W7 and R. All logs go to ~/handoffs/OwnDriver/window/d2-<UTC>-{pre,run,restore,boot}.log.

**Current candidate: build/ogd exists but advertises only model and model-trace; W4/W5 remain NOT_RUN.** It is not a physical firmware/compute launcher. D3 requires a successful modes query with an exact exec line, both before service disruption and after reboot before VFIO binding. Executable presence, exec-extra, or an exec line from a failed query is insufficient. This strengthens admission; it grants no hardware authority.

The native Aienux effect seam, coherent physical firmware/engine execution and device-stop attestation remain absent. See GB20B.md for the separate W0 identity request: that frozen candidate requires no build/ogd, explicit 18091 stop/restore plus FLR/SBR/reboot approval, and does not authorize D2 firmware loading. This model-only build is not that frozen W0 candidate.

Recovery when R fails twice

R posts restore FAILED after the reboot fallback to BOARD and stops. The GPU state is then unknown. Recovery is a physical power cycle by Drake. After that boot the hold-back file is already gone (W2 or R0 deleted it), so nvidia.ko loads normally. The unit is still installed with state restore, so it runs R again.

Simulator

sh tests/window_sim.sh runs these scripts, unchanged, against a fake machine in /tmp: sysfs, /etc, /dev/vfio and /proc live under OWNDRIVER_WINDOW_ROOT, and sudo, systemctl, modprobe, sysctl, lsmod, nvidia-smi, pgrep, curl, tee, stat, fuser, modinfo, lsinitramfs and spark-window are shims there. common.sh exits 2 unless the root is under /tmp, carries .owndriver-window-sim, and every one of those commands resolves to the shim, so a simulation can never reach the real machine. The harness simulates each reboot (fresh /tmp, 35B gone, nvidia loaded unless held back, boot unit run if enabled). Scenarios: W0, W0 with a matching and with a tampered build/fw, full D2, rebind restore, missing approval, missing reset line, chip lock held, mismatched 35B launch record, W1 failure after the 35B stop, runtime PM stuck, w0 failure, crash mid-W3, one restore fallback, restore failing twice, privilege leak, world-writable /dev/vfio/20, chip lock taken right after the W1 reboot, D3 without ogd, stale unit. tests/mutants-window.sh deletes one safety step at a time and checks that a scenario fails. What it cannot show: real FLR and SBR behaviour, nvidia.ko reload after them, real boot timing.

Before posting WINDOW-READY

Run OGKM=<checkout> sh build.sh and sh window/d2-pre.sh. The sha256 values on the W0 log lines are the ones quoted in the BOARD WINDOW-READY line. Any later edit to a hashed file changes those values, and W0 must be re-run.