mirror of
https://github.com/JustAResearcher/gpu-unlock-ada.git
synced 2026-12-03 20:45:57 +07:00
[GH-ISSUE #112] Ubuntu/initramfs-tools: nvidia binds from initrd udev coldplug before gpu_unlock loads -> 'unlock failed (-16)' every boot #70
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
JustAResearcher/gpu-unlock-ada#70
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Hotcooler on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/JustAResearcher/gpu-unlock-ada/issues/112
Environment
d28c485, 2026-10-25)10de:2705GeForce RTX 4070 Ti SUPER @0000:05:00.0(address anonymized)gpu_unlock.targets=0000:05:00.0 gpu_unlock.ad103_experimental=1Install was
make install-debfrom a local clone;dkms statusshowsgpu-unlock/1.1.1installed for both kernels;lsinitramfsconfirmsgpu_unlock.ko, the pinnedgpu-unlock/610.43.03/*firmware, and the package's/usr/share/initramfs-tools/modules.d/gpu-unlock.confall made it into the initrd — the initramfs packaging itself works.Symptom
Every single boot since installation (2 kernels, ≥6 reboots, full dmesg excerpts in the appendix):
The
(-16)is-EBUSYfrom thepdev->driver ? -EBUSYguard —gpu_unlock'smodule_initonly starts ~2 s after nvidia has already bound. The module, firmware, cmdline options and parameters (/sys/module/gpu_unlock/parameters/*showtargets+ad103_experimentalcorrectly) are all fine. This looked like a module problem; it is a load-order problem specific to initramfs-tools.Root cause
initramfs-tools has no load-before-coldplug hook, and the order inside the initrd
/initis fixed:gpu_unlock.kointentionally declares no device/PCI alias (verified inmodules.alias/modules.alias.bin), so it can only be loaded by name — from the initrd module list.modules.d/gpu-unlock.confdrop-in is honoured (Ubuntu's/usr/sbin/mkinitramfs~line 351:for x in "${CONFDIR}/modules" /usr/share/initramfs-tools/modules.d/*; do add_modules_from_file "$x"— the extracted initrd's/conf/moduleslistsgpu_unlockfirst)./initprocesses that list inload_modules(), which runs afterrun_scripts /scripts/init-top— andinit-top/udevstarts udevd and coldplugs devices (udevadm trigger --action=add). A udev worker then autoloadsnvidiavia its wildcard aliaspci:v000010DEd*sv*sd*bc03sc00i00*and binds the GPU beforeload_modulesis ever called. (On this host the nvidia module load itself happens inside the initrd; the 18 s stack trace showsComm: (udev-worker)loadingnvidia_modesetfor the same event.)nvidia*.kois reliably present in the initrd because Ubuntu'snvidia-kernel-common-*ships theframebuffer-nvidiainitramfs hook that copies it (MODULES=mostdoes the rest).gpu_unlockdoes not merely lose a race here — the alias-driven autoload ofnvidiastarts whileinit-topis still coldplugging, while the name-list-driven load ofgpu_unlockdoes not begin untilinit-tophas returned. On this hostnvidiawon by ~2 s in every observed boot (≥6 boots, 2 kernels); the timestamps scale with how slow the disk/udev queue is (17–19 s with this 30-bay box, ~1 s on quick systems), but the order never flipped. Since the repo does have other Ubuntu 24.04 success reports, the flip point presumably depends on when the GPU uevent gets processed relative toload_modules— but with the Ubuntuframebuffer-nvidiahook guaranteeingnvidia*.koships inside the initrd, an initramfs-tools host has no knob that guarantees gpu_unlock goes first.This is consistent with all the working evidence in this repo: those run under mkinitcpio (the README's own
zz-gpu-unlock.confinsertsgpu_unlockdirectly beforenvidiainMODULES, which initrd tooling loads in order before coldplug) or dracut (force_drivers), where the explicit list is honoured pre-bind. The working example logs showgpu_unlocktainting at 0.9 s with nvidia loading at 2.3–5.6 s — i.e. nvidia loaded from the real root, which is exactly the situation Ubuntu'sframebuffer-nvidiahook deliberately destroys.Workaround (verified on this host)
kmod then forces
gpu_unlock'smodule_initto run to completion (its init is explicitly synchronous: "nvidia loads once this returns") inside the udev worker, beforenvidia.kois even inserted, while the card is still unbound. This applies inside the initrd too becauseupdate-initramfscopies/etc/modprobe.dinto the image. Note for hosts where some other config already has asoftdep nvidia …line: kmod uses only the first matching line (see README "There is no softdep…" rationale), so merge everything onto one line, e.g.softdep nvidia pre: gpu_unlock ecdh_generic,ecdsa_generic(on this host the file above is the only softdep config for nvidia; the module's built-in ecdh/ecdsa metadata softdep is a separate source and kept working — the driver initialises fully).Result — same hardware, one cold boot later:
Validation on this card (four independent levels, per
docs/testing.md— details in appendix):gpu_unlock: unlocked, nounlock failed, no Xid.tools/read_sm_rates.py): all nine selectors report0= full,fmla32: 0(stock on AD103 is1/half).gpu_peekregister sampler:SS0 = 0x88888888,SS1 = 0x00000008,FEAT_READOUT_1 = 0x00000000→ all nine 3-bit unit fields0(full); summaryss0_unlocked=1 ss1_unlocked=1 plm_open=1.mma_bench 20000 5at 2910 MHz SM / 285 W cap (host runs a persistent +160 MHz GPC offset, so absolute TF/s sit above the report's fixed-clock figures):f16/f16 197.5 | f16/f32 197.2 | bf16/f32 196.2 | fp8/e4m3 392.0 | s8/s32 392.3 | dp4a 97.7 | ffma 47.2 TF/s— FP32-accumulate tensor modes at full INT8-relative rate; unchangeddp4a/ffmacontrols; same signature as the 2705 report's matched pair (95.0 → 189.9 TF/s at reference clocks).Suggestions
softdep nvidia pre: gpu_unlock+update-initramfs -u+ cold-boot recipe. Anyone filing "-16" bugs would self-serve.init-toppreload script) into the initrd only, without touching the host's/etc/modprobe.d— sidestepping the "first matching softdep line" concern for the early-userspace stage where it matters. On systems where nvidia isn't in the initrd, the existingmodules.dpath already wins the race, so this only changes behaviour where it's currently broken.-EBUSYpath, log the owning driver (pdev->driver->name) and a hint that the module must load earlier than the display driver (initramfs/softdep). A bare-16is maximally misleading — everything upstream of it (dkms, initrd, firmware, cmdline) looks healthy, exactly as it did here.Happy to test candidate patches/hook drafts on this box (Ubuntu 24.04.5, AD103 2705, Secure Boot off, both kernels).
Appendix A — failing boots (kern.log, four consecutive boots; hostname scrubbed; PCI address anonymized)
Same boot, full timeline (dmesg):
16.999 nvidia taint → 17.035 nvlink → 17.039 nvidia vgaarb (bind) → 18.02 NVRM loaded → 19.158 first gpu_unlock asset read → 19.245 unlock failed (-16).Appendix B — working boot after the one-line workaround
RM getter:
{"rates": {"imla0": 0, "fmla16": 0, "dp": 0, "fmla32": 0, "ffma": 0, "imla1": 0, "imla2": 0, "imla3": 0, "imla4": 0}, "meaning": "0=full; 1=half; ...", "hardware_changes": false}gpu_peek (read-only, nvidia still bound):
SS0 speed select = 0x88888888,SS1 speed select = 0x00000008,FEAT_READOUT_1 (SS effective) = 0x00000000,FEAT_READOUT_1 units (3-bit, 0=full): 0 0 0 0 0 0 0 0 0,summary boot_completed=1 gfw_plm_level0=1 wpr2_up=1 plm_open=1 ss0_unlocked=1 ss1_unlocked=1.