You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RmCheckForExternalGpu does not always identify an eGPU correctly #894
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.
Same scenario here — external GPU on an AMD host, no way to release the driver —
and I ran into a second, distinct failure while trying to work around it. Posting
it here rather than as a new issue because it compounds this one: together they
are what makes the card unusable without a power cycle.
Setup: RTX 3070 (GA104) in an AOOSTAR AG02 enclosure over USB4, AMD Ryzen AI
9 HX 370 host, driver 610.57.04, kernel 7.2.0-ogc4.1.fc44 (Bazzite).
The detection failure, confirmed on a second AMD platform
As described in this thread, nv->is_external_gpu is never set, so teardown
takes the internal-GPU path. Worth adding the why, which I don't think has been
stated here: RmCheckForExternalGpu() identifies an eGPU enclosure by matching
the Intel vendor ID (0x8086) on the upstream bridge. On an AMD host the
upstream bridge is not Intel, so the check returns false regardless of the GPU
actually sitting behind a hot-pluggable tunnel.
That makes this not specific to the Framework 16 in the original report: it
affects any non-Intel USB4 host — AMD since Ryzen 6000, and Qualcomm on ARM
laptops. Enclosure controllers are frequently ASMedia rather than Intel too,
depending on which bridge in the chain the check inspects.
A second bug: unloading nvidia_drm panics the kernel
Trying to release the driver manually (the obvious workaround) hits a NULL
pointer dereference:
Two seconds pass between the unload messages and the oops: the GEM object is
freed after teardown has already run.
Cause.nv_drm_remove_device() in nvidia-drm-drv.c clears the pointer
before freeing the device:
nv_dev->pDevice=NULL;
nvKms->freeDevice(pDevice);
GEM objects are reference counted and get freed later, when userspace releases
its handles. __nv_drm_gem_nvkms_memory_free() in nvidia-drm-gem-nvkms-memory.c then dereferences the now-NULL pointer:
/* Decrement GC6 blocker if it's still held */if (nv_nvkms_memory->was_mmapped) {
nvKms->gc6BlockerRefCntDec(nv_dev->pDevice); // NULL here
}
The guard checks was_mmapped but not nv_dev->pDevice. CR2: 0x10 matches
dereferencing pDevice->… at offset 16.
gc6BlockerRefCntDec is just the first unguarded call reached — the same
function also calls nvKms->unmapMemory(nv_dev->pDevice, …) and nvKms->freeMemory(nv_dev->pDevice, …) with no NULL check, so the crash site
depends on which branches the object takes. A guard around the whole block, or a
guarantee that NVKMS-backed GEM objects are reaped before pDevice is cleared,
would both cover it.
Reproduced by: desktop session with the GPU driving an output, then rmmod nvidia_uvm (succeeds), then rmmod nvidia_drm. The client holding the
mapped buffer was a Chromium-based application.
Why the two together are worse than either
With detection failing, the external-GPU teardown path is never taken. With the
unload crash, releasing the driver by hand isn't an option either — a compositor
holds NVKMS GEM objects for the whole session, so the unsafe ordering is the
normal case, not an edge case.
The practical result on an AMD host is that the card can only be connected and
disconnected with the machine powered off. In my case the GPU also dropped off
the bus on its own after six hours idle, following a spontaneous Thunderbolt
re-enumeration, and the machine stayed wedged for twelve hours until it was
forced off — with nvidia-modeset: ERROR: GPU:0: Error while waiting for GPU progress repeating every five seconds throughout.
I'm not filing the unload crash as its own issue: the report template asks me to
confirm it doesn't occur with the proprietary driver, and I have no way to check
that — RmGc6BlockerRefCntDec lives in the closed component shared by both, so
it may well affect them equally. Happy to provide anything further if useful.
Activity
Selven81 commentedon Aug 26, 2026
Same scenario here — external GPU on an AMD host, no way to release the driver —
and I ran into a second, distinct failure while trying to work around it. Posting
it here rather than as a new issue because it compounds this one: together they
are what makes the card unusable without a power cycle.
Setup: RTX 3070 (GA104) in an AOOSTAR AG02 enclosure over USB4, AMD Ryzen AI
9 HX 370 host, driver 610.57.04, kernel 7.2.0-ogc4.1.fc44 (Bazzite).
The detection failure, confirmed on a second AMD platform
As described in this thread,
nv->is_external_gpuis never set, so teardowntakes the internal-GPU path. Worth adding the why, which I don't think has been
stated here:
RmCheckForExternalGpu()identifies an eGPU enclosure by matchingthe Intel vendor ID (0x8086) on the upstream bridge. On an AMD host the
upstream bridge is not Intel, so the check returns false regardless of the GPU
actually sitting behind a hot-pluggable tunnel.
That makes this not specific to the Framework 16 in the original report: it
affects any non-Intel USB4 host — AMD since Ryzen 6000, and Qualcomm on ARM
laptops. Enclosure controllers are frequently ASMedia rather than Intel too,
depending on which bridge in the chain the check inspects.
A second bug: unloading
nvidia_drmpanics the kernelTrying to release the driver manually (the obvious workaround) hits a NULL
pointer dereference:
Two seconds pass between the unload messages and the oops: the GEM object is
freed after teardown has already run.
Cause.
nv_drm_remove_device()innvidia-drm-drv.cclears the pointerbefore freeing the device:
GEM objects are reference counted and get freed later, when userspace releases
its handles.
__nv_drm_gem_nvkms_memory_free()innvidia-drm-gem-nvkms-memory.cthen dereferences the now-NULL pointer:The guard checks
was_mmappedbut notnv_dev->pDevice.CR2: 0x10matchesdereferencing
pDevice->…at offset 16.gc6BlockerRefCntDecis just the first unguarded call reached — the samefunction also calls
nvKms->unmapMemory(nv_dev->pDevice, …)andnvKms->freeMemory(nv_dev->pDevice, …)with no NULL check, so the crash sitedepends on which branches the object takes. A guard around the whole block, or a
guarantee that NVKMS-backed GEM objects are reaped before
pDeviceis cleared,would both cover it.
Reproduced by: desktop session with the GPU driving an output, then
rmmod nvidia_uvm(succeeds), thenrmmod nvidia_drm. The client holding themapped buffer was a Chromium-based application.
Why the two together are worse than either
With detection failing, the external-GPU teardown path is never taken. With the
unload crash, releasing the driver by hand isn't an option either — a compositor
holds NVKMS GEM objects for the whole session, so the unsafe ordering is the
normal case, not an edge case.
The practical result on an AMD host is that the card can only be connected and
disconnected with the machine powered off. In my case the GPU also dropped off
the bus on its own after six hours idle, following a spontaneous Thunderbolt
re-enumeration, and the machine stayed wedged for twelve hours until it was
forced off — with
nvidia-modeset: ERROR: GPU:0: Error while waiting for GPU progressrepeating every five seconds throughout.I'm not filing the unload crash as its own issue: the report template asks me to
confirm it doesn't occur with the proprietary driver, and I have no way to check
that —
RmGc6BlockerRefCntDeclives in the closed component shared by both, soit may well affect them equally. Happy to provide anything further if useful.