open-gpu-kernel-modules icon indicating copy to clipboard operation
open-gpu-kernel-modules copied to clipboard

Display freezes on display blank — KMS thread blocked on semaphore held by nvidia-modeset stuck in nvDIFRPrefetchSurfaces (610.57.04, still present)

Open Awin-G opened this issue 3 months ago • 41 comments

NVIDIA Open GPU Kernel Modules Version

610.57.04 (git tag 610.57.04, commit e4a5faa), installed via Arch nvidia-open-dkms.

Confirm not proprietary driver

⚠️ NOT confirmed. This was observed with the open kernel driver only. The deadlock is in nvidia_modeset (nvkms) / nvidia_drm, code shared with the proprietary driver, so it likely affects the proprietary driver as well. I have not been able to test the proprietary driver on this machine.

OS / Kernel

  • OS: Arch Linux (rolling)
  • Kernel: 7.1.6-zen1-1-zen (freeze reproduced on 7.1.5-zen1-2-zen)
  • Stable release kernel (zen flavor, not a -rc)
  • Display server: GNOME Wayland

Hardware

  • GPU: NVIDIA GeForce RTX 4060 Laptop GPU (nvidia-smi -L)
  • Hybrid laptop: AMD Radeon 680M iGPU drives the internal panel (fbcon primary); the NVIDIA GPU drives an external HDMI monitor
  • CPU: AMD Ryzen 7 7735HS

Describe the bug

The display freezes during normal use; the desktop becomes unresponsive and never recovers — only a hard reboot (or SysRq) recovers. The system itself stays alive (SSH/background services keep running). First observed 2026-07-13, recurring across driver versions, and still present on the latest 610.57.04.

Kernel hung-task watchdog output, identical every occurrence:

INFO: task KMS thread:9236 blocked for more than 122 seconds.
      Tainted: G           OE       7.1.5-zen1-2-zen #1
task:KMS thread      state:D
  nvkms_ioctl_from_kapi_try_pmlock+0x4a/0xa0 [nvidia_modeset]
  ApplyModeSetConfig+0x169/0xda0 [nvidia_modeset]
  nv_drm_atomic_apply_modeset_config+0x7fb/0x920 [nvidia_drm]
  drm_atomic_check_only+0x5c4/0x9f0
  drm_atomic_commit+0x71/0xe0
  drm_mode_atomic_ioctl+0xdb8/0x1070
INFO: task KMS thread:9236 blocked on a semaphore likely last held by task nvidia-modeset/:591
task:nvidia-modeset/ state:R  running
  nvWriteGpEntry+0x10c/0x3e0 [nvidia_modeset]
  nvPushKickoff+0x2c/0x50
  PrefetchHelperSurfaceEvo+0x4df/0x6f0
  nvDIFRPrefetchSurfaces+0x158/0x240
  DifrPrefetchEventDeferredWork+0x16/0x30
  nvkms_kthread_q_callback+0xe6/0x170
  _main_loop+0x10e/0x160

The nvidia-modeset kthread spins (state R) holding the nvkms pmlock while the KMS thread waits forever on it → display deadlock.

To Reproduce

  1. Hybrid AMD+NVIDIA laptop, external monitor connected to the NVIDIA output (HDMI).
  2. Let the display auto-blank (GNOME PowerSaveMode / DPMS off).
  3. Freeze within ~minutes (sometimes immediately on blank/unblank).
  4. Also observed with screen-content capture (GNOME screenshot/screencast) and with several concurrent display clients (e.g. multiple terminal AI agents doing screen reads).
  5. Only a hard reboot recovers.

Bug Incidence

Sometimes (usually on display blank)

nvidia-bug-report.log.gz

Generated with nvidia-bug-report.sh for 610.57.04. I could not attach it through this form/API; the stack trace and environment above are the essential content. I can provide the file on request.

More Info

  • Workaround that fully avoids it: disable the display auto-blank (e.g. GNOME "Caffeine" extension always on). The freeze only occurs when a display modeset (blank) is performed on an NVIDIA-owned output.
  • The internal laptop panel is driven by the AMD iGPU; only the external HDMI monitor is NVIDIA-owned. Before switching the internal panel MUX away from the dGPU (独显直连 / discrete-direct), the freeze also occurred when the internal panel blanked.

Awin-G avatar Aug 11 '26 13:08 Awin-G

Clarification on the symptom: the screen does not go blank/black — the last rendered frame stays frozen on the display, the desktop is fully unresponsive (no input, no cursor), and only a hard reboot (or SysRq) recovers. "Blank" in the title refers to the trigger (DPMS off / PowerSaveMode modeset), not the symptom. This is consistent with the display-pipeline deadlock shown in the hung-task stack (KMS thread blocked on the pmlock while nvidia-modeset spins in nvWriteGpEntry).

Awin-G avatar Aug 11 '26 14:08 Awin-G

Update: stable reproduction + verified local mitigation

Two follow-ups — this turned out to be reliably reproducible, and locally mitigable.

Corrected reproduction recipe (my earlier "display blank" description was a misdiagnosis; the reliable trigger is resume-time display activity):

  1. Disable any idle inhibitor (e.g. the GNOME Caffeine extension).
  2. Connect an external monitor to the NVIDIA output (hybrid AMD+NVIDIA laptop: internal panel on AMD iGPU, external monitor on NVIDIA HDMI).
  3. Manually suspend → immediately resume → log back in.
  4. Within ~1–2 minutes of resume, perform display activity (e.g. drag a window onto the external monitor).
  5. Repeat. The freeze lands within a few rounds.

Confirmed hung-task stack (identical every occurrence):

KMS thread  state:D
  nvkms_ioctl_from_kapi_try_pmlock+0x4a/0xa0 [nvidia_modeset]
  ApplyModeSetConfig+0x169/0xda0 [nvidia_modeset]
  nv_drm_atomic_apply_modeset_config+0x7fb/0x920 [nvidia_drm]
nvidia-modeset/  state:R
  nvWriteGpEntry+0x10c/0x3e0 [nvidia_modeset]
  nvPushSetObject+0xb1/0x170
  nvPushKickoff+0x2c/0x50
  PrefetchHelperSurfaceEvo+0x4df/0x6f0
  nvDIFRPrefetchSurfaces+0x158/0x240
  DifrPrefetchEventDeferredWork+0x16/0x30
  _main_loop+0x10e/0x160

Root cause in code: nvWriteGpEntry() in src/common/unix/nvidia-push/src/nvidia-push.c contains an unbounded busy-wait:

while (nextGpPut == ReadGpGetOffset(push_buffer)) {
    if (nvPushCheckChannelError(push_buffer)) { ... return FALSE; }
}

When the DIFR prefetch CE channel stalls (GET never advances, e.g. while the display engine re-initializes after resume), this spins forever holding the nvkms pmlock, so the KMS thread's modeset blocks → permanent display freeze (system otherwise alive; only hard reboot recovers).

Local mitigation verified: I built a patch that bounds this wait to 1s only on the DIFR prefetch channel — added a boundedKickoff flag to NvPushChannelRec, set it in AllocDIFRPushChannel, and in nvWriteGpEntry time out (and return FALSE) only when boundedKickoff && !noTimeout. On timeout the prefetch fails and DIFR stays disabled, so the display no longer deadlocks. Result: the stall now logs nvWriteGpEntry: timed out waiting for GPFIFO space and the screen does not freeze — reproduced and caught 4/4 times, zero KMS thread blocked this boot. The change is scoped so the 3D/flip channels keep their original unbounded semantics.

This is a workaround, not a proper fix: the CE channel should not be left in a state where nvWriteGpEntry can wait forever. A proper fix would bound the wait with channel recovery on timeout, or fix the DIFR CE stall after resume.

Minor, possibly related: occasional 1–2 frame rendering artifacts (white→purple lines) while dragging windows, not the core issue.

Disclosure: The reproduction, root-cause analysis, and local mitigation patch for this report were produced almost entirely by an AI coding agent (DeepSeek V4 Flash model, running via the Claude Code harness) on the reporter's machine; the reporter performed the manual reproduction steps and hardware testing.

Awin-G avatar Aug 11 '26 17:08 Awin-G

Correction: the diff in my previous comment had a rendering artifact from the diff tool (a pre-existing return FALSE showed as inserted). Here is the clean, validated patch — it applies cleanly to pristine 610.57.04 (patch -p1) and produces byte-identical results to the tested build.

diff --git a/src/common/unix/nvidia-push/interface/nvidia-push-types.h b/src/common/unix/nvidia-push/interface/nvidia-push-types.h
--- a/src/common/unix/nvidia-push/interface/nvidia-push-types.h
+++ b/src/common/unix/nvidia-push/interface/nvidia-push-types.h
@@ -135,6 +135,7 @@
     NvBool          noTimeout                : 1;
     NvBool          ignoreChannelErrors      : 1;
     NvBool          channelErrorOccurred     : 1;
