NVIDIA / NVIDIA/open-gpu-kernel-modules
UBSAN_SANITIZE needed? apt takes 60+ minutes for dkms building
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 17.4k
- Forks
- 1.9k
- PR merge metrics
- No merged PRs in 30d
Description
NVIDIA Open GPU Kernel Modules Version
580.173.02, i.e. 580.173.02-1pop1~1783343684~22.04~397d671
Operating System and Version
Pop!_OS 22.04 LTS
Kernel Release
Linux pop-os 7.0.11-76070011-generic #202606011647~1780583630~22.04~70ad774 SMP PREEMPT_DYNAMIC Thu J x86_64 x86_64 x86_64 GNU/Linux
Please confirm you are running a stable release kernel (e.g. not a -rc). We do not accept bug reports for unreleased kernels.
- I am running on a stable kernel release.
Build Command
sudo apt upgrade
Terminal output/Build Log
Setting up nvidia-dkms-580 (580.173.02-1pop1~1783343684~22.04~397d671) ...
update-initramfs: deferring update (trigger activated)
INFO:Enable nvidia
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/dell_latitude
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/put_your_quirks_here
DEBUG:Parsing /usr/share/ubuntu-drivers-common/quirks/lenovo_thinkpad
Loading new nvidia-580.173.02 DKMS files...
Building for 7.0.11-76070011-generic
Building for architecture x86_64
Building initial module for 7.0.11-76070011-generic
.... very very long wait ....
More Info
I am out of my depth, but AI-servant prepared a summary with more info. Hope it helps and it does not waste any time.
The hang occurs during the DKMS build of nvidia-uvm/uvm_lock.c. Investigation shows the root cause is UBSAN_SANITIZE := y set in NVIDIA's own Kbuild file, which causes the kernel build system to apply -fsanitize=bounds-strict -fsanitize=shift -fsanitize=bool -fsanitize=enum to all module files. On this kernel (which has CONFIG_UBSAN_BOUNDS_STRICT=y, CONFIG_UBSAN_SHIFT=y, CONFIG_UBSAN_BOOL=y, CONFIG_UBSAN_ENUM=y), GCC's cc1 takes 70+ minutes of CPU time at 100% to compile uvm_lock.c — a 15KB source file.
The fix would be to add either:
UBSAN_SANITIZE_uvm_lock.o := n
or disable it for the entire nvidia-uvm submodule:
UBSAN_SANITIZE := n
in the nvidia-uvm Kbuild/Makefile.
Expected behavior: DKMS build completes in under 5 minutes as it did before UBSAN was enabled in the Kbuild.
Hardware: NVIDIA GeForce RTX 4070, driver 580.173.02, GCC 11.4.0, kernel 7.0.11-76070011-generic (Pop!_OS).
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting the nvidia-uvm Kbuild/Makefile entries affecting uvm_lock.c and reproduce the delay with the DKMS build triggered by sudo apt upgrade. Compare the UBSAN settings described in the issue and verify that the NVIDIA module build completes in under five minutes without the excessive compilation time.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux
- Domain
- build-system, operating-systems
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100