Skip to content

nvidia-modeset kthread livelocks in nvDIFRPrefetchSurfaces/nvWriteGpEntry; KMS thread blocks forever, display stack unrecoverable (595.71.05 open, RTX 4080 Laptop) #1246

Description

@otatop

prev-boot-kernel.log.gz

NVIDIA Open GPU Kernel Modules Version

595.71.05 (Ubuntu package nvidia-driver-595-open 595.71.05-0ubuntu0.26.04.1)

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

Ubuntu 26.04 LTS

Kernel Release

7.0.0-27-generic #27-Ubuntu (Ubuntu 26.04)

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 4080 Laptop GPU (UUID: GPU-2d959b1c-d3e9-a43f-a88d-1cab500438dc)

Describe the bug

After ~20 hours idle at the GNOME lock screen with an external display connected to the dGPU, the nvidia-modeset/ kernel thread entered a permanent busy-spin inside the DIFR prefetch path:

DifrPrefetchEventDeferredWork
  -> nvDIFRPrefetchSurfaces
    -> PrefetchHelperSurfaceEvo
      -> nvWriteGpEntry   <- spins here forever (state R, 100% of one core)

The thread remains runnable (state R) and never exits nvWriteGpEntry — successive hung-task reports over 20+ minutes show the same thread at nvWriteGpEntry+0xf7/+0x100, i.e. it is looping (presumably waiting for GPFIFO space that never becomes available), not making progress. There is no timeout or bail-out in this loop.

Because that kthread holds the nvkms lock (semaphore), the "KMS thread" blocks forever in nvkms_ioctl_from_kapi_try_pmlock and every subsequent modeset/flip/cursor operation queues behind it. The session is unrecoverable: displays cannot be lit (lid-open produced nothing), and only a hard power-off recovers the machine. The rest of the kernel stays alive.

To Reproduce

ot deterministic — it is a race that needs many DIFR engage/disengage cycles:

  1. Hybrid laptop, external monitor on the dGPU, GNOME Wayland session.
  2. Lock the session and leave it idle for many hours (AC power, no suspend).
  3. In this state the lock-screen clock repaints the dGPU-driven output once per minute; each repaint wakes the GPU from runtime D3, and each subsequent idle period re-engages DIFR. In my incident the machine went through ~1,250 such cycles (one per minute from 20:12 to 16:47 the next day) before one prefetch livelocked.

This machine has hit what appears to be the same deadlock at least once before (an older note in my modprobe config references a previous KMS-thread deadlock and attempts options nvidia-modeset NvModesetEnableDIFR=0 — which is not a valid parameter; as far as I can tell there is no user-accessible way to disable DIFR on the open driver).

Kernel log

First hung-task report (16:49:56; the blocked task and the spinning lock holder):

INFO: task KMS thread:8215 blocked for more than 122 seconds.
      Tainted: G           O        7.0.0-27-generic #27-Ubuntu
task:KMS thread      state:D stack:0     pid:8215  tgid:8112  ppid:7471   task_flags:0x400040 flags:0x00080000
Call Trace:
 <TASK>
 __schedule+0x2b2/0x630
 schedule+0x27/0x90
 schedule_timeout+0xcf/0x110
 ___down_common+0x108/0x1e0
 __down_common+0x5a/0x180
 __down+0x1d/0x30
 down+0x5e/0x80
 nvkms_ioctl_from_kapi_try_pmlock+0x55/0xc0 [nvidia_modeset]
 ApplyModeSetConfig+0x59e/0xba0 [nvidia_modeset]
 ? nv_drm_atomic_apply_modeset_config+0x80b/0x9c0 [nvidia_drm]
 ? nv_drm_plane_atomic_check+0xed/0x680 [nvidia_drm]
 ? nv_drm_atomic_check+0x12d/0x150 [nvidia_drm]
 ? drm_atomic_check_only+0x199/0x420
 ? drm_atomic_nonblocking_commit+0x18/0x70
 ? drm_mode_atomic_ioctl+0x57e/0x910
 ...
 </TASK>
INFO: task KMS thread:8215 blocked on a semaphore likely last held by task nvidia-modeset/:1974
task:nvidia-modeset/ state:R  running task     stack:0     pid:1974  tgid:1974  ppid:2      task_flags:0x208040 flags:0x00080020
Call Trace:
 <TASK>
 __schedule+0x2ba/0x630
 preempt_schedule_irq+0x38/0x70
 raw_irqentry_exit_cond_resched+0x31/0x40
 irqentry_exit+0x2e/0x5a0
 ? __update_idle_core+0x56/0x1c0
 sysvec_apic_timer_interrupt+0x54/0xd0
 asm_sysvec_apic_timer_interrupt+0x1b/0x20
RIP: 0010:nvWriteGpEntry+0xf7/0x370 [nvidia_modeset]
 ? nvPushKickoff+0x28/0x50 [nvidia_modeset]
 ? PrefetchHelperSurfaceEvo+0x45c/0x650 [nvidia_modeset]
 ? nvDIFRPrefetchSurfaces+0xb1/0x1f0 [nvidia_modeset]
 ? DifrPrefetchEventDeferredWork+0x16/0x30 [nvidia_modeset]
 ? nvkms_kthread_q_callback+0xe9/0x190 [nvidia_modeset]
 ? _main_loop+0x99/0x160 [nvidia_modeset]
 ? kthread+0xf7/0x130
 ? ret_from_fork+0x195/0x2a0
 ? ret_from_fork_asm+0x1a/0x30
 </TASK>

The reports repeat with the same two stacks at 245s, 368s, ... 1228s blocked; the nvidia-modeset/ thread is still at nvWriteGpEntry+0x100 in the final report (17:08:22), 21 minutes into the spin. The hang began at 16:47 — the compositor logged Cursor update failed: drmModeAtomicCommit: Invalid argument at 16:47:18, immediately after the last runtime-D3 wake at 16:47:00.

Possibly relevant context

  • Every runtime-D3 wake during the idle period logged the known GSP: PFM_REQ_HNDLR_STATE_SYNC_CALLBACK missing from _kgspProcessRpcEvent bootup whitelist #1145 pair:
    NVRM: _kgspProcessRpcEvent: Attempted to process RPC event from GPU0: 0x101a (PFM_REQ_HNDLR_STATE_SYNC_CALLBACK) during bootup without API lock — ~2,190 of these accumulated before the hang, so the livelocked prefetch fired in close proximity to a D3 wake cycle.
  • This platform's Dynamic Boost SBIOS interface is broken (boot-time PlatformRequestHandler failed to get target temp from SBIOS @ platform_request_handler_ctrl.c:2171), in case the PFM/LPWR interaction is relevant.
  • nvidia-modeset: WARNING: GPU:0: Unable to read EDID for display device DP-0 is logged at boot (monitor connected through a dock).

Requests

  1. A bound/timeout or error path in the nvWriteGpEntry wait used by nvDIFRPrefetchSurfaces, so a stalled prefetch fails (NV2080_CTRL_LPWR_DIFR_PREFETCH_FAIL_CE_HW_ERROR) instead of livelocking the display stack.
  2. Failing that, a supported way to disable DIFR (module parameter or regkey) as a workaround — currently there appears to be none reachable from the OS.

Bug Incidence

Once

nvidia-bug-report.log.gz

nvidia-bug-report.log.gz

More Info

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions