Skip to content

Suspend deadlock on Turing: nv_drm_mmap spins in kgmmuInvalidateTlb after BAR2 teardown; fbsr restore then fails on resume #1329

Description

@silicon905

NVIDIA Open GPU Kernel Modules Version

610.57.04 (open kernel modules, locally built via DKMS from the distro nvidia-open-dkms package).

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

EndeavourOS (Arch-based, rolling release).

Kernel Release

Linux 6.18.48-1-lts #1 SMP PREEMPT_DYNAMIC (stable Arch LTS package, not self-built), x86_64. (Hostname redacted from the uname output.)

Please confirm you are running a stable release kernel (e.g. not a -rc). We do not accept bug reports for unreleased kernels.

  • I am running on a stable kernel release.

Hardware: GPU

NVIDIA T1200 Laptop GPU (Turing, TU117) — UUID redacted. PCI 01:00.0. Single internal eDP panel, no external displays. Laptop firmware is in "Discrete Graphics" mode: no iGPU present, the dGPU drives the panel directly. PRIME / render offload is not in use.

Describe the bug

During system suspend, a userspace client that is inside nv_drm_mmap() gets
stuck in an unbounded register-read loop. The BAR2 CPU mapping appears to be torn
down by the suspend path while the client is still walking the GMMU, so the
pending TLB invalidation can never be acknowledged. The thread spins at 100%
system time while holding an rw-semaphore, which blocks nvidia-modeset and
systemd-sleep.

That corrupts the framebuffer save, so on resume memmgrRestorePowerMgmtState()
fails and the display pipeline never returns (Flip event timeout on head 0,
black screen), with nvidia-modeset blocked indefinitely until a hard power
cycle.

Related issues in the same __nv_drm_gem_nvkms_map / mapping_reuse.c code
region, but with different triggers (not suspend-specific): #1132 and #1134
(mapping exceeds a PCI BAR under steady-state/long-uptime load), and #945
(resume-side memmgrRestorePowerMgmtState black screen on Blackwell + iGPU).
This report is distinct in being suspend-triggered (BAR2 teardown mid-mmap),
in the soft-lockup spinning thread, and in the fbsr_gm107.c save corruption —
fbsrEnd_HAL currently has no other hits in this tracker.

Spinning thread (from the soft-lockup backtrace):

RIP: 0010:_regRead.isra.0+0x13/0x170 [nvidia]
kgmmuCheckPendingInvalidates_TU102+0x93/0xf0  [nvidia]
kgmmuInvalidateTlb_GM107+0x179/0x4d0          [nvidia]
gvaspaceAlloc_IMPL / dmaAllocMapping_GM107    [nvidia]
_kbusMapAperture_GM107 / _kbusInternalBar1Map [nvidia]
reusemappingdbMap / kbusMapFbAperture_GM107   [nvidia]
memMap_IMPL / serverMap                       [nvidia]
rmapiMapToCpuWithSecInfoV2 / _nv04MapMemory   [nvidia]
nvkms_call_rm / nvRmApiMapMemory / MapMemory  [nvidia_modeset]
__nv_drm_gem_nvkms_map / __nv_drm_gem_nvkms_mmap / nv_drm_mmap [nvidia_drm]
drm_gem_prime_mmap

BAR2 mapping gone mid-walk:

NVRM: Assertion failed:
  (pKernelBus->pReadToFlush != NULL ||
   pKernelBus->virtualBar2[GPU_GFID_PF].pCpuMapping != NULL)
  @ kern_bus_gv100.c:388
NVRM: kgmmuInvalidateTlb_GM107: TLB invalidation failed waiting for prior
      invalidate (status=0x00000065)
NVRM: dmaAllocMapping_GM107: can't alloc VA space for mapping.
NVRM: ... [NV_ERR_INVALID_STATE] (0x00000040)
      returned from reusemappingdbMap(...) @ kern_bus_gm107.c:3152

Lock chain reported by the kernel (PIDs are illustrative):

nvidia-modeset  <reader> blocked on rw-semaphore owned by systemd-sleep
systemd-sleep   <writer> blocked on rw-semaphore owned by Media (spinning)
watchdog: BUG: soft lockup - CPU#N stuck for 26s! [Media:<tid>]  (100% system)

Resume failure:

NVRM: Assertion failed: 0 @ fbsr_gm107.c:1053
NVRM: [NV_ERR_GENERIC] from fbsrEnd_HAL @ mem_mgr_pwr_mgmt.c:270
NVRM: [NV_ERR_GENERIC] from memmgrRestorePowerMgmtState @ kern_mem_sys.c:1192
NVRM: [NV_ERR_GENERIC] from gpuStateLoad(... GPU_STATE_FLAGS_PRESERVING)
      @ gpu_suspend.c:281
[drm:nv_drm_atomic_commit] *ERROR* Flip event timeout on head 0

A relevant behavioural detail: the outcome depends on
NVreg_UseKernelSuspendNotifiers. The hang occurs either way, but recovery
differs consistently (4 occurrences, cleanly split):

UseKernelSuspendNotifiers sleep services outcome
1 (kernel notifiers) disabled self-recovers after ~3.5 min
0 (classic suspend.sh) enabled never recovers, hard power cycle

This suggests the ordering of the BAR2 teardown relative to freezing userspace
matters, and that the classic path leaves the framebuffer save in a state the
restore cannot handle at all.

To Reproduce

  • Preconditions: single Turing dGPU driving the panel directly (discrete-graphics
    firmware mode, no iGPU), Wayland (KWin), driver 610.57.04 open modules.
  • Run a Chromium-based application that keeps an active Media worker thread
    (reproduced with an Electron app, and separately with a Qt WebEngine app).
    Playing video raises the hit rate.
  • Suspend the system (systemctl suspend or lid close) while such a client is
    active at the moment the display blanks.
  • Confirmed the culprit by snapshotting all threads named Media immediately
    before suspend (a systemd system-sleep pre-hook) and matching the TID against
    the one named in the soft-lockup watchdog line.

Bug Incidence

Sometimes

nvidia-bug-report.log.gz

Not attached. I would prefer to provide targeted excerpts rather than the full
archive, which collects a large amount of unrelated system data. Please tell me
exactly which sections you need and I will supply them. (Noting the field is
marked required — happy to discuss what is genuinely necessary for triage.)

More Info

Expected behaviour: the suspend path should quiesce or reject new RM client
mapping operations before tearing down the BAR2 CPU mapping, so an in-flight
nv_drm_mmap() cannot end up spinning on a TLB invalidation that can no longer
be acknowledged. Failing that, kgmmuCheckPendingInvalidates_* should bail out
when the BAR2 mapping is absent instead of spinning until the soft-lockup
watchdog fires.

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions