Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-gpu-driver/blob/main/window/README.md # omega-gpu-driver aien-dev/omega-gpu-driver Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-gpu-driver / window / README.md` 101 lines · 9321 bytes Raw Blame History Rendered 1 # OwnDriver window procedure (W0 identity, D2, D3) 2 3 Status: **NOT_RUN** on the GB10. W0 has run read-only beside the live 35B (EXERCISED, host). Nothing in W1..W7 4 or R has touched the GB10. The unchanged scripts have run end to end against a simulated machine under /tmp 5 (`tests/window_sim.sh`, EXERCISED host simulator; `tests/mutants-window.sh` removes one safety step at a time and 6 the simulator must catch it). Every step below stops the resident 35B on 127.0.0.1:18091, resets the GPU and 7 reboots the Spark twice. It runs only in an exclusive window that Drake opens for this job. 8 9 ## Identity-only window 10 11 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. 12 13 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. 14 15 ## What the window does to the machine 16 17 - **Two reboots.** nvidia.ko is held back for one boot so the GPU comes up without a driver. A live unload of 18 nvidia can hang in `nvEvoWaitForCoreNotifier`, and a fresh boot hands the driver an untouched GPU. Each reboot 19 ends **every agent session on the Spark, Main's included.** The window therefore runs unattended through a 20 one-shot systemd unit (`aien-owndriver-window.service`) that W1 installs and R removes. 21 - **GPU reset.** `reset_method` is `flr bus`. vfio-pci FLRs the GPU when W2/W3 open it, and on release calls 22 `pci_reset_bus`: a Secondary Bus Reset of root port 000f:00:00.0 (10de:22d1, not quirked NO_BUS_RESET), 23 whose only device is the GPU 000f:01:00.0. Emptying `reset_method` would not stop that SBR (README.md, 24 `qemu/sbr/sbr-on-release.log`, EXERCISED in QEMU only). 25 - **No privilege grant.** No udev rule, group, sudoers line, memlock limit or `/dev/vfio` mode change. The driver 26 programs run as root through `sudo -n`. `/dev/vfio/20` must stay `root:root 0600`. W0 records the privilege 27 baseline (`priv-baseline`: every file in `/etc/sudoers.d`, `/etc/udev/rules.d`, `/etc/security/limits.d` and 28 `/etc/modprobe.d` with its sha256, plus the user's groups). R4 fails closed and posts to BOARD if anything differs. 29 - **Window files**, present only between W1 and R: 30 - `/etc/modprobe.d/zz-aien-owndriver-window.conf`: nvidia hold-back; 31 - `/etc/systemd/system/aien-owndriver-window.service`; 32 - `~/handoffs/OwnDriver/window/{state,saved-sysctl,d3-cmd,reboot-fallback-used}`. 33 34 ## Approval 35 36 Main writes `/home/drakestapleton/handoffs/OwnDriver/window/APPROVED` when Drake opens the window. The file lives 37 there and not in `/tmp`, because `/tmp` is emptied at every boot (`D /tmp` in tmpfiles.d). It must contain: 38 39 ``` 40 window: 41 reset: approved 42 reboot: approved 43 ``` 44 45 W1 and W2 refuse without all three lines. R deletes the file at the end (one approval, one window). 46 47 ## Steps 48 49 | Step | Script | What it does | Ends with | 50 |---|---|---|---| 51 | W0 | `sh window/d2-pre.sh` | Read-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 | 52 | W1 | `sh 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 | 53 | W2 | unit → `d2-run.sh --go D2` | Sets 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`. | | 54 | W3 | | Runtime 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`. | | 55 | W4 | | `build/ogd boot`: GSP boot to INIT_DONE, static info, unload. | | 56 | W5 | | `build/ogd hello`: objects, channel, one semaphore release, teardown. | | 57 | W6 (D3 only) | | `build/ogd exec ... -- $D3_CMD`, where D3_CMD is the CUDApp chip-gate command line. W1 stores it in `d3-cmd`. | | 58 | W7 | EXIT trap | Unbinds 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 | 59 | R | unit → `d2-restore.sh --go` | R0: 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`. | | 60 61 Each driver step (W3 ident, W4, W5, W6) runs only if `build/ogd modes` lists it. Otherwise it is logged 62 `NOT_RUN: build/ogd has no '' mode` and the window goes straight to W7 and R. All logs go to 63 `~/handoffs/OwnDriver/window/d2--{pre,run,restore,boot}.log`. 64 65 **Current candidate: `build/ogd` exists but advertises only `model` and 66 `model-trace`; W4/W5 remain NOT_RUN.** It is not a physical firmware/compute 67 launcher. D3 requires a successful `modes` query with an exact `exec` line, both 68 before service disruption and after reboot before VFIO binding. Executable 69 presence, `exec-extra`, or an `exec` line from a failed query is insufficient. 70 This strengthens admission; it grants no hardware authority. 71 72 The native Aienux effect seam, coherent physical firmware/engine execution and 73 device-stop attestation remain absent. See [GB20B.md](../GB20B.md) for the 74 separate W0 identity request: that frozen candidate requires **no `build/ogd`**, 75 explicit 18091 stop/restore plus FLR/SBR/reboot approval, and does not authorize 76 D2 firmware loading. This model-only build is not that frozen W0 candidate. 77 78 ## Recovery when R fails twice 79 80 R posts `restore FAILED after the reboot fallback` to BOARD and stops. The GPU state is then unknown. 81 Recovery is a physical power cycle by Drake. After that boot the hold-back file is already gone (W2 or R0 82 deleted it), so nvidia.ko loads normally. The unit is still installed with state `restore`, so it runs R again. 83 84 ## Simulator 85 86 `sh tests/window_sim.sh` runs these scripts, unchanged, against a fake machine in /tmp: sysfs, `/etc`, `/dev/vfio` 87 and `/proc` live under `OWNDRIVER_WINDOW_ROOT`, and sudo, systemctl, modprobe, sysctl, lsmod, nvidia-smi, pgrep, 88 curl, tee, stat, fuser, modinfo, lsinitramfs and spark-window are shims there. `common.sh` exits 2 unless the root 89 is under /tmp, carries `.owndriver-window-sim`, and every one of those commands resolves to the shim, so a 90 simulation can never reach the real machine. The harness simulates each reboot (fresh /tmp, 35B gone, nvidia loaded 91 unless held back, boot unit run if enabled). Scenarios: W0, W0 with a matching and with a tampered `build/fw`, full 92 D2, rebind restore, missing approval, missing reset line, chip lock held, mismatched 35B launch record, W1 failure 93 after the 35B stop, runtime PM stuck, w0 failure, crash mid-W3, one restore fallback, restore failing twice, 94 privilege leak, world-writable `/dev/vfio/20`, chip lock taken right after the W1 reboot, D3 without ogd, stale 95 unit. `tests/mutants-window.sh` deletes one safety step at a time and checks that a scenario fails. What it cannot 96 show: real FLR and SBR behaviour, nvidia.ko reload after them, real boot timing. 97 98 ## Before posting WINDOW-READY 99 100 Run `OGKM= sh build.sh` and `sh window/d2-pre.sh`. The sha256 values on the W0 log lines are the ones quoted in the 101 BOARD `WINDOW-READY` line. Any later edit to a hashed file changes those values, and W0 must be re-run.