NVIDIA / NVIDIA/open-gpu-kernel-modules
RmCheckForExternalGpu does not always identify an eGPU correctly
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
575.64
Please confirm this issue does not happen with the proprietary driver (of the same version). This issue tracker is only for bugs specific to the open kernel driver.
- I confirm that this does not happen with the proprietary driver package.
Operating System and Version
Arch linux
Kernel Release
Linux frx 6.15.4-arch2-1 #1 SMP PREEMPT_DYNAMIC Fri, 27 Jun 2025 16:35:07 +0000 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.
Hardware: GPU
NVIDIA GeForce RTX 5070 Ti
Describe the bug
I got a 5070 Ti in an ADTLINK UT4G dock on a Framework 16 laptop.
Trying to safely remove it (i.e. "echo 0000:09:00.0 >/sys/bus/pci/drivers/nvidia/unbind") produces a "NVRM: Attempting to remove device with non-zero usage count!" error.
Just unplugging it produces a flurry of assertion errors.
In both cases the driver then locks up, requiring a hard power cycle to use the laptop again.
Looking at the code, the only way that error could show up is if nv->is_external_gpu is not set, in nv_pci_remove in nvidia/nv-pci.c.
The flag is set based on the output of RmCheckForExternalGpu, in src/nvidia/arch/nvalloc/unix/src/osinit.c
Clearly, it does not detect the GPU as an eGPU on my hardware.
I am not familiar with the details of it enough to figure out why, but as an experiment i patched RmCheckForExternalGpu to always return NV_TRUE, and that solved the issue.
(As in, the kernel no longer locks up. Full hotplug is still broken for unrelated reasons, see #842 for example)
To Reproduce
Plug in an eGPU of the sort it can't identify as such.
Try to remove it or unplug it.
The module is now locked up with 100% CPU usage on one core.
Bug Incidence
Always
nvidia-bug-report.log.gz
More Info
No response
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 in src/nvidia/arch/nvalloc/unix/src/osinit.c at RmCheckForExternalGpu and compare its result with the nv->is_external_gpu use in nvidia/nv-pci.c. Reproduce with an eGPU, then test safe removal via the PCI sysfs unbind path and unplugging it; done means the GPU is identified as external and the driver no longer locks up.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- c, linux
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100