620.70.06: GPU lock never released after error_detected(pci_channel_io_perm_failure), so nv_pci_shutdown and nvidia-smi block forever and every poweroff hangs; triggered by a non-fatal AER that only the HDA function failed to recover

Offen
#1,558 4 Kommentare 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Anfängerfreundlichkeit
42/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Aktiv
Tech-Stack
c, linux

Rechercherichtung

Start by reading nv_pci_error_detected in kernel-open/nvidia/nv-pci.c, then trace the interrupt top half and bottom half in kernel-open/nvidia/nv.c and src/nvidia/arch/nvalloc/unix/src/unix_intr.c. Check how pci_channel_io_perm_failure affects GPU state and whether the handed-off lock is released when bottom-half work is skipped. Done means the lock cannot remain held after this recovery path and the reported poweroff and nvidia-smi hangs are addressed.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug
NVIDIA Open GPU Kernel Modules Version

620.70.06 (Arch Linux nvidia-open-dkms 620.70.06-1 with PR %231512 applied for the unrelated RTD3 issue %231507; also reproduced with the stock Arch nvidia-open 620.70.06 package without %231512)

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 7.3.4-arch1-1 %231 SMP PREEMPT_DYNAMIC Wed, 11 Nov 2026 19:02:39 0000 x86_64 GNU/Linux (Arch stock kernel, not self-built)

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

GPU 0: NVIDIA GeForce RTX 5070 Laptop GPU

Describe the bug

I have not tested the proprietary driver. The code involved is the new PCI error handling in kernel-open/nvidia/nv-pci.c and the interrupt bottom half in kernel-open/nvidia/nv.c and src/nvidia/arch/nvalloc/unix/src/unix_intr.c, all in this repository. Line references are to the 620.70.06 tag.

620 adds PCI error handlers, nv_pci_error_detected enabled by default through NVreg_EnablePCIeErrorRecovery=1). After the driver receives pci_channel_io_perm_failure, the RM GPU lock is never released again. Every later RM call that needs the GPU lock blocks forever in state D:

  • nv_pci_shutdown() at poweroff and reboot, so the machine never powers off
  • nvidia-smi, the nv_queue worker and the ACPI notify handler during a session

The GPU stays dead until a hard reset. 615.78.08 registered no PCI error handlers and keeps working through the same AER event on the same kernel.

On this laptop, perm_failure doesn't mean the GPU is gone. The GPU's root port logs a non-fatal Unsupported Request. The GPU's own error_detected votes CAN_RECOVER. Recovery fails only because snd_hda_intel on the GPU's HDA function 01:00.1 has no error_detected callback. The kernel then sends perm_failure to every driver below the port, without resetting or disconnecting anything.

System
  • ASUS ROG Strix G18 G814FP, BIOS G814FP.317 (2026-07-02)
  • Ryzen 9 9955HX, RTX 5070 Laptop GPU (GB206M, 10de:2d58) at 01:00.0, HDA function at 01:00.1, directly behind AMD root port 00:01.1 (1022:14db)
  • Hybrid graphics: the Radeon 610M iGPU drives the panel and the dGPU uses RTD3. KDE Plasma Wayland.
1. GPU lock leak in the ISR bottom half

Reading the 620.70.06 source, this is the path that leaves the lock held:

  1. nv_pci_error_detected sets NV_FLAG_IN_PCIE_ERROR_RECOVERY for every state except pci_channel_io_normal. Nothing ever clears it.
  2. nv_check_gpu_state() now returns NV_ERR_GPU_IS_LOST for NV_IS_DEVICE_INACCESSIBLE, which includes the new flag. In 615.78.08 it checked surprise removal only.
  3. The top half nvidia_isr doesn't check the flag. It calls rm_isr, which calls osIsr, which calls osInterruptPending. That function takes the GPU lock with GPU_LOCK_FLAGS_COND_ACQUIRE. When stall work is pending, it keeps the lock and sets the owner to GPUS_LOCK_OWNER_PENDING_DPC_REFRESH, which is (OS_THREAD_HANDLE)-1. nvidia_isr then returns IRQ_WAKE_THREAD.
  4. The threaded bottom half nvidia_isr_common_bh calls nv_check_gpu_state(), gets NV_ERR_GPU_IS_LOST and skips rm_isr_bh(). RmIsrBottomHalf is the only code that takes over the handed-off lock (L615) and releases it (L665).

