[PR #314] Guix System port: native module package + boot-time shepherd one-shot #288

Open
opened 2026-11-07 17:54:51 +07:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/Zagitta/gpu-unlock/pull/314
Author: @Paulr13
Created: 11/6/2026
Status: 🔄 Open

Base: main ← Head: guix-port


📝 Commits (2)

  • 523e4f3 Guix System port: native module package + boot-time shepherd one-shot
  • 1a4f83c Curate for upstream: generic example config, de-personalized docs

📊 Changes

4 files changed (+441 additions, -0 deletions)

View changed files

➕ guix/channels.scm (+18 -0)
➕ guix/config-example.scm (+169 -0)
➕ guix/gpu-unlock.scm (+150 -0)
➕ guix/integration.md (+104 -0)

📄 Description

Adds a native Guix System port of gpu-unlock under guix/:

  • gpu-unlock.scm — Guile package module exporting make-gpu-unlock-module (out-of-tree kernel module built with linux-module-build-system against the exact nonguix kernel the system uses) and gpu-unlock-firmware (the 16 assets the module requests, extracted from the pinned NVIDIA 610.43.03 sources by the repo's own firmware/extract_gsp.py + firmware/extract_boot_assets.py).
  • config-example.scm — add-to-your-config fragment carrying the complete, boot-proven shepherd one-shot.
  • channels.scm — example pinned channels + the make-channel-introduction note needed for pinned-commit authentication.
  • integration.md — design notes, deployment recipe, verification, benchmarks.

No initrd changes: nonguix binds the NVIDIA driver via udev coldplug, so the port blacklists nvidia* on the kernel command line and loads everything from a rootfs-stage shepherd one-shot in deterministic order. The module stays a no-op unless gpu_unlock.targets=all is on the cmdline (rollback = delete the flag or boot the previous generation).

Two lessons from this port generalize beyond Guix and are what the config encodes:

  1. modprobe in a service context cannot see the kernel's modules on a GNU Guix System. Modules live under /run/booted-system/kernel/lib/modules/$(uname -r), not /lib/modules. Setting LINUX_MODULE_DIRECTORY from inside the service lambda proved unreliable, so the one-shot passes -d /run/booted-system/kernel on every modprobe call — works with stock kmod.
  2. Boot-managed CUDA consumers silently defeat the unlock. Any daemon that opens /dev/nvidia* at boot (including nvidia-powerd and shepherd-managed llama/OmniVoice-style servers) holds the driver: uvm's dependency blocks unloading nvidia, the eject never happens, and gpu_unlock still loads with rc=0 — a silent no-op. The fix is ordering: the unlock service runs a /proc fd-holder sweep (TERM → KILL → survivor report) before the eject, and every CUDA-consuming service plus the power-cap service get gpu-unlock-load added to their shepherd requirement lists.

Tested on 3 Guix hosts (2× RTX 3090 each), kernels 7.1.8 and 7.2.15, driver 580.178.04, boot-persistent across repeated reboots with the full log sequence clean:

  • GPU0 117.8 TFLOPS / GPU1 113.0 TFLOPS (8192³ BF16 matmul)
  • vs 70.1 TFLOPS stock cap (~1.7×)
  • dmesg shows stage=claim/gfw with ss0=0x88888888 per GPU before the driver binds

Two additional hosts on this port use it in production serving llama.cpp inference with 24 GB resident per GPU; outputs are bit-identical to stock (the module only writes the speed-select registers + FLRs before the driver binds; stock throttling/power management is untouched).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/Zagitta/gpu-unlock/pull/314 **Author:** [@Paulr13](https://github.com/Paulr13) **Created:** 11/6/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `guix-port` --- ### 📝 Commits (2) - [`523e4f3`](https://github.com/Zagitta/gpu-unlock/commit/523e4f362943fc0cd67731c28409a7b508451fc7) Guix System port: native module package + boot-time shepherd one-shot - [`1a4f83c`](https://github.com/Zagitta/gpu-unlock/commit/1a4f83ccc40fbbc0ed359e4b1c05d6bd0d927da0) Curate for upstream: generic example config, de-personalized docs ### 📊 Changes **4 files changed** (+441 additions, -0 deletions) <details> <summary>View changed files</summary> ➕ `guix/channels.scm` (+18 -0) ➕ `guix/config-example.scm` (+169 -0) ➕ `guix/gpu-unlock.scm` (+150 -0) ➕ `guix/integration.md` (+104 -0) </details> ### 📄 Description Adds a native Guix System port of gpu-unlock under `guix/`: - `gpu-unlock.scm` — Guile package module exporting `make-gpu-unlock-module` (out-of-tree kernel module built with `linux-module-build-system` against the exact nonguix kernel the system uses) and `gpu-unlock-firmware` (the 16 assets the module requests, extracted from the pinned NVIDIA 610.43.03 sources by the repo's own `firmware/extract_gsp.py` + `firmware/extract_boot_assets.py`). - `config-example.scm` — add-to-your-config fragment carrying the complete, boot-proven shepherd one-shot. - `channels.scm` — example pinned channels + the `make-channel-introduction` note needed for pinned-commit authentication. - `integration.md` — design notes, deployment recipe, verification, benchmarks. No initrd changes: nonguix binds the NVIDIA driver via udev coldplug, so the port blacklists `nvidia*` on the kernel command line and loads everything from a rootfs-stage shepherd one-shot in deterministic order. The module stays a no-op unless `gpu_unlock.targets=all` is on the cmdline (rollback = delete the flag or boot the previous generation). Two lessons from this port generalize beyond Guix and are what the config encodes: 1. **`modprobe` in a service context cannot see the kernel's modules on a GNU Guix System.** Modules live under `/run/booted-system/kernel/lib/modules/$(uname -r)`, not `/lib/modules`. Setting `LINUX_MODULE_DIRECTORY` from inside the service lambda proved unreliable, so the one-shot passes `-d /run/booted-system/kernel` on every modprobe call — works with stock kmod. 2. **Boot-managed CUDA consumers silently defeat the unlock.** Any daemon that opens `/dev/nvidia*` at boot (including nvidia-powerd and shepherd-managed llama/OmniVoice-style servers) holds the driver: uvm's dependency blocks unloading nvidia, the eject never happens, and `gpu_unlock` still loads with rc=0 — a silent no-op. The fix is ordering: the unlock service runs a `/proc` fd-holder sweep (TERM → KILL → survivor report) before the eject, and every CUDA-consuming service plus the power-cap service get `gpu-unlock-load` added to their shepherd `requirement` lists. Tested on 3 Guix hosts (2× RTX 3090 each), kernels 7.1.8 and 7.2.15, driver 580.178.04, boot-persistent across repeated reboots with the full log sequence clean: - GPU0 **117.8 TFLOPS** / GPU1 **113.0 TFLOPS** (8192³ BF16 matmul) - vs **70.1 TFLOPS** stock cap (~1.7×) - dmesg shows `stage=claim/gfw` with `ss0=0x88888888` per GPU before the driver binds Two additional hosts on this port use it in production serving llama.cpp inference with 24 GB resident per GPU; outputs are bit-identical to stock (the module only writes the speed-select registers + FLRs before the driver binds; stock throttling/power management is untouched). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Zagitta/gpu-unlock#288
No description provided.