+    NvBool          boundedKickoff           : 1;
 
     NvU32           channelHandle[NV_MAX_SUBDEVICES];
     NvU32           pushbufferHandle;
diff --git a/src/nvidia-modeset/src/nvkms-difr.c b/src/nvidia-modeset/src/nvkms-difr.c
--- a/src/nvidia-modeset/src/nvkms-difr.c
+++ b/src/nvidia-modeset/src/nvkms-difr.c
@@ -434,6 +434,8 @@
         return FALSE;
     }
 
+    /* DIFR prefetch is best-effort; never let it hang the display stack. */
+    pDifr->prefetchPushChannel.boundedKickoff = TRUE;
 
     return TRUE;
 }
diff --git a/src/common/unix/nvidia-push/src/nvidia-push.c b/src/common/unix/nvidia-push/src/nvidia-push.c
--- a/src/common/unix/nvidia-push/src/nvidia-push.c
+++ b/src/common/unix/nvidia-push/src/nvidia-push.c
@@ -349,6 +349,7 @@
     NvU32 *gpPointer;
     const NvU32 entriesNeeded = NV_PUSH_NUM_GPFIFO_ENTRIES_PER_KICKOFF;
     NvPushDevicePtr pDevice = push_buffer->pDevice;
+    NvU64 kickoffDeadline;
 
     FillGpEntry(&push_buffer->main, putOffset, &gpEntry0, &gpEntry1);
 
@@ -358,12 +359,27 @@
 
     nvAssert((nextGpPut % 2) == 0);
 
-    // Wait for a free entry in the buffer
+    // Wait for a free entry in the buffer.  Channels flagged with
+    // boundedKickoff (currently only the DIFR prefetch channel) give up
+    // after 1s instead of waiting forever, so a stalled channel fails the
+    // kickoff rather than deadlocking the display stack.  All other
+    // channels keep the original unbounded semantics.
+    if (push_buffer->boundedKickoff && !push_buffer->noTimeout) {
+        kickoffDeadline = nvPushImportGetMilliSeconds(pDevice) + 1000;
+    }
     while (nextGpPut == ReadGpGetOffset(push_buffer)) {
         if (nvPushCheckChannelError(push_buffer)) {
             nvAssert(!"A channel error occurred in nvWriteGpEntry()");
             return FALSE;
         }
+        if (push_buffer->boundedKickoff && !push_buffer->noTimeout &&
+            nvPushImportGetMilliSeconds(pDevice) > kickoffDeadline) {
+            nvPushImportLogError(pDevice,
+                "nvWriteGpEntry: timed out waiting for GPFIFO space "
+                "(get=%u put=%u); aborting kickoff",
+                ReadGpGetOffset(push_buffer), push_buffer->gpPutOffset);
+            return FALSE;
+        }
     }
     gpPointer[0] = gpEntry0;
     gpPointer[1] = gpEntry1;

Awin-G avatar Aug 11 '26 17:08 Awin-G

Confirmed same bug family as these reports:

  • #1177 (Pop!_OS, RTX 5070, 580.159) — identical stack (nvWriteGpEntry → nvPushKickoff → PrefetchHelperSurfaceEvo → nvDIFRPrefetchSurfaces → DifrPrefetchEventDeferredWork), DPMS-triggered
  • #1205 (S3 resume, Blackwell mobile, 595.71) — soft lockup in the same DIFR prefetch path, "Always" on suspend/resume
  • #1167 (Arch, RTX 4090 Laptop, 595.71) — identical full stack (nvWriteGpEntry → nvPushSetObject/nvPushKickoff → PrefetchHelperSurfaceEvo → nvDIFRPrefetchSurfaces), freeze ~minutes after resume on hybrid dGPU external monitor
  • #1231 (KDE, AMD iGPU + RTX 4060 Laptop, 610.43) — hardware nearly identical to this report, DPMS wake deadlock

Common thread: nvidia-modeset spins in the unbounded while (nextGpPut == ReadGpGetOffset(...)) of nvWriteGpEntry during a DIFR prefetch, holding the nvkms pmlock → display deadlock. Spans GPUs RTX 4060 Laptop → RTX 5070/4090 and drivers 580→610, all triggered by resume/DPMS-wake display activity on hybrid setups.

The mitigation patch in this issue is scoped to the DIFR channel and verified locally (4/4 stalls caught, 0 KMS thread blocked). It should apply to the others if their hang is the nvWriteGpEntry path (confirmed for #1177/#1167; pending stack confirmation for #1205/#1231).

Awin-G avatar Aug 11 '26 17:08 Awin-G

Confirming this on 610.57.04, RTX 5070 Ti Mobile — identical stack, same trigger pattern (hybrid + external monitor + lock/unlock)

Version / OS

  • nvidia-driver-open 610.57.04-1ubuntu1 (Ubuntu CUDA repo, apt install nvidia-open)
  • OS: Ubuntu 26.04 LTS
  • Kernel: 7.0.0-29-generic (also reproduced on 7.0.0-14-generic)
  • Stable release kernel, not -rc

Hardware

  • GPU 0 (dGPU): NVIDIA GeForce RTX 5070 Ti Mobile (GB205M, 10de:2f58)
  • iGPU: Intel Arrow Lake-S (8086:7d67)
  • Hybrid laptop, internal panel (eDP-2) + external monitor on HDMI-1 connected to the NVIDIA output — same topology as this issue and #1231.

Describe the bug

Full desktop freeze (GNOME Wayland), no input, no cursor, only recoverable via hard power-off — SysRq unavailable. Two occurrences so far, both shortly after unlocking the session:

  • 2026-08-13 14:57 (first occurrence)
  • 2026-08-14 13:38–13:41 (second occurrence)

Both boots only started happening after the driver was auto-upgraded from 595.91.07 to 610.57.04 via the nvidia-open meta-package on 2026-08-13 — never observed on 595.91.07 before that.

Reproduction pattern

Matches the recipe in this issue almost exactly:

  1. Session locked (screen idle / gdm-password keyring lock).
  2. Unlock (gkr-pam: unlocked login keyring at 13:35:35).
  3. Freeze within ~3 minutes of unlock (13:38:49), with a second hung-task report at 13:40:52 as the same thread is still stuck.

Hung-task log (identical signature to the reports above)

INFO: task KMS thread:7872 blocked for more than 122 seconds.
      Tainted: G           OE       7.0.0-29-generic #29-Ubuntu
task:KMS thread      state:D
  nvkms_ioctl_from_kapi_try_pmlock+... [nvidia_modeset]
  ...
INFO: task KMS thread:7872 blocked on a semaphore likely last held by task nvidia-modeset/:536
task:nvidia-modeset/ state:R  running
  RIP: 0010:nvWriteGpEntry+0xf9/0x370 [nvidia_modeset]
  ...
  nvPushKickoff+0x28/0x50 [nvidia_modeset]
  PrefetchHelperSurfaceEvo+0x45c/0x650 [nvidia_modeset]
  nvDIFRPrefetchSurfaces+0x135/0x1f0 [nvidia_modeset]
  DifrPrefetchEventDeferredWork+0x16/0x30 [nvidia_modeset]
  nvkms_kthread_q_callback+0xe9/0x190 [nvidia_modeset]

Second report ~2 minutes later, same PID, same nvWriteGpEntry RIP (different offset — still spinning), confirming it's a livelock, not a one-off stall:

INFO: task KMS thread:7872 blocked for more than 245 seconds.
task:nvidia-modeset/ state:R  running
  RIP: 0010:nvWriteGpEntry+0x58/0x370 [nvidia_modeset]

gnome-shell also logged Could not release device '/dev/input/event0' (13,64): Timeout was reached while the KMS thread was stuck, consistent with the compositor being unable to proceed at all.

Notes

  • Checked NVIDIA's data-center release notes for 610.57.04 — no mention of this issue in "Known Issues," so it appears undocumented there (this is a GeForce/laptop hybrid config, may not be covered by that doc).
  • Ubuntu's nvidia-driver-open DKMS package ships nvidia-modeset/nv-modeset-kernel.o_binary as a precompiled blob (Kbuild symlinks it straight into nvidia-modeset.ko), so the source-level mitigation patch posted above can't be applied on top of the distro package without building the full open-gpu-kernel-modules tree from source ourselves — noting this in case it's useful context for anyone else on a distro-packaged build hitting the same wall.

Happy to test the patch from this thread against a from-source build if that would help narrow this down further, or to pull any additional logs.

broscr avatar Aug 14 '26 11:08 broscr

I can confirm what appears to be the same nvidia_modeset / DIFR deadlock on a different hybrid laptop configuration.

System

  • Laptop: Acer Predator PHN16-71
  • iGPU: Intel UHD Graphics 770 (Alder Lake-HX, i915)
  • dGPU: NVIDIA GeForce RTX 4060 Laptop GPU
  • OS: Fedora 44 KDE
  • Session: KDE Plasma / KWin Wayland
  • Kernel at time of freeze: 7.1.8-200.fc44.x86_64
  • NVIDIA driver / open kernel module: 610.57.04
  • Suspend mode: s2idle [deep], with deep selected
  • NVIDIA Runtime D3: enabled, fine-grained
  • nvidia-suspend.service, nvidia-resume.service and nvidia-hibernate.service: enabled

Trigger / behaviour

In my case the problem is strongly correlated with suspend/resume rather than only display blanking.

It has occurred multiple times, typically after approximately 2–3 deep suspend/resume cycles followed by continued normal desktop use with multiple applications open.

The resume itself succeeds and the system can continue working normally for some time. Eventually the entire graphical session freezes:

  • display stops updating
  • mouse and normal keyboard input stop working
  • Ctrl+Alt+F3 does not switch to a TTY
  • fans ramp up
  • Magic SysRq remains functional

On the latest occurrence I used SysRq w and l before rebooting with REISUB.

SysRq w: KWin blocked inside NVIDIA modesetting

The blocked task was kwin_wayland in uninterruptible sleep:

task:kwin_wayland    state:D

__schedule
schedule
schedule_timeout
___down_common
__down
down
nvkms_ioctl_from_kapi_try_pmlock [nvidia_modeset]
ApplyModeSetConfig [nvidia_modeset]
nv_drm_atomic_apply_modeset_config [nvidia_drm]
drm_atomic_check_only
drm_mode_atomic_ioctl
drm_ioctl_kernel
drm_ioctl

SysRq l: NVIDIA modeset thread stuck in DIFR prefetch

At the same time an nvidia-modeset/ kernel thread was active in:

nvWriteGpEntry [nvidia_modeset]
nvPushKickoff [nvidia_modeset]
PrefetchHelperSurfaceEvo [nvidia_modeset]
nvDIFRPrefetchSurfaces [nvidia_modeset]
DifrPrefetchEventDeferredWork [nvidia_modeset]
nvkms_kthread_q_callback [nvidia_modeset]
_main_loop [nvidia_modeset]

This looks essentially identical to the deadlock reported in this issue: KWin waits for the NVIDIA KMS lock while the nvidia-modeset thread is stuck in the DIFR prefetch path.

The rest of the CPUs were mostly idle according to the SysRq backtrace, and Magic SysRq remained fully responsive. REISUB successfully rebooted the machine.

I did not observe an NVIDIA Xid, OOM condition, thermal critical event or kernel panic preceding the freeze.

I have attached a sanitized kernel SysRq log containing the complete blocked-task and CPU backtraces:

nvidia-freeze-sysrq-public.log

I also generated a full nvidia-bug-report.log.gz immediately after reproducing the problem. I am not attaching that publicly for privacy reasons, but I can provide it privately to NVIDIA if useful.

The interesting additional data point here is that this reproduces the same apparent nvDIFRPrefetchSurfaces / nvWriteGpEntry deadlock on:

  • Intel + NVIDIA hybrid graphics instead of AMD + NVIDIA
  • Fedora 44 instead of Arch Linux
  • KDE/KWin Wayland instead of GNOME Wayland
  • repeated S3/deep suspend-resume cycles as the apparent trigger

Please let me know if there are additional traces, module parameters or debug data I can collect during another occurrence.

handkerchief333 avatar Aug 23 '26 08:08 handkerchief333

EDIT: The patch at #1286 fixes this for me locally.

Confirming the same DIFR-path livelock on another RTX 4090 Laptop system, with both the spinning lock holder and blocked KMS thread captured.

System

  • Lenovo ThinkPad P1 Gen 6
  • NVIDIA GeForce RTX 4090 Laptop GPU, Ada AD103M (10de:2717)
  • Fedora 44, GNOME Wayland
  • NVIDIA open kernel module 595.71.05
  • Kernel 7.1.8-200.fc44

Timeline

  • 10:59:01 — dock USB devices enumerated
  • 10:59:04 — PFM_REQ_HNDLR_STATE_SYNC_CALLBACK assertion
  • 10:59:05 — GNOME Shell recreated its GBM renderer for /dev/dri/card0
  • 10:59:40 — local CPU watcher detected nvidia-modeset PID 1426 in state R at 99% of one core
  • ~11:00:20 — display froze
  • 11:03:20–11:03:50 — SysRq W/L traces captured

Blocked KMS thread

task:KMS thread  state:D  pid:2308  tgid:2261
  __schedule
  schedule
  schedule_timeout
  ___down_common
  __down
  down
  nvkms_ioctl_from_kapi_try_pmlock+0x4a/0xa0 [nvidia_modeset]
  ApplyModeSetConfig+0x59e/0xba0 [nvidia_modeset]
  nv_drm_atomic_apply_modeset_config+0x49b/0x550 [nvidia_drm]
  drm_atomic_check_only
  drm_atomic_nonblocking_commit
  drm_mode_atomic_ioctl

Spinning NVIDIA modeset thread

CPU: 1  PID: 1426  Comm: nvidia-modeset/
RIP: nvWriteGpEntry+0xf0/0x370 [nvidia_modeset]
  nvPushKickoff+0x28/0x50
  PrefetchHelperSurfaceEvo+0x45c/0x650
  nvDIFRPrefetchSurfaces+0xb1/0x1f0
  DifrPrefetchEventDeferredWork+0x16/0x30
  nvkms_kthread_q_callback+0xdb/0x160
  _main_loop+0x112/0x170

A second SysRq L dump 27 seconds later captured the same PID in nvWriteGpEntry+0xa4/0x370, now on CPU 7, with the same stack pointer and relevant register values. This confirms sustained execution inside the nvWriteGpEntry() loop rather than a transient sample.

Released source indicates that the deferred callback holds the global nvkms_lock. Despite the nvkms_ioctl_from_kapi_try_pmlock name, the KMS thread successfully takes the shared PM read lock and then blocks in nvkms_ioctl_common() on down(&nvkms_lock).

This conclusively matches the livelock/deadlock signature reported here. It is also consistent with the GPFIFO-exhaustion theory in PR #1286, although these traces do not directly measure GP_GET/PUT or independently prove the preceding per-timeout ring leak.

CONFIG_DETECT_HUNG_TASK is disabled in Fedora’s kernel, so no automatic 122-second hung-task report was available. SysRq W/L/S/U remained functional; SysRq B did not reboot this machine during the hang.

I can provide a sanitized complete SysRq/kernel log if useful.

albanD avatar Aug 24 '26 15:08 albanD

Hi All,

I have filed a bug 6696638 internally for tracking purpose.

We will get back to you if required any additional information.

amrit1711 avatar Aug 31 '26 11:08 amrit1711

Confirming the same DIFR/NVKMS deadlock on different hardware and desktop environment.

System:

  • Acer Nitro ANV15-41
  • BIOS V1.18
  • AMD Ryzen 7 7735HS
  • AMD Radeon 680M iGPU
  • NVIDIA GeForce RTX 4050 Laptop GPU
  • NVIDIA driver 610.57.04 (open kernel module)
  • CachyOS
  • Linux 7.2.2-1-cachyos
  • KDE Plasma / KWin Wayland
  • Hybrid AMD/NVIDIA graphics
  • External monitor connected

I had previously experienced recurring full graphical freezes on Fedora 44 KDE/Wayland on this same machine. I installed CachyOS partly to determine whether the issue was Fedora-specific. The freeze has now reproduced on CachyOS as well.

During the CachyOS occurrence on 2026-09-02, the graphical session froze immediately after suspend/resume. The kernel and networking remained alive and I was able to investigate the machine over SSH while it was still frozen.

The resume timeline included:

09:10:22: amdgpu: SMU is resuming... amdgpu: SMU is resumed successfully!

09:10:23: PM: suspend exit kwin_wayland[1218]: Applying output configuration failed!

While the graphical session was still frozen, kwin_wayland PID 1218 was in uninterruptible sleep (D state).

Its kernel stack was:

nvkms_ioctl_from_kapi_try_pmlock ApplyModeSetConfig nv_drm_atomic_check drm_atomic_check_only drm_mode_atomic_ioctl

At the same time, the nvidia-modeset kernel thread (PID 284) was in R state.

Using SysRq 'l' over SSH while the system was still hung produced an NMI backtrace which captured that thread on CPU 6 in:

nvWriteGpEntry nvPushKickoff PrefetchHelperSurfaceEvo nvDIFRPrefetchSurfaces DifrPrefetchEventDeferredWork nvkms_kthread_q_callback _main_loop

Kernel diagnostics also reported the blocked KWin task as waiting on a semaphore likely last held by the nvidia-modeset thread.

This appears to be the same NVKMS PM-lock / DIFR deadlock described in this issue, reproduced here on an RTX 4050 Laptop GPU with KDE/KWin.

The fact that I previously experienced the same type of freezes on Fedora KDE on the same hardware also makes a Fedora-specific issue unlikely.

I also noticed PR #1286, which appears to address the same DIFR prefetch / nvWriteGpEntry hang:

https://github.com/NVIDIA/open-gpu-kernel-modules/pull/1286

I have NOT tested that patch, so I cannot confirm whether it fixes the issue on this system. This reproduction occurred with the unmodified NVIDIA 610.57.04 driver.

I captured an nvidia-bug-report.log.gz while the machine was still hung, as well as the complete kernel journal from the affected boot. The nvidia-bug-report script did not complete within 60 seconds, but it produced a report containing the blocked-task diagnostics and relevant traces.

The complete kernel journal from the affected boot is also available if useful, and I can perform additional tests if needed.

nvidia-bug-report.log.gz

henriquefortuna avatar Sep 04 '26 04:09 henriquefortuna

@henriquefortuna: could you check whether you still see this with 595.99.02? https://www.nvidia.com/en-us/drivers/details/278285/ That release contains a fix which I think will avoid the problem reported here.

aritger avatar Sep 04 '26 17:09 aritger

Can confirm the same deadlock on different hardware and config: System:

  • OS: Ubuntu 26.04.1 LTS (Resolute Raccoon) x86_64
  • Driver:
  • Kernel: Linux 7.0.0-31-generic
  • DE: GNOME 50.1
  • WM: Mutter (Wayland)
  • CPU: AMD Ryzen 7 9800X3D (16) @ 5.27 GHz
  • GPU 1: AMD Radeon Graphics [Integrated]
  • GPU 2: NVIDIA GeForce RTX 5070 Ti [Discrete]

I have been experiencing these issues for quite some time now. To replicate, simply putting the desktop in "suspend" for a long period of time and then opening an application, in this case 'Steam', will cause the entire desktop to freeze.

The Cause: nvidia-modeset became stuck inside nvWriteGpEntry -> nvDIFRPrefetchSurfaces while holding a lock. GNOME’s KMS thread then waited indefinitely, freezing the display.

Logs:

desktop kernel: INFO: task KMS thread:6791 blocked for more than 122 seconds.
desktop kernel: task:KMS thread      state:D stack:0     pid:6791  tgid:6759
desktop kernel:  down+0x5e/0x80
desktop kernel:  nvkms_ioctl_from_kapi_try_pmlock+0x55/0xc0 [nvidia_modeset]
desktop kernel:  ApplyModeSetConfig+0x59e/0xba0 [nvidia_modeset]
desktop kernel:  ? nv_drm_atomic_apply_modeset_config+0x80b/0x9c0 [nvidia_drm]
desktop kernel:  ? drm_atomic_check_only+0x199/0x420
desktop kernel:  ? drm_mode_atomic_ioctl+0x57e/0x910
desktop kernel: INFO: task KMS thread:6791 blocked on a semaphore likely last held by task nvidia-modeset/:527
desktop kernel: task:nvidia-modeset/ state:R  running task     stack:0     pid:527
desktop kernel: RIP: 0010:nvWriteGpEntry+0xbd/0x370 [nvidia_modeset]
desktop kernel:  ? nvPushKickoff+0x28/0x50 [nvidia_modeset]
desktop kernel:  ? PrefetchHelperSurfaceEvo+0x45c/0x650 [nvidia_modeset]
desktop kernel:  ? nvDIFRPrefetchSurfaces+0xb1/0x1f0 [nvidia_modeset]
desktop kernel:  ? DifrPrefetchEventDeferredWork+0x16/0x30 [nvidia_modeset]
desktop kernel:  ? _main_loop+0x99/0x160 [nvidia_modeset]

sdev138 avatar Sep 05 '26 22:09 sdev138

@aritger : Hi Andy,

I've now downgraded from 610.57.04 to 595.99.02 as requested.

I'm using the open kernel modules (nvidia-open-dkms), built for my current CachyOS kernel (7.2.2-1-cachyos). Both the loaded kernel module and userspace are now reporting 595.99.02:

$ uname -r 7.2.2-1-cachyos

$ nvidia-smi NVIDIA-SMI 595.99.02 Driver Version: 595.99.02

$ modinfo nvidia | grep '^version:' version: 595.99.02

The system booted normally and KDE/KWin Wayland is running normally so far.

I'll keep using the machine normally and exercise suspend/resume over the next few days. I'll report back whether the freeze reproduces.

If it does reproduce, I'll capture the live kernel stacks again over SSH/SysRq so we can check whether the nvidia-modeset / DIFR stack is still the same.

Thanks for pointing me to this release.

henriquefortuna avatar Sep 06 '26 01:09 henriquefortuna

I'd been having this issue on my laptop (as detailed here) and PR #1286 seems to have fixed it for the most part.

robert-burton avatar Sep 06 '26 21:09 robert-burton

Me and my codex have investigated this hanging for a while on my machine. Here is some text we created. I hope it helps and is not too lengthy: Additional reproduction on an RTX 2000 Ada laptop GPU. Captured traces show both the spinning DIFR worker and the blocked compositor during the same hang.

Configuration:

  • Dell Precision 7680, RTX 2000 Ada Laptop GPU
  • Fedora 44, kernel 7.1.13-200.fc44.x86_64
  • NVIDIA open driver 610.57.04
  • GNOME/Mutter 50.4, Wayland
  • Internal panel driven by Intel; external HDMI display driven by NVIDIA
  • Hardware cursors disabled using MUTTER_DEBUG_DISABLE_HW_CURSORS=1

Incident sample: The desktop froze, but the kernel and background logging continued operating. There were no recorded system suspend/resume events during this boot. NVIDIA runtime-power counters showed earlier runtime suspension; the GPU was runtime-active when captured.

Three SysRq CPU backtraces, one second apart, caught the same NVIDIA worker in: nvWriteGpEntry+0xfc/0x370 nvWriteGpEntry+0xa4/0x370 nvWriteGpEntry+0x58/0x370

All three shared this call chain: nvPushKickoff PrefetchHelperSurfaceEvo nvDIFRPrefetchSurfaces DifrPrefetchEventDeferredWork nvkms_kthread_q_callback _main_loop

The simultaneous blocked-task dump showed GNOME’s KMS thread waiting in: down nvkms_ioctl_from_kapi_try_pmlock+0x4a/0xa0 ApplyModeSetConfig+0x60a/0xc70 nv_drm_atomic_apply_modeset_config drm_atomic_check_only drm_atomic_nonblocking_commit drm_mode_atomic_ioctl

Disassembly of the installed module identifies the semaphore acquisition at +0x4a as nvkms_lock.

The worker’s registers and disassembly also indicate the ring-space retry condition: a 16-entry ring, current PUT position 0, next PUT position 2, and decoded GET position 2. The samples retain the same push- buffer and stack pointers.

This appears to match #1246 and the failure mechanism addressed by PR #1286. It establishes the blocking mechanism, but does not identify why the channel stopped progressing initially.

Questions:

  1. Is the DIFR lifecycle fix in 615.71.09 expected to address this case without system suspend? I have not tested that version yet.
  2. What additional tracing would help identify the initial channel stall, particularly around runtime-power transitions?
  3. Is there a supported workaround for this path while the timeout/recovery changes in #1286 remain pending?

Below is a graphics hang diagnostic excerpt: Only the blocked KMS kernel stack and three NVIDIA worker samples are retained. Host/date/time, process IDs, unrelated tasks, network events and hardware/BIOS lines omitted. Absolute kernel addresses replaced consistently with <ptr_N>; scalar register values retained. Sample labels preserve the one-second spacing. Kernel: 7.1.13-200.fc44.x86_64.

Blocked KMS thread (sample 1): task:KMS thread state:D Call Trace: __schedule+0x2c4/0x710 schedule+0x27/0xa0 schedule_timeout+0xdc/0x120 ___down_common+0xd2/0x1f0 __down+0x26/0xe0 down+0x47/0x60 nvkms_ioctl_from_kapi_try_pmlock+0x4a/0xa0 [nvidia_modeset] ApplyModeSetConfig+0x60a/0xc70 [nvidia_modeset] nv_drm_atomic_apply_modeset_config+0x57d/0x640 [nvidia_drm] ? nv_drm_plane_atomic_check+0x123/0x590 [nvidia_drm] drm_atomic_check_only+0x197/0x400 drm_atomic_nonblocking_commit+0x17/0x70 drm_mode_atomic_ioctl+0x571/0x8b0 ? __pfx_drm_mode_atomic_ioctl+0x10/0x10 drm_ioctl_kernel+0xae/0x100 drm_ioctl+0x2d9/0x560 ? __pfx_drm_mode_atomic_ioctl+0x10/0x10 __x64_sys_ioctl+0xb9/0x100 do_syscall_64+0xe2/0x560 ? __x64_sys_ppoll+0xf3/0x180 ? arch_exit_to_user_mode_prepare.isra.0+0x84/0xa0 ? do_syscall_64+0x11f/0x560 ? ksys_read+0xdd/0x110 ? do_syscall_64+0x11f/0x560 ? __x64_sys_ppoll+0xf3/0x180 ? do_syscall_64+0x11f/0x560 ? do_syscall_64+0x11f/0x560 ? ksys_write+0xdd/0x110 ? do_syscall_64+0x11f/0x560 ? do_syscall_64+0x11f/0x560 ? do_syscall_64+0x11f/0x560 ? do_syscall_64+0x99/0x560 entry_SYSCALL_64_after_hwframe+0x76/0x7e [userspace registers omitted]

NVIDIA worker sample 1 (t+0s; same worker): RIP: 0010:nvWriteGpEntry+0xfc/0x370 [nvidia_modeset] Code: 2e 2e ff d2 80 0b 10 48 83 c4 28 44 89 f8 5b 5d 41 5c 41 5d 41 5e 41 5f c3 0f 1f 44 00 00 48 8b 83 10 01 00 00 8b 38 c1 ef 12 <01> ff 39 fd 74 a2 48 8b 7c 24 08 44 89 f2 43 8d 04 12 48 03 54 24 RSP: 0018:<ptr_1> EFLAGS: 00000202 RAX: <ptr_2> RBX: <ptr_3> RCX: <ptr_4> RDX: <ptr_5> RSI: 0000000000000344 RDI: 0000000000000001 RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000010 R12: <ptr_6> R13: 0000000000000344 R14: 00000000000002dc R15: 0000000000000000 Call Trace: nvPushKickoff+0x28/0x50 [nvidia_modeset] PrefetchHelperSurfaceEvo+0x45c/0x650 [nvidia_modeset] nvDIFRPrefetchSurfaces+0x135/0x1f0 [nvidia_modeset] DifrPrefetchEventDeferredWork+0x16/0x30 [nvidia_modeset] nvkms_kthread_q_callback+0xdb/0x160 [nvidia_modeset] _main_loop+0x112/0x170 [nvidia_modeset] ? __pfx__main_loop+0x10/0x10 [nvidia_modeset] kthread+0xe4/0x120 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x1a1/0x270 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30

NVIDIA worker sample 2 (t+1s; same worker): RIP: 0010:nvWriteGpEntry+0xa4/0x370 [nvidia_modeset] Code: 10 01 00 00 8b 00 c1 e8 12 01 c0 41 29 c0 43 8d 14 03 41 0f 49 d0 39 f2 7c 04 89 d6 89 c7 83 c1 01 44 39 c9 75 d0 39 fd 75 5e <44> 0f b6 3b 41 83 e7 08 75 aa 48 8b 93 80 01 00 00 0f b7 42 0e 66 RSP: 0018:<ptr_1> EFLAGS: 00000246 RAX: <ptr_2> RBX: <ptr_3> RCX: <ptr_4> RDX: <ptr_5> RSI: 0000000000000344 RDI: 0000000000000002 RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000010 R12: <ptr_6> R13: 0000000000000344 R14: 00000000000002dc R15: 0000000000000000 Call Trace: nvPushKickoff+0x28/0x50 [nvidia_modeset] PrefetchHelperSurfaceEvo+0x45c/0x650 [nvidia_modeset] nvDIFRPrefetchSurfaces+0x135/0x1f0 [nvidia_modeset] DifrPrefetchEventDeferredWork+0x16/0x30 [nvidia_modeset] nvkms_kthread_q_callback+0xdb/0x160 [nvidia_modeset] _main_loop+0x112/0x170 [nvidia_modeset] ? __pfx__main_loop+0x10/0x10 [nvidia_modeset] kthread+0xe4/0x120 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x1a1/0x270 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30

NVIDIA worker sample 3 (t+2s; same worker): RIP: 0010:nvWriteGpEntry+0x58/0x370 [nvidia_modeset] Code: 48 89 44 24 10 4c 8b a7 98 01 00 00 41 8d 43 ff 41 8d 6a 02 21 c5 48 8b 87 b8 00 00 00 45 8b 4c 24 10 48 89 44 24 08 0f 1f 00 <41> 83 f9 01 0f 86 8e 00 00 00 31 ff 31 f6 31 c9 0f 1f 84 00 00 00 RSP: 0018:<ptr_1> EFLAGS: 00000213 RAX: 0000000000000000 RBX: <ptr_3> RCX: <ptr_4> RDX: <ptr_5> RSI: 0000000000000344 RDI: 0000000000000002 RBP: 0000000000000002 R08: 0000000000000000 R09: 0000000000000001 R10: 0000000000000000 R11: 0000000000000010 R12: <ptr_6> R13: 0000000000000344 R14: 00000000000002dc R15: 0000000000000000 Call Trace: nvPushKickoff+0x28/0x50 [nvidia_modeset] PrefetchHelperSurfaceEvo+0x45c/0x650 [nvidia_modeset] nvDIFRPrefetchSurfaces+0x135/0x1f0 [nvidia_modeset] DifrPrefetchEventDeferredWork+0x16/0x30 [nvidia_modeset] nvkms_kthread_q_callback+0xdb/0x160 [nvidia_modeset] _main_loop+0x112/0x170 [nvidia_modeset] ? __pfx__main_loop+0x10/0x10 [nvidia_modeset] kthread+0xe4/0x120 ? __pfx_kthread+0x10/0x10 ret_from_fork+0x1a1/0x270 ? __pfx_kthread+0x10/0x10 ret_from_fork_asm+0x1a/0x30

GurraD avatar Sep 10 '26 16:09 GurraD

I’m seeing a likely related failure on CachyOS with KDE Plasma/KWin Wayland and NVIDIA open driver 610.57.04 (RTX 3060 Ti, kernel 7.2.3-1-cachyos, two Dell S2721QS displays at 3840×2160@60). After locking the session and returning about 85 minutes later, the displays were blank and the pointer was frozen; recovery required a hardware power reset.

Previous-boot journal: at 16:19:20, kscreenlocker_greet repeatedly logged eglSwapBuffers failed with 0x3000/0x3003, alongside repeated [nvidia_drm] Failed to allocate NVKMS memory for GEM object; the same NVKMS error had already occurred at 10:31 during a Chromium/Flatpak GBM allocation and at 14:33. At 17:44:10, plasmalogin logged tty "tty1" already in use ... active ... KDE, started a second Wayland session on VT2, the existing kwin_wayland logged atomic commit failed: Permission denied, and ksplashqml failed to create an EGL surface. The previous boot ended without a normal shutdown; no OOM, Xid, or kernel-panic entry was recorded.

This looks like an NVKMS/KMS/Wayland blank-wake failure, possibly related to the DIFR/KMS deadlock family. I have not reproduced it with the proprietary driver and did not capture nvidia-bug-report.sh during the hang because the machine required a hard reset. Any guidance on the minimal capture or safe workaround would be appreciated.

ccueto36 avatar Sep 14 '26 22:09 ccueto36

Same deadlock shape as this thread, but the spinning thread is in the DisplayPort link-training path talking to GSP, not DIFR prefetch. Desktop Ada, single NVIDIA GPU driving the display. Posting it here since the lock topology and outcome are identical, and it may or may not be the same root cause — happy to move it to its own issue if you'd prefer.

Environment

  • GPU: GeForce RTX 4070 Ti SUPER (AD103, 10de:2705), desktop
  • Driver: nvidia-open-dkms 615.71.09, nvidia_drm.modeset=1, nvidia_drm.fbdev=1
  • Kernel: 7.3.0-rc2-1-cachyos-rc (clang 22.1.8) — this is an -rc kernel, so I understand it doesn't satisfy the report requirements. I'm posting it as corroborating evidence rather than a formal report. I've also seen this on a stable kernel but did not capture the trace then, and the journal from that occurrence has since rotated away. I'm now running with a stable kernel installed alongside and larger journal retention to catch the next one properly.
  • OS: CachyOS (Arch-based), KDE Plasma 6.7.5 / KWin 6.7.5, Wayland
  • Also present: sched_ext with the lavd scheduler enabled — it shows up in the task dumps, noting it for completeness in case it matters
  • Display: Samsung Odyssey G8 on DisplayPort, active mode 3840x2160@240, HDR and wide color gamut enabled, VRR off. The connector reports a maximum of 10 bpc. At 240 Hz that's roughly 57 Gbps of RGB payload at 8 bpc (71 Gbps at 10 bpc) against HBR3 x4's 25.92 Gbps, so DSC is mandatory for this mode either way. The iGPU (Radeon on a 9800X3D) is present but drives nothing — all of its outputs read disconnected.

Trigger

Physically powering the monitor on. Not DPMS, not suspend/resume, not logout.

Worth flagging because the workaround in this thread — disabling display auto-blank — does not apply to me. KDE's blanking was already fully off before either occurrence:

TurnOffDisplayWhenIdle=false
TurnOffDisplayIdleTimeoutSec=-1
DimDisplayWhenIdle=false

So the only modeset trigger left on this machine is the monitor's own power button, and that's enough to hit it.

What the journal shows

The DRM hotplug lands at 01:51:19 (via powerdevil's ddcutil logging, which is what happened to be watching udev):

prop_subsystem:  drm
prop_action:     change
prop_devname:    /dev/dri/card1
prop_hotplug:    1
syspath:         /sys/devices/pci0000:00/0000:00:01.1/0000:01:00.0/drm/card1

kwin_wayland enters a modeset and never leaves. The hung-task report at 01:53:26 is the last line the machine ever wrote — no shutdown sequence follows, next boot is a cold start at 01:54:08. Fully wedged, hard reset required.

The Sched_ext line in the dump pins the causal link tightly: runnable_at=-126968ms against a report timestamp of 01:53:26.573 puts the start of the spin at 01:51:19.605, which is 595 ms after the hotplug uevent at 01:51:19.010. So the GPU went unrecoverable within a second of the monitor announcing itself, inside the modeset that hotplug triggered.

nvidia-modeset blocked in D:

INFO: task nvidia-modeset/:226 blocked for more than 122 seconds.
task:nvidia-modeset/ state:D stack:0 pid:226 tgid:226 ppid:2
Sched_ext: lavd_1.1.3 (enabled+all), task: runnable_at=-126968ms
Call Trace:
 __schedule+0x5df/0x1860
 schedule+0x6f/0xb0
 schedule_timeout+0x31/0x130
 ? nvkms_ioctl_from_kapi+0xb1/0xd0 [nvidia_modeset]
 __down_common+0x12e/0x2a0
 down+0x4d/0x60
 nvkms_kthread_q_callback+0xdb/0x170 [nvidia_modeset]
 _main_loop+0xbd/0x140 [nvidia_modeset]
 kthread+0xfd/0x130
 ret_from_fork+0xee/0x270

And the holder — kwin_wayland in state R, spinning, not sleeping:

INFO: task nvidia-modeset/:226 blocked on a semaphore likely last held by task kwin_wayland:1088
task:kwin_wayland state:R running task stack:0 pid:1088 tgid:1088 ppid:1080
Call Trace:
 ? osDevReadReg032+0x23/0x70 [nvidia]
 ? _regRead+0x113/0x140 [nvidia]
 ? msgqRxGetReadBuffer+0x4c/0xb0 [nvidia]
 ? crashcatEngineGetNextCrashReport_IMPL+0x39/0xb0 [nvidia]
 ? GspMsgQueueReceiveStatus+0x8a/0x480 [nvidia]
 ? kgspHealthCheck_TU102+0x54/0x350 [nvidia]
 ? _kgspRpcDrainEvents+0x1c32/0x1c90 [nvidia]
 ? kdispApplyAggressiveVblankHandlingWar_IMPL+0x3f/0x140 [nvidia]
 ? kgspRecvPoll_IMPL+0x19c/0x8a0 [nvidia]
 ? kgspRecvPoll_IMPL+0x1ee/0x8a0 [nvidia]
 ? _issueRpcAndWait+0x5a2/0x800 [nvidia]
 ? rmDeviceGpuLockIsOwner+0x1e/0x60 [nvidia]
 ? rpcRmApiControl_GSP+0x435/0x710 [nvidia]
 ? serverControl+0x446/0x4a0 [nvidia]
 ? rmapiControlWithSecInfo+0x474/0x7a0 [nvidia]
 ? _nv04Control+0x101/0x120 [nvidia]
 ? nvkms_call_rm+0x4e/0x80 [nvidia_modeset]
 ? nvRmApiControl+0x74/0x90 [nvidia_modeset]
 ? DisplayPort::EvoMainLink::train(DisplayPort::LinkTrainParameters const&)+0x330/0x9c0 [nvidia_modeset]
 ? DisplayPort::ConnectorImpl::rawTrain(...)+0xf3/0x1d0 [nvidia_modeset]
 ? DisplayPort::ConnectorImpl::enableFlush()+0x2ac/0x3b0 [nvidia_modeset]
 ? DisplayPort::ConnectorImpl::train(...)+0x312/0x770 [nvidia_modeset]
 ? DisplayPort::ConnectorImpl::trainLinkOptimized(DisplayPort::LinkConfiguration)+0x1336/0x1500 [nvidia_modeset]
 ? DisplayPort::ConnectorImpl::ensureMstNodesPoweredUp(DisplayPort::Group*)+0x212/0x320 [nvidia_modeset]
 ? DisplayPort::ConnectorImpl::notifyAttachBegin(...)+0x8df/0xfe0 [nvidia_modeset]
 ? DisplayPort::ConnectorImpl::dpPreModeset(...)+0xd7/0x1a0 [nvidia_modeset]
 ? nvDPPreSetMode+0x144/0x250 [nvidia_modeset]
 ? KickoffModesetUpdateState+0xe8/0x220 [nvidia_modeset]
 ? nvSetDispModeEvo+0x3da8/0x4b50 [nvidia_modeset]
 ? nvKmsIoctl+0xdc/0x1b0 [nvidia_modeset]
 ? nvkms_ioctl_from_kapi_try_pmlock+0x4b/0x80 [nvidia_modeset]
 ? ApplyModeSetConfig+0xd44/0xf20 [nvidia_modeset]
 ? nv_drm_atomic_commit+0x584/0xab0 [nvidia_drm]
 ? drm_atomic_commit+0xc3/0xf0
 ? drm_mode_atomic_ioctl+0x653/0xcb0
 ? drm_ioctl+0x36c/0x500
 ? __x64_sys_ioctl+0x76/0xc0
 ? do_syscall_64+0x100/0x360
 ? entry_SYSCALL_64_after_hwframe+0x76/0x7e

How this differs from the DIFR reports above

The lock topology and the user-visible outcome are the same as #1289 — one thread spins in R holding the NVKMS lock, everything else piles up behind it, only a hard reset recovers. But the spin site is different:

  • #1289 and friends: nvDIFRPrefetchSurfaces → PrefetchHelperSurfaceEvo → nvPushKickoff → nvWriteGpEntry, spinning on a GPFIFO GET pointer that never advances. Best-effort prefetch work, arriving via a deferred work callback.
  • This report: synchronous DP link training inside the atomic commit itself. trainLinkOptimized issues an RM control that goes over RPC to GSP, GSP stops answering, and RM ends up in kgspRecvPoll_IMPL → kgspHealthCheck_TU102 → crashcatEngineGetNextCrashReport_IMPL.

That last frame is the interesting part: RM had already given up on a normal reply and was attempting to pull a crash report out of GSP. So by the time we're spinning, RM believes the firmware is unhealthy. It's doing that health check and crash-report retrieval while holding the GPU lock and the NVKMS semaphore, on the ioctl thread, with no bound — so a firmware-side failure gets converted into an unrecoverable full-system display deadlock.

Two things that might be worth separating regardless of what upset GSP:

  1. kgspRecvPoll / kgspHealthCheck / crash-report retrieval running unbounded under the GPU lock on the modeset ioctl path. If the poll bailed out with an error instead, the modeset would fail and KWin would survive.
  2. crashcatEngineGetNextCrashReport_IMPL being reached at all suggests a GSP-side fault preceding the hang. No NVIDIA Xid appears anywhere in that boot's journal, so nothing surfaced to userspace about it. (I can only state that for the 01:53 boot — the earlier occurrence's journal has rotated away.)

I've enabled NVreg_EnableGpuFirmwareLogs=2 to try to capture the GSP side on the next occurrence, and I'll follow up if I get it.

Frequency

Twice in about 12 hours of uptime, both on monitor power-on, both requiring a hard reset. The earlier one (2026-09-15 14:09) additionally logged:

nvidia-modeset: ERROR: GPU:0: SLI raster lock timeout exceeded

and repeated hung-task reports out to 1228 seconds before hung_task_warnings suppressed them. That boot's journal has since rotated out, so I only have the 01:53 occurrence in full.

Attached

  • hang-window.log — the last few minutes of the wedged boot, from hotplug to final line
  • boot-d0801014-full.log — the complete boot
  • nvidia-bug-report.log.gz — generated after the reboot, so it reflects a healthy GPU, not the wedged state. The machine was completely unresponsive during the hang so there was no way to collect it in situ.

boot-d0801014-full.log nvidia-bug-report.log.gz hang-window.log

kzorin52 avatar Sep 16 '26 00:09 kzorin52

Seeing what looks like the same failure on a desktop AD106 with two 4K DisplayPort outputs.

Environment

  • RTX 4060 Ti 16 GB (AD106), 2× 4K DP @ 60 Hz, GNOME 46 Wayland, 150% fractional scaling
  • Ubuntu 24.04, kernel 7.0.0-31-generic
  • Driver 580.173.02, reproduced with both open and proprietary kernel modules
  • GSP firmware active

Symptom

Both displays freeze during ordinary use — frequently while switching windows. Captured live during a freeze:

DP-2, DP-3:   status=connected, dpms=On, enabled=enabled
gnome-shell:  Ssl  wchan=poll_schedule_timeout  1.0% CPU
mutter D-Bus Peer.Ping:  ()          <- responds normally
nvidia-smi:   responds; 48% util at P8 / 12 W with an idle desktop

So the compositor is alive and idle — asleep in poll, apparently waiting on a page-flip completion that never arrives — the connectors never dropped, and the GPU answers queries. Only scanout is wedged.

Ctrl+Alt+F3 does not switch VT during the freeze, which fits: a VT switch needs a modeset, and modesets are what's broken. The only recovery is power-cycling a monitor, which forces a link retrain and resets the display engine. systemctl restart gdm also recovers it.

Xid 56 (display engine) bursts appear before some freezes but not all:

NVRM: Xid (PCI:0000:05:00): 56, CMDre 00000000 00002c88 000100d2 00000007 00000000
NVRM: Xid (PCI:0000:05:00): 56, CMDre 00000000 00002c8c 000100d2 00000007 00000000

Several freezes produced no Xid at all, so it isn't a reliable marker.

Ruled out: open vs proprietary modules (both affected), GSP disabled vs enabled, DP link loss (connectors stay connected throughout), and compositor hang (mutter answers D-Bus and is idle, not spinning).

tomaszstachera avatar Sep 27 '26 18:09 tomaszstachera

Confirm on 615.78.08 — the suspend-scoped fix does not cover the non-suspend path

Confirming this still reproduces on 615.78.08, which is newer than the releases @aritger listed as containing the fix (595.99.02 / 595.104.02 / 615.71.09). In my case the DIFR teardown/realloc change is present in the shipped source, yet the deadlock still happens — and, importantly, the system never suspended. The freeze was triggered by a plain DPMS / PowerSaveMode modeset, so the suspend-scoped fix does not appear to cover this path.

Environment

  • OS: Arch Linux (rolling)
  • Kernel: 7.2.9-zen1-1-zen (stable zen, not -rc)
  • Driver: nvidia-open-dkms 615.78.08-1, nvidia-utils 615.78.08-1
  • Compositor: GNOME 51.0 / Mutter 51.0 (Wayland)
  • GPU: NVIDIA GeForce RTX 4060 Laptop GPU (AD107M) + Intel Raptor Lake-S UHD Graphics (hybrid)
  • Displays: internal eDP panel driven by the Intel iGPU; external HDMI monitor driven by the NVIDIA GPU
  • nvidia_drm.modeset=Y, nvidia_drm.fbdev=Y

The fix is present in 615.78.08

$ grep -n 'nvDIFRAllocate\|nvDIFRFree' src/nvidia-modeset/src/nvkms-evo.c
5474:    pDevEvo->pDifrState = nvDIFRAllocate(pDevEvo);
5477:            nvDIFRFree(pDevEvo->pDifrState);
5487:        nvDIFRFree(pDevEvo->pDifrState);

The machine never suspended

The affected boot ran from 09:25 until the freeze at 13:21 and the forced power-off at 13:56 with zero suspend/resume events:

$ journalctl -b -1 | grep -icE 'PM: suspend|systemd-suspend|Reached target Sleep|suspend entry|suspend exit|ACPI: PM: Preparing'
0

Auto-suspend and auto-blank were both disabled (sleep-inactive-ac-type = 'nothing', idle-delay = 0).

Trigger: a plain DPMS modeset

13:21:51 at-spi2-registryd: Disabling unresponsive app with pid 4046   <- gnome-shell
13:21:51 gsd-power: Error setting property 'PowerSaveMode' on interface
         org.gnome.Mutter.DisplayConfig: timed out

The hung-task watchdog then fired every ~123 s, from 122 s up to 1228 s, after which the kernel suppressed further reports.

Stack (identical shape to the report in this thread)

INFO: task KMS thread:4063 blocked for more than 860 seconds.
      Tainted: G           OE       7.2.9-zen1-1-zen #1
task:KMS thread      state:D stack:0     pid:4063  tgid:4046  ppid:899
Call Trace:
 <TASK>
 __schedule+0x402/0x1700
 schedule+0x27/0xa0
 schedule_timeout+0xdc/0x120
 __down_common+0xff/0x3e0
 down+0x53/0x70
 nvkms_ioctl_from_kapi_try_pmlock+0x4a/0xa0 [nvidia_modeset]
 ApplyModeSetConfig+0x174/0xe30 [nvidia_modeset]
 nv_drm_atomic_apply_modeset_config+0x878/0x990 [nvidia_drm]
 drm_atomic_check_only+0x5b4/0x9e0
 drm_atomic_commit+0x71/0xe0
 drm_mode_atomic_ioctl+0xe44/0x1150
 drm_ioctl_kernel+0xae/0x100
 drm_ioctl+0x2d8/0x530
 __x64_sys_ioctl+0xb9/0xf0
 do_syscall_64+0xaa/0x660
 </TASK>
INFO: task KMS thread:4063 blocked on a semaphore likely last held by task nvidia-modeset/:395
task:nvidia-modeset/ state:R  running task     pid:395   tgid:395  ppid:2
Call Trace:
 <TASK>
 ? sysvec_apic_timer_interrupt+0xe/0x90
 ? nvWriteGpEntry+0x40/0x3f0 [nvidia_modeset]
 ? nvPushSetObject+0xb1/0x170 [nvidia_modeset]
 ? nvPushKickoff+0x2c/0x50 [nvidia_modeset]
 ? PrefetchHelperSurfaceEvo+0x4df/0x700 [nvidia_modeset]
 ? nvDIFRPrefetchSurfaces+0x155/0x240 [nvidia_modeset]
 ? DifrPrefetchEventDeferredWork+0x16/0x30 [nvidia_modeset]
 ? nvkms_kthread_q_callback+0xe6/0x170 [nvidia_modeset]
 ? _main_loop+0x10e/0x160 [nvidia_modeset]
 </TASK>

System stayed alive

Background services kept logging normally for the whole 35 minutes; only the display pipeline was dead. Recovery required a hard power-off — the journal contains no systemd shutdown sequence.

Notes

  • The stack is the nvWriteGpEntry busy-wait, i.e. the same deficiency analysed in #1286 — so the GPFIFO-exhaustion failure mode is still reachable on 615.78.08 outside the suspend path.
  • As a stop-gap I am applying the #1286 changes locally. They still apply cleanly to the shipped 615.78.08 sources (7/7 hunks pass patch -p1 --dry-run).

Question

Is there a separate tracking item for the non-suspend trigger path (plain DPMS blank / modeset), or is the expectation that the suspend-time teardown also covers it? If the latter, this report suggests it does not.

CLICGGER-TYPES avatar Oct 12 '26 06:10 CLICGGER-TYPES

Same deadlock on 595.99.02 (contains the suspend/resume DIFR fix): no suspend, DPMS-triggered, RTX 5070 Laptop

This reproduces on 595.99.02, which @aritger listed as containing the DIFR teardown/realloc fix. The system had not suspended at all during the affected boot (journalctl -b -1 -g 'PM: suspend' returns no entries, uptime ~24h). The trigger was a GNOME screen-blank PowerSaveMode modeset. That matches the non-suspend path reported above on 615.78.08.

Environment

  • Laptop: MSI Raider A16 HX B8WH (BIOS E265KAMS.305, 2026-04-27)
  • dGPU: GeForce RTX 5070 Laptop GPU [10de:2f18] (Blackwell)
  • iGPU: AMD Raphael [1002:164e], amdgpu, drives the internal eDP panel
  • Driver: nvidia-driver-595-open 595.99.02-0ubuntu0.24.04.1 (open kernel module)
  • Kernel: 7.0.0-38-generic (Ubuntu 24.04.5 LTS, HWE)
  • Desktop: GNOME Shell 46.0, Wayland
  • Module options: nvidia_drm modeset=1, NVreg_PreserveVideoMemoryAllocations=1
  • Topology: internal panel on the iGPU (card2-eDP-2), external 1920x1080 monitor on the dGPU (card1-HDMI-A-1)

On this laptop, every external output is wired to the dGPU: HDMI, and both USB-C ports (card1-DP-1 and card1-DP-2, behind an ASMedia USB4 controller). The iGPU's DP connectors are not routed to any physical port. So moving the external monitor to the iGPU is not possible as a workaround.

Timeline (previous boot)

17:20 - 17:31  nvidia 0000:01:00.0: Enabling HDA controller   (repeated, roughly every 15-60 s: runtime PM cycling)
17:32:34       gsd-power: Error setting property 'PowerSaveMode' on interface org.gnome.Mutter.DisplayConfig: timeout
17:36:05       INFO: task KMS thread:5336 blocked for more than 122 seconds.
...            (repeats until 860+ s; the desktop never recovers)

The kernel, SSH and networking stayed alive. No Xid errors and no NVRM: errors were logged. Unplugging the HDMI cable did not update card1-HDMI-A-1/status (it stayed connected), so hotplug handling on the NVIDIA side was also stuck. Only a reboot recovered.

Stacks

Waiter (gnome-shell KMS thread, PID 5336, TGID 5299):

task:KMS thread      state:D stack:0     pid:5336  tgid:5299  ppid:2028
 __schedule+0x2d0/0x660
 schedule+0x27/0xb0
 schedule_timeout+0x104/0x110
 ___down_common+0x14c/0x200
 __down_common+0x5a/0x150
 __down+0x1d/0x30
 down+0x60/0x80
 nvkms_ioctl_from_kapi_try_pmlock+0x57/0xc0 [nvidia_modeset]
 ApplyModeSetConfig+0x357/0xba0 [nvidia_modeset]
 ? nv_drm_atomic_apply_modeset_config+0x80e/0xa20 [nvidia_drm]
 ? nv_drm_atomic_check+0x13b/0x160 [nvidia_drm]
 ? drm_atomic_commit+0x6e/0xf0
 ? drm_mode_atomic_ioctl+0x58d/0x8a0
 ? drm_ioctl+0x2ec/0x5b0
 ? nv_drm_ioctl+0x43/0x3f0 [nvidia_drm]
INFO: task KMS thread:5336 blocked on a semaphore likely last held by task nvidia-modeset/:899

Holder (spinning, state R):

task:nvidia-modeset/ state:R  running task     stack:0     pid:899   tgid:899   ppid:2
 ? nvWriteGpEntry+0xfc/0x370 [nvidia_modeset]
 ? nvPushKickoff+0x28/0x50 [nvidia_modeset]
 ? PrefetchHelperSurfaceEvo+0x45c/0x650 [nvidia_modeset]
 ? nvDIFRPrefetchSurfaces+0x135/0x1f0 [nvidia_modeset]
 ? DifrPrefetchEventDeferredWork+0x16/0x30 [nvidia_modeset]
 ? nvkms_kthread_q_callback+0xed/0x1b0 [nvidia_modeset]
 ? _main_loop+0x9c/0x170 [nvidia_modeset]
 ? kthread+0xfb/0x140

This is the same nvWriteGpEntry / nvDIFRPrefetchSurfaces livelock as in this issue, #1246 and #1205. It is another data point that the suspend-scoped fix in 595.99.02 does not cover the idle/DPMS path. A bounded wait on the DIFR prefetch channel (as in #1286 or the patch earlier in this issue) would avoid the permanent display freeze. Happy to provide an nvidia-bug-report.log or to test a fix.

shikamaru-cc avatar Oct 16 '26 10:10 shikamaru-cc

Same nvkms_lock topology as this report, but on a non-hybrid desktop and with a different spin site: the spinning thread here is the compositor's own KMS thread, busy-polling GSP and display-interrupt registers. It is not the DIFR prefetch path.

It is also the transient variant: ~500 ms of complete display freeze (hardware cursor included) that recovers by itself, not the permanent hang that requires a hard reset.


Environment

Item Detail
GPU GeForce RTX 3060 Ti (GA104), discrete
Driver nvidia-open 595.99.02 (DKMS) — the release suggested in this thread
OS / kernel Ubuntu 26.04, 7.0.0-38-generic
Session GNOME 50.1 / Mutter 50.1 on Wayland
Display topology Single NVIDIA GPU driving both outputs — 1920x1080@60 on DP, 1920x1080@60 on HDMI. No iGPU, no hybrid setup, no MUX.
nvidia_drm modeset=1, NVreg_PreserveVideoMemoryAllocations=1

Symptom

While playing a 60 fps video (browser), the entire display freezes for roughly 0.4–0.5 s, hardware cursor included, then recovers on its own. Audio (PipeWire) is unaffected and keeps playing. No Xid, no OOM, no thermal or power throttle, no drm/page-flip errors, PSI for cpu/io/memory all essentially zero.

Frequency: ~30 occurrences in 12 minutes of playback, ~7.9 s of cumulative frozen display time.

The trigger is active high-frame-rate display updates. Display blanking, DPMS and suspend/resume are not involved, so the idle-inhibitor workaround that resolved other reports in this thread does not apply here.

@aritger — this is on 595.99.02, the release you pointed to earlier in this thread as containing a fix that should avoid the problem reported here. It does not avoid it on this configuration. The failure is milder, not absent: the display still freezes, only transiently instead of permanently.

Measurement 1 — the KMS thread is spinning, not blocked

State, wchan and schedstat of the gnome-shell threads sampled at ~200 Hz, without root:

# worst  KMS   506.7ms  cpu=500.2ms  R/?                  <-- 98.7% CPU
# worst  MAIN  506.7ms  cpu=  0.0ms  S/futex_do_wait      <-- 0% CPU

The gnome-shell KMS thread burns 500.2 ms of CPU inside a 506.7 ms window while holding nvkms_lock; the gnome-shell main thread waits on the userspace mutex for exactly the same 506.7 ms with zero CPU. That is why the whole display stalls: no frame can be committed, and the hardware cursor is updated by the same thread.

Both threads were also caught waiting on NVIDIA locks directly (symbols confirmed against /proc/kallsyms):

KMS thread:   D/nvkms_ioctl_from_kapi_try_pmlock        [nvidia_modeset]
main thread:  D/os_acquire_rwlock_write   (26.3 ms)     [nvidia]
main thread:  D/os_acquire_rwlock_read    (10.6 ms)     [nvidia]

Measurement 2 — where it spins

bpftrace profile:hz:499 filtered to the KMS thread (comm == "KMS thread"), kernel stacks aggregated over 12 minutes. 11,220 samples, 1,554 distinct stacks.

59.19% of all KMS-thread CPU time is in osDevReadReg032 (MMIO register read), reached through two chains — both entered from _kgspRpcRecvPoll:

osDevReadReg032+60
_regRead.constprop.0+229
intrIsVectorPending_TU102+30
intrGetPendingLowLatencyHwDisplayIntr_TU102+112
kdispApplyAggressiveVblankHandlingWar_IMPL+62
_kgspRpcRecvPoll+1515
_issueRpcAndWait+213
osDevReadReg032+60
_regRead.constprop.0+229
crashcatEngineLoadWayfinder_IMPL+47
crashcatEngineGetNextCrashReport_IMPL+88
kgspHealthCheck_TU102+273
_kgspRpcDrainEvents+526
_kgspRpcRecvPoll+256

These two stacks account for 53.3% of all samples and were concentrated in the stall windows; individual 10-second windows show 250+ samples in a single stack, i.e. ~500 ms of continuous spinning.

So: a GSP RPC wait is implemented as a register-polling loop, and part of that polling goes through kdispApplyAggressiveVblankHandlingWar_IMPL → intrGetPendingLowLatencyHwDisplayIntr_TU102 and through kgspHealthCheck_TU102 → crashcatEngineGetNextCrashReport_IMPL. The War suffix and the "low latency display interrupt" polling suggest the display interrupt is being polled rather than waited for, while nvkms_lock is held.

Explicitly ruled out: this is not the DIFR path

Occurrences in the kernel-stack profile:

nvWriteGpEntry                   0
nvDIFRPrefetchSurfaces           0
nvPushKickoff                    0
PrefetchHelperSurfaceEvo         0
DifrPrefetchEventDeferredWork    0

Zero. So whatever fixes the DIFR pushbuffer livelock do not describe this case.

Where the code lives

On this system /usr/src/nvidia-595.99.02/ contains the open kernel modules, but every frame in the stacks above resolves into a closed binary blob, not into the open tree:

Symbol Object
kdispApplyAggressiveVblankHandlingWar, kgspRpcRecvPoll, crashcatEngine*, os_acquire_rwlock_write nvidia/nv-kernel.o_binary (17.5 MB)
nvkms_ioctl_from_kapi_try_pmlock nvidia-modeset/nv-modeset-kernel.o_binary (3.0 MB)

I mention it only to note that this is not something I can instrument or patch further locally.

Questions

  1. Is this the same internal issue as #1289, or should it be tracked separately given the spin site differs (GSP/display-interrupt polling vs. DIFR prefetch)?
  2. Does the DIFR lifecycle fix in 615.71.09 touch _kgspRpcRecvPoll / kdispApplyAggressiveVblankHandlingWar_IMPL at all? I am on 595.99.02 and have 615.71.09 available, and I would rather not spend a driver swap if the fix is unrelated.
  3. Is there a supported way to stop the GSP RPC receive path from polling display-interrupt registers synchronously while nvkms_lock is held, or a registry/NVreg_ setting worth testing?

Reproduction is a userspace probe plus the bpftrace one-liner, both scriptable; I can share the full logs or an nvidia-bug-report.sh capture on request. I can also re-measure on any driver version you want tested.

enzodrovandi avatar Oct 17 '26 02:10 enzodrovandi