This path leaks the lock whenever a GPU interrupt with stall work pending arrives after the flag is set. The lock stays held by the "pending DPC" owner, which is not a thread. The GPU is still alive here and still raising interrupts. This bottom-half skip was already in 615. It only becomes reachable once the flag can be set on a GPU that is still on the bus.

Every RM-related task in state D in the logs below is waiting for the GPU lock, and none of them holds it. I haven't confirmed that this path is the one that ran in these hangs. If it is, rmGpuLockInfo.gpuLocks[0].threadId reads GPUS_LOCK_OWNER_PENDING_DPC_REFRESH afterwards.

At poweroff. I captured this during a Plasma poweroff with hung_task_panic=1, initcall_debug and EFI pstore. The driver had resumed the GPU from D3cold for teardown:

[  113.308062] nvidia 0000:01:00.0: Enabling HDA controller
[  116.831867] shutdown[1]: Powering off.
[  116.836411] pcieport 0000:06:01.0: shutdown          <- USB4 tree behind root port 00:02.1
[  116.973101] pcieport 0000:00:01.1: AER: Uncorrectable (Non-Fatal) Error message received from 0000:00:01.1
[  116.974049] pcieport 0000:00:01.1:   device [1022:14db] error status/mask=00100000/00400000
[  116.974187] pcieport 0000:00:01.1:   [20] UnsupReq          | Receiver    | Transaction Layer (First)
[  116.974329] pcieport 0000:00:01.1: AER:   TLP Header: 0x00000000 0x00000000 0x00000000 0x00000000
[  117.017845] snd_hda_intel 0000:01:00.1: AER: can't recover (no error_detected callback)
[  117.018018] NVRM: GPU 0000:01:00.0: PCIe link reported as permanently failed; GPU remains inaccessible
[  117.018187] pcieport 0000:00:01.1: AER: device recovery failed
               (the same sequence twice more by 117.126)
[  118.769157] nvidia 0000:01:00.0: shutdown
[  118.769435] [drm] [nvidia-drm] [GPU ID 0x00000100] Removing device
[  118.769996] [drm] [nvidia-drm] [GPU ID 0x00000100] Unloading driver
[  143.420032] INFO: task shutdown:1 blocked for more than 20 seconds.
  down+0x53/0x70
  os_acquire_mutex+0x2c/0x40 [nvidia]
  portSyncSemaphoreAcquire+0x10/0x40 [nvidia]
  _rmGpuLocksAcquire.isra.0+0x42b/0x1020 [nvidia]
  rmGpuLocksAcquire+0x2e/0x170 [nvidia]
  deviceCtrlCmdOsUnixVTSwitch_IMPL+0x55/0x340 [nvidia]
  ... resControl_IMPL / serverControl / _rmapiRmControl ...
  Nv04ControlKernel+0x6f/0x80 [nvidia]
  nvkms_call_rm+0x4c/0x80 [nvidia_modeset]
  nvRmApiControl+0x6e/0x80 [nvidia_modeset]
  nvRmVTSwitch+0x2d/0x40 [nvidia_modeset]
  nvAllocCoreChannelEvo+0x249/0x9e0 [nvidia_modeset]
  RestoreConsole+0x69/0xa0 [nvidia_modeset]
  ReleaseOwnership+0x73/0xa0 [nvidia_modeset]
  nvKmsIoctl+0x123/0x300 [nvidia_modeset]
  nvkms_ioctl_from_kapi+0x6f/0xe0 [nvidia_modeset]
  ReleaseOwnership+0x33/0x40 [nvidia_modeset]
  nv_drm_dev_unload+0x5b/0x110 [nvidia_drm]
  nv_drm_remove.cold+0x52/0x65 [nvidia_drm]
  nv_pci_remove_helper+0x8a/0x510 [nvidia]
  nv_pci_shutdown+0x55/0x90 [nvidia]
  pci_device_shutdown+0x3e/0x80
  device_shutdown+0x169/0x1d0
  kernel_power_off+0x35/0x80
  __do_sys_reboot+0x1da/0x260
[  143.422410] INFO: task nv_queue:814 blocked for more than 20 seconds.
  down+0x53/0x70
  os_acquire_mutex+0x2c/0x40 [nvidia]
  portSyncSemaphoreAcquire+0x10/0x40 [nvidia]
  _rmGpuLocksAcquire.isra.0+0x42b/0x1020 [nvidia]
  rmGpuGroupLockAcquire+0x108/0x1c0 [nvidia]
  workItemLocksAcquire+0xa4/0x210 [nvidia]
  rm_execute_work_item+0xb8/0x1e0 [nvidia]
  _main_loop+0x111/0x170 [nvidia]
