Skip to content

Driver Deadlock when using 2 GPUs with 2 docker containers starting in parallel #968

Open

Description

@guenhter

NVIDIA Open GPU Kernel Modules Version

580.95.05

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 24.04.3 LTS

With Ubuntu 22.04 LTS, the issue is not happening.

Kernel Release

6.8.0-87-generic

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 4060
GPU 1: NVIDIA GeForce RTX 4060

Describe the bug

We have a deadlock issue on two servers (happens not 100% of the time but multiple times a week after daily reboots). When starting up the following compose file (cut down to the essential parts):

services:

  vllm-server-gpu0:
    image: vllm/vllm-openai:v0.11.0
    runtime: nvidia
    ipc: host
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              device_ids: ["0"]
              capabilities: [gpu]
    command: >
      --model Qwen/Qwen2.5-VL-3B-Instruct-AWQ
      --served-model-name Qwen/Qwen2.5-VL-3B-Instruct
      --gpu-memory-utilization 0.90
      --max_model_len 1600
      --tensor-parallel-size 1
      --load-format safetensors
      --enable-log-requests
      --enable-log-outputs

  vllm-server-gpu1:
    image: vllm/vllm-openai:v0.11.0
    runtime: nvidia
    ipc: host
    deploy:
      resources:
        reservations:
          devices:
            - driver: nvidia
              device_ids: ["1"]
              capabilities: [gpu]
    command: >
      --model google/gemma-3-1b-it-qat-int4-unquantized
      --served-model-name google/gemma-3-1b-it
      --gpu-memory-utilization 0.90
      --max_model_len 32768
      --tensor-parallel-size 1
      --load-format safetensors
      --enable-log-requests
      --enable-log-outputs

then the system completely stalls (not even keyboard input is possible any more).

The indication why we think it is a deadlock:

Process 1: nv_open_q (trying to OPEN/initialize GPU)

task:nv_open_q       state:D stack:0     pid:1014
Call Trace:
  rwsem_down_write_slowpath+0x27e/0x550   ← Waiting for write lock
  down_write+0x5c/0x80
  os_acquire_rwlock_write+0x3c/0x70       ← NVIDIA trying to acquire lock
  portSyncRwLockAcquireWrite+0x10/0x40
  rmapiLockAcquire+0x294/0x360
  kgspInitRm_IMPL+0xcad/0x1680            ← Initializing GPU
  RmInitAdapter+0xff2/0x1e40              ← Opening adapter
  rm_init_adapter+0xad/0xc0
  nv_open_device+0x222/0xa80

Process 2: python3 (trying to CLOSE/shutdown GPU)

task:python3         state:D stack:0     pid:654119
Call Trace:
  __down+0x1d/0x30
  down+0x54/0x80
  console_lock+0x25/0x70                  ← Trying to acquire console lock
  os_disable_console_access+0xe/0x20
  RmShutdownAdapter+0x18d/0x3b0           ← Shutting down adapter
  rm_shutdown_adapter+0x58/0x60
  nv_shutdown_adapter+0xae/0x1d0
  nv_close_device+0x132/0x180             ← Closing device
  nvidia_close+0xf7/0x280

Why It's a Deadlock:

  1. nv_open_q is blocked at rwsem_down_write_slowpath trying to get a write lock to initialize the GPU adapter
  2. python3 is blocked at console_lock trying to disable console access during GPU shutdown
  3. Both are in state D (uninterruptible sleep) - they cannot be killed or interrupted
  4. They're waiting on resources held by each other or by the NVIDIA driver's internal lock management

To Reproduce

Start the compose file or reboot the system (which starts up the the two containers also in parallel)

Bug Incidence

Sometimes

nvidia-bug-report.log.gz

I cannot run anything after the error happens

More Info


Details

Trace 1:

Nov 19 01:03:26.198647 myserver kernel: task:nv_open_q       state:D stack:0     pid:1014  tgid:1014  ppid:2      flags:0x00004000
Nov 19 01:03:26.198686 myserver kernel: Call Trace:
Nov 19 01:03:26.198721 myserver kernel:  <TASK>
Nov 19 01:03:26.198752 myserver kernel:  __schedule+0x27c/0x6b0
Nov 19 01:03:26.198836 myserver kernel:  schedule+0x33/0x110
Nov 19 01:03:26.198878 myserver kernel:  schedule_preempt_disabled+0x15/0x30
Nov 19 01:03:26.198916 myserver kernel:  rwsem_down_write_slowpath+0x27e/0x550
Nov 19 01:03:26.198948 myserver kernel:  down_write+0x5c/0x80
Nov 19 01:03:26.198978 myserver kernel:  os_acquire_rwlock_write+0x3c/0x70 [nvidia]
Nov 19 01:03:26.199004 myserver kernel:  portSyncRwLockAcquireWrite+0x10/0x40 [nvidia]
Nov 19 01:03:26.199034 myserver kernel:  rmapiLockAcquire+0x294/0x360 [nvidia]
Nov 19 01:03:26.200733 myserver kernel:  kgspInitRm_IMPL+0xcad/0x1680 [nvidia]
Nov 19 01:03:26.200867 myserver kernel:  ? down+0x36/0x80
Nov 19 01:03:26.200920 myserver kernel:  RmInitAdapter+0xff2/0x1e40 [nvidia]
Nov 19 01:03:26.200952 myserver kernel:  ? _raw_spin_lock_irqsave+0xe/0x20
Nov 19 01:03:26.200982 myserver kernel:  ? up+0x58/0xa0
Nov 19 01:03:26.201683 myserver kernel:  rm_init_adapter+0xad/0xc0 [nvidia]
Nov 19 01:03:26.202101 myserver kernel:  nv_open_device+0x222/0xa80 [nvidia]
Nov 19 01:03:26.202924 myserver kernel:  nvidia_open_deferred+0x39/0xf0 [nvidia]
Nov 19 01:03:26.202966 myserver kernel:  _main_loop+0x7f/0x140 [nvidia]
Nov 19 01:03:26.202975 myserver kernel:  ? __pfx__main_loop+0x10/0x10 [nvidia]
Nov 19 01:03:26.202983 myserver kernel:  kthread+0xef/0x120
Nov 19 01:03:26.202990 myserver kernel:  ? __pfx_kthread+0x10/0x10
Nov 19 01:03:26.202996 myserver kernel:  ret_from_fork+0x44/0x70
Nov 19 01:03:26.203003 myserver kernel:  ? __pfx_kthread+0x10/0x10
Nov 19 01:03:26.203019 myserver kernel:  ret_from_fork_asm+0x1b/0x30
Nov 19 01:03:26.203026 myserver kernel:  </TASK>
Nov 19 01:03:26.203033 myserver kernel: INFO: task python3:654119 blocked for more than 122 seconds.
Nov 19 01:03:26.203041 myserver kernel:       Tainted: G           O       6.8.0-87-generic #88-Ubuntu
Nov 19 01:03:26.203047 myserver kernel: "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
Nov 19 01:03:26.203053 myserver kernel: task:python3         state:D stack:0     pid:654119 tgid:654119 ppid:653435 flags:0x00004002

Trace 2:

Nov 19 01:03:26.203053 myserver kernel: task:python3         state:D stack:0     pid:654119 tgid:654119 ppid:653435 flags:0x00004002
Nov 19 01:03:26.203059 myserver kernel: Call Trace:
Nov 19 01:03:26.203065 myserver kernel:  <TASK>
Nov 19 01:03:26.203070 myserver kernel:  __schedule+0x27c/0x6b0
Nov 19 01:03:26.203076 myserver kernel:  schedule+0x33/0x110
Nov 19 01:03:26.203081 myserver kernel:  schedule_timeout+0x157/0x170
Nov 19 01:03:26.203088 myserver kernel:  ___down_common+0xfd/0x160
Nov 19 01:03:26.203097 myserver kernel:  __down_common+0x22/0xd0
Nov 19 01:03:26.203103 myserver kernel:  __down+0x1d/0x30
Nov 19 01:03:26.203111 myserver kernel:  down+0x54/0x80
Nov 19 01:03:26.203119 myserver kernel:  console_lock+0x25/0x70
Nov 19 01:03:26.203126 myserver kernel:  os_disable_console_access+0xe/0x20 [nvidia]
Nov 19 01:03:26.203133 myserver kernel:  RmShutdownAdapter+0x18d/0x3b0 [nvidia]
Nov 19 01:03:26.203909 myserver kernel:  rm_shutdown_adapter+0x58/0x60 [nvidia]
Nov 19 01:03:26.204004 myserver kernel:  nv_shutdown_adapter+0xae/0x1d0 [nvidia]
Nov 19 01:03:26.204012 myserver kernel:  nv_close_device+0x132/0x180 [nvidia]
Nov 19 01:03:26.204031 myserver kernel:  nvidia_close_callback+0x99/0x1a0 [nvidia]
Nov 19 01:03:26.204037 myserver kernel:  nvidia_close+0xf7/0x280 [nvidia]
Nov 19 01:03:26.204043 myserver kernel:  __fput+0xa0/0x2e0
Nov 19 01:03:26.204049 myserver kernel:  __fput_sync+0x1c/0x30
Nov 19 01:03:26.204055 myserver kernel:  __x64_sys_close+0x3e/0x90
Nov 19 01:03:26.204065 myserver kernel:  x64_sys_call+0x1fec/0x25a0
Nov 19 01:03:26.204073 myserver kernel:  do_syscall_64+0x7f/0x180
Nov 19 01:03:26.204081 myserver kernel:  ? arch_exit_to_user_mode_prepare.isra.0+0x1a/0xe0
Nov 19 01:03:26.204087 myserver kernel:  ? syscall_exit_to_user_mode+0x43/0x1e0
Nov 19 01:03:26.204093 myserver kernel:  ? do_syscall_64+0x8c/0x180
Nov 19 01:03:26.204100 myserver kernel:  ? __fput+0x160/0x2e0
Nov 19 01:03:26.204107 myserver kernel:  ? arch_exit_to_user_mode_prepare.isra.0+0x1a/0xe0
Nov 19 01:03:26.204112 myserver kernel:  ? syscall_exit_to_user_mode+0x43/0x1e0
Nov 19 01:03:26.204117 myserver kernel:  ? do_syscall_64+0x8c/0x180
Nov 19 01:03:26.204121 myserver kernel:  ? do_syscall_64+0x8c/0x180

Activity

  1. added
    bug
    on Nov 19, 2025
  2. mtijanic commented on Nov 21, 2025

    @mtijanic
    Collaborator

    Hey there! We also found this issue recently by auditing the lock ordering, but we haven't actually seen it happen.

    The fix is currently slated to appear in 595.xx driver release - there was no reason to pull it in because we hadn't actually seen it before. Maybe this report moves the needle on that and we integrate it back. Failing that, would you be interested in a patch to apply yourself?

  3. guenhter commented on Nov 24, 2025

    @guenhter
    Author

    Hi,

    usually we try only to install stable LTS versions on our customer servers. We though have also internal servers with the problem where we could install the patch. If you need anything from us to verify if the fix really works, we are more then happy to support you in any way.

  4. shanemort1982 commented on Mar 20, 2026

    @shanemort1982

    Adding another data point for this issue.

    Setup: Single Quadro P2000 (GP106) on Unraid 7.2, kernel 6.12.54, driver 580.142. Unmanic (media transcoder) Docker container configured with runtime=nvidia.

    Symptoms: nv_open_q kernel thread gets stuck in a busy loop consuming 15-17% CPU indefinitely. GPU stays locked in P0 performance state (fan at 69%, drawing 17W) despite 0% GPU utilization and zero GPU processes running. The thread never recovers.

    Periodically this escalates to a full system hang — no SSH, no web GUI, requires hard power cycle. No kernel panic or crash dump is produced (soft lockup). Logs are lost since Unraid runs from RAM.

    Comparison: An identical Unraid 7.2 setup (same kernel 6.12.54, same driver 580.142, same Unmanic container config with runtime=nvidia) but with a Quadro P4000 (GP104) does NOT exhibit this bug. On the P4000, nv_open_q uses 0.3% CPU and the GPU correctly idles at P8.

    Trigger: Appears to be a race condition during Docker container startup with the nvidia runtime — the container opening the GPU device triggers nv_open_q → nv_open_device → rmapiLockAcquire path. Once triggered, the thread never recovers. It does not trigger on every boot — it is intermittent but once stuck, stays stuck until reboot.

    Driver history: Only the 580.142 package is available for this kernel via the Unraid nvidia-driver plugin. Going to attempt 595.45.04 (beta) as the fix is reportedly slated for 595.xx per @mtijanic comment above. Will report back.

    Would appreciate if this fix could be backported to 580.x production branch as well, since many Unraid/NAS users are on the production branch and cannot easily run beta drivers.

  5. shanemort1982 commented on Mar 20, 2026

    @shanemort1982

    Update: The bug also occurs on 575.64.05 — same nv_open_q spinning, GPU stuck in P0. So this is NOT limited to the 580.x branch.

    Also confirmed that 595.45.04 dropped Pascal (GP106) support entirely — the P2000 is now legacy, supported only through 580.xx. So the fix "slated for 595.xx" is irrelevant for Pascal GPUs since they cannot use that driver.

    Workaround found: Enabling persistence mode (nvidia-smi -pm 1) before any container with runtime=nvidia starts completely resolves the issue. With persistence mode:

    • nv_open_q drops from 13-17% CPU to <1%
    • GPU correctly idles at P8 (was stuck at P0)
    • Fan drops from 69% to 47%
    • Power drops from 17W to 7W

    This makes sense — persistence mode keeps the GPU device open permanently, preventing the open/close race that triggers the deadlock in nv_open_q.

    Request: Since Pascal (GP106/GP104) is now legacy on 580.xx and will never get the 595.xx fix, could the lock ordering fix be backported to the 580.x legacy branch? Otherwise all Pascal GPU users with Docker runtime=nvidia are permanently exposed to this deadlock with no driver fix available.

  6. avolaine commented on Apr 7, 2026

    @avolaine

    nvidia_uvm kernel page corruption on RTX PRO 5000 Blackwell — 595.58.03

    System:

    • GPU: NVIDIA RTX PRO 5000 Blackwell (PCI 01:00.0)
    • Driver: 595.58.03 (Open Kernel Module)
    • OS: Ubuntu 24.04.3 LTS, kernel 6.14.0-37-generic
    • nvidia-container-toolkit: 1.18.2
    • Workload: Docker Compose stack (vLLM, PostgreSQL, Temporal, etc.)
    • nvidia-persistenced running, persistence mode enabled

    Problem: We're experiencing recurring kernel page corruption originating from nvidia_uvm, leading to complete system lockups requiring hard reboot. This is not the lock-ordering deadlock between nv_open_q and console_lock described in the original issue — it's a separate memory corruption vector in the same module.

    We've had 8 hard reboots since March 11, 2026, with the frequency increasing after upgrading to 595.58.03.

    Crash sequence (reproducible pattern):

    1. nvidia_uvm corrupts kernel pages during normal container operation
    2. Processes hit the corrupted pages:
      BUG: Bad page state in process postgres  pfn:895081
      BUG: Bad page map in process temporal-server  pte:418d44025 pmd:3ec358067
      BUG: Bad rss-counter state mm:... type:MM_FILEPAGES val:-1
      
    3. Kernel gets tainted with [B]=BAD_PAGE
    4. ext4 writeback worker hits corrupted pages, CPU gets stuck:
      watchdog: BUG: soft lockup - CPU#11 stuck for 559s! [kworker/u96:4]
      
      Call trace: ext4_do_writepages → mpage_prepare_extent_to_map → filemap_get_folios_tag
    5. RCU stalls repeat every ~2 min until system is completely unresponsive

    Mitigations already in place (none prevent the crash):

    • Sequential container start/stop (never parallel GPU container operations)
    • nvidia-persistenced + persistence mode enabled
    • memswap_limit = mem_limit on all containers (no swap)
    • cgroup.memory=nokmem kernel parameter
    • GPU memory utilization capped at 0.60
    • Docker live-restore: true
    • No privileged containers

    Timeline of crashes on 595.58.03:

    Date Trigger
    Apr 3 nvidia-container-runtime segfault (0x461235) → Bad page state → 3 reboots
    Apr 5 dockerd panic → parallel teardown → NVIDIA deadlock
    Apr 6 nvidia_uvm Bad page state (postgres pfn:895081, temporal-server pfn:418d44) → soft lockup CPU#11
    Apr 7 nvidia_uvm page corruption → ext4 writeback stuck → RCU stalls → lockup

    The lock-ordering deadlock (original issue) may be fixed in 595.58.03, but the underlying nvidia_uvm memory corruption is clearly not. This GPU requires the open kernel module — the proprietary driver does not support Blackwell — so there is no workaround.

    Happy to provide full dmesg dumps or run diagnostic patches if available.

  7. avolaine commented on Apr 17, 2026

    @avolaine

    Follow-up from @avolaine — patch request for RTX PRO 5000 Blackwell (595.58.03)

    @mtijanic — following up on our April 7 comment and your offer to provide a patch.

    We are still on 595.58.03 and experiencing the Vector 2 crash (nvidia_uvm kernel page corruption) described in our previous comment. The lock-ordering deadlock (Vector 1, the original issue) appears to be less frequent with persistence mode active, but Vector 2 continues to cause hard reboots.

    New finding: Our GPU reports Addressing Mode: HMM — HMM is active (uvm_disable_hmm = N, uvm_ats_mode = 1). We believe the page corruption race is triggered by HMM during container teardown: CPU pages are freed by the kernel while GPU DMA is still in-flight via the HMM mapping.

    What we have tried today:

    • uvm_disable_hmm=1 in modprobe.d (applied, testing now after reboot)
    • intel_iommu=on iommu=pt in kernel cmdline (containment)
    • kernel.softlockup_panic=1 + kernel.panic=30 (fast reboot on crash)

    Patch request: If you have the lock-ordering fix ready (the one slated for 595.xx), we would very much like to apply it as a DKMS patch against 595.58.03. Also: is there a known fix for the HMM DMA race specifically on Blackwell (GB2xx)?

    We can provide full dmesg dumps, kdump archives, or test any diagnostic patches. Our GPU is a dedicated inference server running 24/7 so we have good reproducibility.

    System: RTX PRO 5000 Blackwell (GB203), kernel 6.14.0-37-generic, Ubuntu 24.04.3, driver 595.58.03, nvidia-container-toolkit 1.18.2

  8. pearu commented on Aug 4, 2026

    @pearu

    Another data point, on 590.44.01 — which sits between the 580.x reports above and the 595.xx fix, and shows the bug is present there too.

    Setup

    • Driver: 590.44.01 (open kernel module, modinfo nvidia → license: Dual MIT/GPL)
    • GPUs: 2× GeForce RTX 2060 (Turing TU106)
    • OS: Ubuntu 24.04.3 LTS, kernel 6.8.0-136-generic
    • Docker container with runtime=nvidia
    • Persistence mode was Disabled at the time of the hang
    • Uptime when it hit: 42 days

    Same deadlock, same functions. One task blocked on console_lock inside adapter shutdown while holding the RM API lock, everything else queued behind that lock:

    INFO: task python:564994 blocked for more than 122 seconds.
    task:python          state:D stack:0     pid:564994 tgid:564994 ppid:562534
    Call Trace:
     __schedule+0x27c/0x6b0
     schedule+0x33/0x110
     schedule_timeout+0x157/0x170
     ___down_common+0xfd/0x160
     __down_common+0x22/0xd0
     __down+0x1d/0x30
     down+0x54/0x80
     console_lock+0x25/0x70
     os_disable_console_access+0xe/0x20 [nvidia]
     RmShutdownAdapter+0x195/0x3e0 [nvidia]
     rm_shutdown_adapter+0x58/0x60 [nvidia]
     nv_shutdown_adapter+0xae/0x1d0 [nvidia]
     nv_close_device+0x11e/0x160 [nvidia]
     nvidia_close_callback+0x99/0x1a0 [nvidia]
     nvidia_close+0xf7/0x280 [nvidia]
     __fput+0xa3/0x2e0
     __fput_sync+0x1c/0x30
     __x64_sys_close+0x3e/0x90
    
    INFO: task nv_open_q:1552508 blocked for more than 122 seconds.
    task:nv_open_q       state:D stack:0     pid:1552508 tgid:1552508 ppid:2
    Call Trace:
     __schedule+0x27c/0x6b0
     schedule+0x33/0x110
     schedule_preempt_disabled+0x15/0x30
     rwsem_down_write_slowpath+0x27e/0x550
     ? os_acquire_spinlock+0x12/0x30 [nvidia]
     down_write+0x5c/0x80
     os_acquire_rwlock_write+0x3c/0x70 [nvidia]
     portSyncRwLockAcquireWrite+0x10/0x40 [nvidia]
     rmapiLockAcquire+0x294/0x380 [nvidia]
     kgspInitRm_IMPL+0xcdd/0x1680 [nvidia]
     RmInitAdapter+0x1002/0x2090 [nvidia]
     rm_init_adapter+0xad/0xc0 [nvidia]
     nv_open_device+0x222/0xa70 [nvidia]
     nvidia_open_deferred+0x39/0xf0 [nvidia]
     _main_loop+0x82/0x140 [nvidia]
    

    Two things that may be useful beyond confirming the report:

    1. nvidia-smi gets caught in the pile. Two invocations were themselves stuck in D state behind the same lock:

    INFO: task nvidia-smi:568209 blocked for more than 122 seconds.
    task:nvidia-smi      state:D stack:0     pid:568209 tgid:568209 ppid:554611
    Call Trace:
     rwsem_down_write_slowpath+0x27e/0x550
     down_write+0x5c/0x80
     os_acquire_rwlock_write+0x3c/0x70 [nvidia]
     portSyncRwLockAcquireWrite+0x10/0x40 [nvidia]
     rmapiLockAcquire+0x294/0x380 [nvidia]
     serverTopLock_Prologue+0x5c/0xe0 [nvidia]
     serverAllocResource+0x1cb/0x5c0 [nvidia]
     rmapiAllocWithSecInfo+0x1f0/0x420 [nvidia]
     rmapiAllocWithSecInfoTls+0x65/0x90 [nvidia]
     Nv04AllocWithAccessSecInfo+0x6f/0x80 [nvidia]
     RmIoctl+0xac3/0xda0 [nvidia]
     rm_ioctl+0x66/0x4f0 [nvidia]
     nvidia_unlocked_ioctl+0x4c1/0x9a0 [nvidia]
     __x64_sys_ioctl+0xa3/0xf0
    

    Operationally this is the part that escalates a stuck GPU into a stuck machine: every monitoring probe, health check, or MOTD script that shells out to nvidia-smi joins the pile permanently and unkillably. Load average climbed past 54 while CPU sat 99.9% idle and /proc/stat procs_blocked read 0 — the blocked tasks are waiting on a lock, not on I/O, so they never appear in nr_iowait and no iowait-based alert fires. It also means the usual triage tool is the one thing guaranteed not to answer.

    2. iovaspaceDestruct_IMPL messages look like a usable proxy for teardown frequency. With persistence mode off, this fired hundreds of times across the 42-day boot, on both GPUs:

    NVRM: iovaspaceDestruct_IMPL: 6 left-over mappings in IOVAS 0x2100
    NVRM: GPU0 nvAssertFailedNoLog: Assertion failed: pIOVAS != NULL @ io_vaspace.c:592
    NVRM: GPU0 nvAssertFailedNoLog: Assertion failed: pIOVAS != NULL @ io_vaspace.c:601
    

    Since these only appear on adapter teardown, their rate is a rough count of how often the box is entering the vulnerable shutdown path — potentially handy both for gauging exposure and for verifying that persistence mode removed it.

    On the trigger: in our case it does not appear to have been parallel container startup. A single long-running container was up, and the deadlock arose from ordinary process churn inside it — one python process closing its last /dev/nvidia* handle (triggering RmShutdownAdapter) while another was opening one (triggering RmInitAdapter → kgspInitRm_IMPL). So the window may be any concurrent open/close of the last GPU reference, with parallel container start being one common way to hit it rather than a precondition.

    Supporting shanemort1982's workaround: persistence mode looks like the right mitigation for the same reason given above — with a persistent client handle the refcount never reaches zero, so RmShutdownAdapter never runs and the inverted acquisition never happens. We've now enabled nvidia-persistenced and both GPUs report Persistence Mode: Enabled; the box has only a few hours of uptime since, so I can't yet claim confirmation, and I'll follow up if it recurs.

    Backport request, seconding the earlier one: a 590.x/580.x backport would help. Turing here can move to 595.xx, but the report of a separate nvidia_uvm page-corruption issue on 595.58.03 earlier in this thread makes that branch a difficult recommendation right now, and the Pascal case above has no 595.xx route at all.


    🤖 Drafted by Claude Code (an AI agent) and reviewed & approved by pearu.

  9. haster commented on Aug 11, 2026

    @haster

    Another data point here, from just this morning.
    (Report generated by Claude, driven/reviewed by me.)


    (Generated by Claude)

    Same kgspInitRm_IMPL RM-API-lock deadlock, but on a single-GPU laptop, triggered at cold boot (not multi-GPU / parallel containers). Posting as an additional data point in case it helps narrow the root cause.

    Summary

    Intermittently, at cold boot, modprobe nvidia-drm never returns: the module-init task deadlocks acquiring the RM API rwlock inside kgspInitRm_IMPL and goes into uninterruptible D state. udev reports the worker as "taking longer than 59s", then "timed out after 2min 59s, killing" — but the task is unkillable and stays blocked indefinitely (observed 122 → 368 → 491 → 614 → 737 s until the user hard power-cycled). The GPU adapter never finishes init, so the NVIDIA-driven HDMI output never gets a modeset (external monitor: "no signal", though EDID/HPD detect it). Core compute (nvidia module / nvidia-smi) is unaffected — only the modeset/adapter bring-up is wedged. Any other process that then touches the GPU blocks on the same lock. Recovery is power-cycle only. The next boot is typically clean, so it's a race, not a hard regression.

    Why no nvidia-bug-report.log.gz attached: it can't be captured during the fault — the RM lock is wedged, so nvidia-bug-report.sh (which queries the GPU) hangs too, and the only exit is a hard power-cycle. A report taken after the recovery reboot just shows a healthy GPU, since the fault is intermittent and doesn't survive the reboot. The traces below are therefore taken from persistent journald (which does survive the power-cycle). Targeted data can be captured on the next occurrence — see the bottom of this comment.

    Environment

    GPU NVIDIA GeForce RTX 4060 Laptop GPU (AD107, Ada) @ 0000:01:00.0
    Platform Hybrid/Optimus laptop — Intel Raptor Lake-P iGPU (i915) + the dGPU; PRIME on-demand
    Driver nvidia-open 595.84 (NVIDIA UNIX Open Kernel Module 595.84)
    Kernel 6.8.0-137-generic (Ubuntu 24.04 LTS)
    Secure Boot disabled (module out-of-tree; taint G OE, expected)
    Display external monitor on the HDMI port wired to the NVIDIA GPU
    KMS nvidia-drm modeset enabled, loaded via udev at boot

    Note: NVreg_EnableGpuFirmware=0 is not an available workaround here, since GSP is mandatory on the open kernel module.

    Stack traces (from the hung-task watchdog)

    Two tasks in D state. Both are blocked as writers on the nvidia RM API rwlock (rwsem_down_write_slowpath → down_write → os_acquire_rwlock_write → portSyncRwLockAcquireWrite → rmapiLockAcquire). Neither holds it — the holder is a third context not shown by the watchdog, consistent with a stalled GSP init sitting on the lock.

    (1) The nvidia-drm module-init worker — blocked inside kgspInitRm_IMPL:

    INFO: task (udev-worker):888 blocked for more than 368 seconds.
          Tainted: G           OE      6.8.0-137-generic #137-Ubuntu
    task:(udev-worker)   state:D stack:0     pid:888   tgid:888   ppid:1      flags:0x00004006
    Call Trace:
     <TASK>
     __schedule+0x27c/0x6b0
     schedule+0x33/0x110
     schedule_preempt_disabled+0x15/0x30
     rwsem_down_write_slowpath+0x27e/0x550
     down_write+0x5c/0x80
     os_acquire_rwlock_write+0x3c/0x70 [nvidia]
     portSyncRwLockAcquireWrite+0x10/0x40 [nvidia]
     rmapiLockAcquire+0x27c/0x360 [nvidia]
     kgspInitRm_IMPL+0x1653/0x24d0 [nvidia]
     RmInitAdapter+0xf16/0x2100 [nvidia]
     rm_init_adapter+0x135/0x140 [nvidia]
     nv_start_device+0x3f2/0x7c0 [nvidia]
     nv_open_device+0xa3/0x2d0 [nvidia]
     nvidia_dev_get+0x6d/0xe0 [nvidia]
     nvkms_open_gpu+0x58/0xa0 [nvidia_modeset]
     AllocateDevice+0x45/0x410 [nvidia_modeset]
     nv_drm_register_drm_device+0xad/0x260 [nvidia_drm]
     EnumerateGpus+0x180/0x190 [nvidia_modeset]
     nv_drm_probe_devices+0x66/0xa0 [nvidia_drm]     (? frame)
     nv_drm_init+0x31/0x70 [nvidia_drm]              (? frame)
     nv_linux_drm_init+0xe/0xff0 [nvidia_drm]        (? frame)
     do_one_initcall / do_init_module / load_module / __x64_sys_finit_module ...
     </TASK>
    

    (2) Ubuntu gpu-manager, reading /proc/driver/nvidia/.../power — blocked on the same RM API write lock:

    INFO: task gpu-manager:6100 blocked for more than 122 seconds.
          Tainted: G           OE      6.8.0-137-generic #137-Ubuntu
    task:gpu-manager     state:D stack:0     pid:6100  tgid:6100  ppid:6099   flags:0x00000002
    Call Trace:
     <TASK>
     __schedule+0x27c/0x6b0
     schedule+0x33/0x110
     schedule_preempt_disabled+0x15/0x30
     rwsem_down_write_slowpath+0x27e/0x550
     down_write+0x5c/0x80
     os_acquire_rwlock_write+0x3c/0x70 [nvidia]
     portSyncRwLockAcquireWrite+0x10/0x40 [nvidia]
     rmapiLockAcquire+0x27c/0x360 [nvidia]
     rm_get_power_info+0x38/0x3a0 [nvidia]
     nv_procfs_read_power+0x57/0x1c0 [nvidia]
     seq_read_iter+0x12f/0x4b0
     ...
     </TASK>
    

    Boot timeline (relative to power-on)

    T+0s     [drm] [nvidia-drm] [GPU ID 0x00000100] Loading driver
    T+60s    systemd-udevd: nvidia: modprobe nvidia-drm "taking longer than 59s"
    T+180s   udev: modprobe nvidia-drm "timed out after 2min 59s, killing"  (task stays in D, not actually killed)
    T+196s   hung_task: (udev-worker) blocked > 122s   [kgspInitRm_IMPL]
    T+...    gpu-manager blocked > 122s                [nv_procfs_read_power]
             both tasks keep escalating (368/491/614/737s) — never recover
    ~T+18m   hard power-cycle (only way out); next boot clean
    

    Trigger hypothesis

    On the affected laptop the external display is on the NVIDIA-wired HDMI, and the user habitually plugs the dock/HDMI in while the machine is still booting — so a display hotplug/modeset can arrive concurrently with GSP init. Together with gpu-manager polling power during early boot, there are ≥2 concurrent RM entry points during adapter bring-up. This looks like the same failure as #968's "two concurrent GPU operations during init," but on a single GPU — which suggests the race isn't inherent to multi-GPU setups; concurrency during GSP init alone seems sufficient to hit it.

    Notes / offer

    • No full nvidia-bug-report.log.gz attached: a report captured after the recovery reboot only reflects a healthy GPU, and the tool tends to hang while the GPU is wedged. One can be provided on request, or more targeted data captured on the next occurrence — e.g. cat /proc/<pid>/stack of the D-state tasks, or additional NVreg_RmMsg logging — if that would help.
    • Persistent journald is enabled, so the hung boot survives the power-cycle; additional fields can be pulled from it on request.
  10. cyclecore-dev commented on Sep 15, 2026

    @cyclecore-dev

    We hit a matching hang on a single-GPU workstation running 580.82.09 with the open kernel module. The symptom is a D-state deadlock with no panic, no Xid, and no usable SysRq. The journal ends mid-line and the only recovery is a hard power cycle.

    The traces in this issue are consistent with a lock inversion between the suspend path and the deferred open handler:

    • nvidia_suspend() acquires nvl->ldata_lock, then calls nv_kthread_q_flush(&nvl->open_q) and waits for the deferred open to complete.
    • nvidia_open_deferred(), which is the O_NONBLOCK path that container runtimes use, runs on that queue and needs the same ldata_lock.

    Each side waits for the other. At the point where the flush runs, nv_system_pm_lock is already held for write in nv_set_system_power_state(), which means no new opens can be enqueued. The flush can safely move earlier in the suspend sequence.

    The proposed change is against 580.82.09 kernel-open/nvidia/nv.c:

    1. Remove nv_kthread_q_flush(&nvl->open_q) from nv_power_management() in the STANDBY and HIBERNATE cases.
    2. Drain every device's open_q in nv_suspend_devices(), after nvidia_modeset_suspend(0) and before the per-device nvidia_suspend() loop. The flush is skipped for NV_PM_ACTION_DEPTH_MODESET since modeset-only transitions do not take ldata_lock.

    This drains all GPUs before any one of them acquires ldata_lock, which covers the multi-GPU topology that this issue originally reported.

    The diff and a full lock-ordering analysis are here:

    https://github.com/cyclecore-dev/gpuGUARD/blob/v0.1.0/patches/002-fix-open_q-flush-deadlock-comprehensive.patch
    https://github.com/cyclecore-dev/gpuGUARD/blob/v0.1.0/patches/PATCH_ANALYSIS_968.md

    The diff is against 580.82.09 and is experimental. If line numbers have shifted in a newer driver, we can update the patch.

  11. haster commented on Oct 1, 2026

    @haster

    (Generated by Claude)

    Follow-up to my earlier comment, with three more occurrences on the same laptop (RTX 4060 Laptop, single GPU, Ubuntu 24.04).

    Still reproduces on 595.91.07 (kernels 6.8.0-139 and 6.8.0-142). The two hung-task stacks are identical to the ones posted earlier (kgspInitRm_IMPL → rmapiLockAcquire in the nvidia-drm module-init udev worker, plus gpu-manager in nv_procfs_read_power). Frequency: 3 out of the last 32 boots (2026-09-23, 09-30, 10-01), so roughly 1 cold boot in 10. The next boot is always clean.

    Timing, failed vs. healthy boots (monotonic seconds after the root volume is unlocked):

    nvidia-drm Loading driver gpu-manager.service starts Initialized nvidia-drm
    healthy (3 boots) +0.57 – 0.63 s +0.25 – 0.37 s after load +1.3 – 1.7 s after load
    failed (2 boots) +0.60 s +0.27 – 0.30 s after load never

    So gpu-manager touching the GPU while it's still initializing is normal on every boot, and isn't enough on its own to cause the hang.

    Correcting my earlier trigger hypothesis. There is no dock involved; I misstated that. In the two most recent failures the USB peripherals were already attached at power-on, the AC adapter was unplugged, and no USB/AC/power-profile events happened during the probe window. A healthy boot with the HDMI monitor (on the NVIDIA-wired port) already connected at power-on also shows that a connected external display isn't enough to trigger it. A display hotplug inside the ~1.5 s init window can't be ruled out, because the fault itself suppresses any DRM hotplug logging, but nothing else external was happening when it hung.

    Probably not the same path as the suspend/open_q analysis above. Our hangs happen at cold boot with no suspend/resume and no O_NONBLOCK container opens, and both blocked tasks wait on the RM API rwlock inside GSP init rather than ldata_lock. As far as we can tell, that patch wouldn't affect this variant.

  12. SomeSuchSteve commented on Oct 28, 2026

    @SomeSuchSteve

    @haster: same RTX 4060 Laptop cold-boot hang here (595.99.02 and 580.178.04 open). The proprietary module with NVreg_EnableGpuFirmware=0 has avoided it so far (6/6 cold boots). Details in #1421.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions