NVIDIA / NVIDIA/open-gpu-kernel-modules

[Bug]: Hibernation fails with error -5 (missing PM_RESTORE_PREPARE) and 0x11 (empty runlist) on hybrid graphics with NVreg_UseKernelSuspendNotifiers=1

Open
#1,335 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.4k
Forks
1.9k
PR merge metrics
No merged PRs in 30d

Description

NVIDIA Open GPU Kernel Modules Version

610.57.04 (and 610.x branch)

Proprietary Driver Confirmation
  • I confirm that this specific combination of kernel suspend notifiers and hibernation restore failure manifests on the open kernel module branch.
Operating System and Version

Arch Linux / Omarchy (rolling, 2026.08)

Kernel Release

Linux marine 7.1.8-arch1-3 #1 SMP PREEMPT_DYNAMIC Tue, 11 Aug 2026 09:16:08 +0000 x86_64 GNU/Linux (Arch official stable package)

Kernel Stable Confirmation
  • I am running on a stable kernel release.
Hardware: GPU

GPU 0: NVIDIA GeForce GTX 1660 Ti with Max-Q Design (UUID: GPU-66d37982-4edb-5b4f-ba35-24a1b878426f, TU116M)
Host platform: Hybrid laptop (AMD Ryzen 7 3750H APU driving desktop display via eDP, NVIDIA dGPU in RTD3 dynamic power management).


Describe the bug

When running nvidia-open 610.x on hybrid graphics with NVreg_UseKernelSuspendNotifiers=1 and NVreg_PreserveVideoMemoryAllocations=1, system hibernation fails through two distinct architectural issues:

  1. Hibernation Resume Aborts with Error -5 (-EIO / NV_ERR_NOT_SUPPORTED):
    During resume from hibernation, the kernel loads the saved image into temporary memory and calls pci_pm_freeze() -> nv_pmops_freeze() on all PCI devices before executing atomic restoration. Because nv_pm_notifier() does not handle PM_RESTORE_PREPARE, nv_suspend_devices() never executes in the resume kernel. nv_pmops_freeze() passes is_procfs_suspend = NV_FALSE, causing nvidia_suspend() to trip the assertion:

    NVRM: GPU 0000:01:00.0: PreserveVideoMemoryAllocations module parameter is set.
          System Power Management attempted without driver procfs suspend interface.
    nvidia 0000:01:00.0: PM: pci_pm_freeze(): nv_pmops_freeze [nvidia] returns -5
    PM: hibernation: resume failed (-5)
    

    The kernel aborts restoration and drops into a cold boot.

  2. Hibernation / Sleep Entry Aborts with Error 0x11 (NV_ERR_INVALID_STATE):
    On hybrid graphics laptops where Wayland/X11 renders on the integrated GPU, the secondary discrete GPU is idle in Runtime D3 with zero active user FIFO channels. During PM_HIBERNATION_PREPARE or PM_SUSPEND_PREPARE, nv_suspend_devices() calls nv_preempt_user_channels(), which executes rm_stop_user_channels(). When invoked on an empty usermode channel list, the Resource Manager returns NV_ERR_INVALID_STATE (0x11). nv_pm_notifier() treats 0x11 as a fatal failure and returns NOTIFY_BAD, aborting the host sleep transition (rtcwake: write error).


To Reproduce
  1. Configure /etc/modprobe.d/nvidia.conf:
    options nvidia NVreg_PreserveVideoMemoryAllocations=1
    options nvidia NVreg_UseKernelSuspendNotifiers=1
    options nvidia NVreg_DynamicPowerManagement=0x02
    
  2. Ensure display server runs on iGPU (PRIME offload), leaving dGPU in RTD3 suspended status.
  3. Trigger hibernation (e.g. systemctl hibernate or rtcwake -m disk -s 120).
  4. Observe rtcwake: write error due to NVRM: PM hibernate notifier failed: 0x11.
  5. If notifier passes, observe resume kernel aborting with nv_pmops_freeze returns -5 during swapfile image restoration.
Bug Incidence

Always (100% reproducible on 610.57.04).


Deep Technical Analysis & Root Cause
Issue 1: Missing PM_RESTORE_PREPARE and PM_POST_RESTORE in nv_pm_notifier

In kernel-open/nvidia/nv.c (lines 4472–4495):

switch (event) {
case PM_SUSPEND_PREPARE:
    power_state = NV_POWER_STATE_IN_STANDBY;
    name = "suspend";
    break;

case PM_HIBERNATION_PREPARE:
    power_state = NV_POWER_STATE_IN_HIBERNATE;
    name = "hibernate";
    break;

case PM_POST_SUSPEND:
case PM_POST_HIBERNATION:
    power_state = NV_POWER_STATE_RUNNING;
    name = "resume";
    break;

default:
    return NOTIFY_DONE;
}

During hibernation resume (software_resume() in kernel/power/hibernate.c), the Linux PM core does not dispatch PM_HIBERNATION_PREPARE. It dispatches PM_RESTORE_PREPARE (and later PM_POST_RESTORE).
Because nv_pm_notifier() does not handle PM_RESTORE_PREPARE, it falls into default: return NOTIFY_DONE.
Consequently:

  • nv_suspend_devices() never runs in the boot kernel.
  • NV_FLAG_SUSPENDED remains unset.
  • When pci_pm_freeze() is called, nv_pmops_freeze() calls nvidia_suspend(dev, NV_PM_ACTION_HIBERNATE, NV_FALSE).
  • Line 4652 trips: !is_procfs_suspend is true (and procfs was omitted by NVreg_UseKernelSuspendNotifiers), returning -EIO (-5) and causing the restore to abort.
Issue 2: Empty Runlist Handling in rm_stop_user_channels

In src/nvidia/arch/nvalloc/unix/src/osapi.c (lines 2815–2843):
When rm_stop_user_channels() is called on an idle dGPU with zero open channels (or if pNv->rmapi.hClient == 0), RmUnixRmApiPrologue() returns NULL or NV2080_CTRL_CMD_FIFO_DISABLE_USERMODE_CHANNELS evaluates against an empty list, returning NV_ERR_INVALID_STATE (0x11).
In nv_pm_notifier(), nv_set_system_power_state() returns 0x11, which triggers NOTIFY_BAD and cancels the OS sleep transition.


Proposed Architectural Direction
  1. Handle PM_RESTORE_PREPARE / PM_POST_RESTORE:
    Expand nv_pm_notifier() in kernel-open/nvidia/nv.c to handle PM_RESTORE_PREPARE identically to PM_HIBERNATION_PREPARE, and PM_POST_RESTORE identically to PM_POST_HIBERNATION. This ensures nv_suspend_devices() properly orchestrates the pre-restore quiesce and sets NV_FLAG_SUSPENDED before nv_pmops_freeze() is called.
  2. Handle Empty Channels Gracefully in RM:
    In src/nvidia/arch/nvalloc/unix/src/osapi.c, make rm_stop_user_channels() and rm_restart_user_channels() check if the client channel count is 0 or if the device is in RTD3 with no active usermode allocations, and return NV_OK (no-op) instead of failing with NV_ERR_INVALID_STATE.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in kernel-open/nvidia/nv.c at nv_pm_notifier() and compare the hibernation and restore events described in the issue. Then read rm_stop_user_channels() and rm_restart_user_channels() in src/nvidia/arch/nvalloc/unix/src/osapi.c, reproducing with the listed module parameters on a hybrid GPU system. Done means hibernation resume no longer returns -5 and sleep entry succeeds when the dGPU has no active user channels.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
operating-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
65/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.