[  143.423121] Kernel panic - not syncing: hung_task: blocked tasks

Without hung_task_panic, the machine sits there with the screen off until the power button is held.

In a session. An lspci woke the GPU from D3cold, and the same scan also powered up the USB4 controller. Then:

04:20:25.047758 pcieport 0000:00:01.1:   [20] UnsupReq          | Receiver    | Transaction Layer (First)
04:20:25.090804 snd_hda_intel 0000:01:00.1: AER: can't recover (no error_detected callback)
04:20:25.091089 NVRM: GPU 0000:01:00.0: PCIe link reported as permanently failed; GPU remains inaccessible
04:20:25.091130 pcieport 0000:00:01.1: AER: device recovery failed
                (x3 by 04:20:25.195)
04:26:14.473139 INFO: task nvidia-smi:16008 blocked for more than 122 seconds.
  down+0x53/0x70
  os_acquire_mutex+0x2c/0x40 [nvidia]
  portSyncSemaphoreAcquire+0x10/0x40 [nvidia]
  _rmGpuLocksAcquire.isra.0+0x42b/0x1020 [nvidia]
  rmGpuGroupLockAcquire+0x108/0x1c0 [nvidia]
  os_ref_dynamic_power+0x198/0x230 [nvidia]
  rmapiPrologue+0x9c/0x1f0 [nvidia]
  rmapiAllocWithSecInfo+0x4b/0x420 [nvidia]
  ...
  RmIoctl+0xc69/0x1170 [nvidia]
  rm_ioctl+0x7b/0x600 [nvidia]
  nvidia_unlocked_ioctl+0x6a0/0xab0 [nvidia]
04:26:14.471685 INFO: task kworker/0:1:10 <writer> blocked on an rw-semaphore likely owned by task nvidia-smi:16008 <reader>
04:26:14.473122 INFO: task nv_queue:811 <writer> blocked on an rw-semaphore likely owned by task nvidia-smi:16008 <reader>

kworker/0:1 is in rm_acpi_notify (kacpi_notify) and nv_queue is in workItemLocksAcquire. Both are waiting for the RM API lock, which the first nvidia-smi holds while it waits for the GPU lock. Tasks in D state afterwards:

    PID STAT WCHAN                   CMD
     10 D    -                       [kworker/0:1+kacpi_notify]
    811 D    -                       [nv_queue]
  16008 D    os_acquire_mutex        nvidia-smi --query-gpu=name,pstate,power.draw --format=csv,noheader
  19203 D    os_acquire_rwlock_read  nvidia-smi
2. Non-fatal AER treated as GPU failure

Same root port error on the same kernel (7.3.4), 615.78.08 vs stock 620.70.06:

615.78.08:
[369.108454] pcieport 0000:00:01.1:   [20] UnsupReq          | Receiver    | Transaction Layer (First)
[369.151013] nvidia 0000:01:00.0: AER: can't recover (no error_detected callback)
[369.151202] snd_hda_intel 0000:01:00.1: AER: can't recover (no error_detected callback)
[369.151273] pcieport 0000:00:01.1: AER: device recovery failed

620.70.06:
[2657.501035] pcieport 0000:00:01.1:   [20] UnsupReq          | Receiver    | Transaction Layer (First)
[2657.501328] snd_hda_intel 0000:01:00.1: AER: can't recover (no error_detected callback)
[2657.501482] NVRM: GPU 0000:01:00.0: PCIe link reported as permanently failed; GPU remains inaccessible
[2657.501507] pcieport 0000:00:01.1: AER: device recovery failed

With 615 the GPU kept working and kept runtime-suspending. With 620 it is dead for the rest of the boot, and the boot ends in the hang above.

What happens in pcie_do_recovery() (drivers/pci/pcie/err.c, v7.3.4):

  • The error is non-fatal, so error_detected(pci_channel_io_normal) goes to every device below 00:01.1. nvidia returns PCI_ERS_RESULT_CAN_RECOVER. The driver logs that at NV_DBG_INFO, so it doesn't appear above.
  • snd_hda_intel has no callback, so its vote is PCI_ERS_RESULT_NO_AER_DRIVER and recovery goes to failed:.
  • failed: calls report_perm_failure_detected() for every device below the port. That calls error_detected(dev, pci_channel_io_perm_failure) and nothing else. It doesn't reset the link or change pci_dev->error_state. The GPU stays fully accessible.

The comment at nv-pci.c#L2617-L2621 expects perm_failure to follow the driver's own DISCONNECT vote from slot_reset. Here it follows a CAN_RECOVER vote on a non-fatal error, with no reset. snd_hda_intel has no PCI error handlers, so any non-fatal uncorrectable error below the GPU's root port now ends this way while snd_hda_intel is bound to the HDA function.

3. Trigger on this machine, for context

Root port 00:01.1 logs the non-fatal UnsupReq (TLP header all zeros) whenever the ASM4242 USB4 controller behind the other root port, 00:02.1, powers up from D3cold while the GPU link is up. I confirmed this by powering up the controller with the GPU held in D0 and with the GPU suspended. Only the first case sets the UnsupReq bit in 00:01.1's error status. At poweroff, pci_device_shutdown() runtime-resumes each device while the GPU is awake for teardown, so every poweroff and reboot hits it.

Tested workarounds
  • Mask UnsupReq on the GPU's root port, a udev rule runs setpci -s 0000:00:01.1 ECAP0001+8.L=00100000:00100000 when the port is enumerated (AER Uncorrectable Error Mask, bit 20). Without it, every boot on 620.70.06 hung at poweroff or reboot. With it, poweroffs and reboots were clean, including one after dGPU use and an s2idle cycle in which the USB4 power-up happened while the GPU was awake. Boots on the same kernel without the nvidia module loaded shut down cleanly with the AER errors present.
  • Setting nvidia.NVreg_EnablePCIeErrorRecovery=0, this skips registering the error handlers (nv-pci.c#L2786) and gives 615's behavior. With the AER mask removed, the same trigger (USB4 power-up with the GPU awake) produced 3 UnsupReqs at 00:01.1 and nvidia 0000:01:00.0: AER: can't recover (no error_detected callback), but no permanently failed. nvidia-smi kept working, the GPU runtime-suspended again, and the next poweroff was clean.
Note on the patched driver

The DKMS build carries PR #1512, which fixes RTD3 on Linux 7.3 (#1507) and only touches nv_get_pci_sysfs_config(). It isn't involved here. The 620 log in section 2 is from the stock Arch nvidia-open 620.70.06 package without #1512. With RTD3 broken there, the GPU sat in D0 all session, and every USB4 power-up hit it. That boot also hung at shutdown. The 615 log in section 2 is from 615.78.08 with #1512 applied, on the same 7.3.4 kernel. Stock 615.78.08 on 7.2.15 logs the same can't recover (no error_detected callback) lines for nvidia and keeps working.

To Reproduce

On this machine (ASUS G814FP, BIOS 317, stock ACPI behavior, 620.70.06, hybrid mode, no AER mask):

  • Boot into a Plasma Wayland session. RTD3 makes no difference.
  • Power off. The machine never powers off: nv_pci_shutdown blocks on the GPU lock, as in the stack above. This happens every time.
  • In a session: hold the GPU in D0 (echo on > /sys/bus/pci/devices/0000:01:00.0/power/control), then power up the USB4 controller (echo on > /sys/bus/pci/devices/0000:00:02.1/power/control). 00:01.1 logs the non-fatal UnsupReq. With the AER mask active, I confirmed this through 00:01.1's Uncorrectable Error Status register, which a masked error still sets. Without the mask, the same USB4 power-up while the GPU was awake produced permanently failed, both in a session and at shutdown. Any later nvidia-smi hangs in state D.
Bug Incidence

Always

nvidia-bug-report.log.gz

nvidia-bug-report.log.gz

More Info

Expected behavior: after the driver has declared the GPU inaccessible, nv_pci_shutdown() and RM clients should fail fast or skip GPU work instead of deadlocking. A non-fatal AER that the GPU itself voted CAN_RECOVER on shouldn't take the GPU down because another function on the link has no error handler.

Related:

  • #1544 reports a shutdown hang on 620.70.06 that doesn't happen with 615.78.08 (RTX 5070 Ti Laptop, Arch, 7.3.4), with no logs. It may be this bug. A journalctl -k -b -1 | grep 'permanently failed' after a hung boot would tell.
  • #1229 asked for pci_error_handlers after a transient eGPU error. The bug reported here came in with those handlers.
  • #1222 is a different shutdown stall that goes through the same RestoreConsole and VT-switch calls. There the CPU spins in unixCallVideoBIOS. Here the task sleeps on the GPU lock.
Vorherrschende Sprache
C
Sterne
17.7k
Forks
2k
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus NVIDIA/open-gpu-kernel-modules

Alle Issues in NVIDIA/open-gpu-kernel-modules

Ähnliche Issues

Weitere Issues zu C

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.