You are not logged in.

#1 2023-05-04 04:32:07

Golui
Member
Registered: 2021-11-04
Posts: 3

nvidia-resume from hibernation not working with early KMS enabled

For some time now, when waking from sleep and/or suspend, some windows would be corrupted until redrawn. I have finally decided to investigate this annoyance.

This happens both on latest nvidia drivers (530xx) and the 525xx branch.

I tracked down the Tips_and_tricks#Preserve_video_memory_after_suspend Archwiki page and proceeded to implement it. Looked good! suspend was working flawlessly. It wasn't until a couple of days later that I decided to hibernate my system instead. When the system resumed, it seemed to have failed to load the hibernate image. Sure enough, journalctl confirmed that:

NVRM: GPU 0000:0d:00.0: PreserveVideoMemoryAllocations module parameter is set. System Power Management attempted without driver procfs suspend interface. Please refer to the 'Configuring Power Management Supp>
nvidia 0000:0d:00.0: PM: pci_pm_freeze(): nv_pmops_freeze+0x0/0x20 [nvidia] returns -5
nvidia 0000:0d:00.0: PM: dpm_run_callback(): pci_pm_freeze+0x0/0xc0 returns -5
nvidia 0000:0d:00.0: PM: failed to quiesce async: error -5

When diagnosing the issue, I stumbled upon nvidia-resume not working when recovering from hibernate forum topic, but the solutions did not work for me.

In fact, every resource I could find pointed to everything being set up correctly. What gives?

The cause:

After a few hours of debugging, I managed to track down the issue. It appears that having early KMS (which requires the nvidia module to be in the initramfs) has a bad interaction with PreserveVideoMemoryAllocations being enabled. The early-loaded nvidia driver is configured with the NVreg_PreserveVideoMemoryAllocations=1 parameter (set in /etc/modprobe.d/nvidia.conf), so it attempts to load the state from the hibernation image on its own, but this is done before the

/usr/lib/systemd/system-sleep/nvidia

hook is ran; possibly before the /proc/driver/nvidia/suspend interface exists (did not confirm this is the case) which could cause the above error. I can't immediately find any other nvidia kernel module parameters that would let me control when the resume happens.

Would anyone have any suggestions how to sidestep that issue?

Offline

#2 2023-06-14 19:47:13

Henry78
Member
From: Vienna
Registered: 2012-01-23
Posts: 65

Re: nvidia-resume from hibernation not working with early KMS enabled

@Golui: Did you solve this already? I just finished my journey through various bug trackers and forums to find - as you - every where the same answer about enabling the respective nvidia systemd services and other stuff that's already in the Arch-Wiki, which I followed.

Now I'm thinking of how to circumvent this, but up to now with no good idea.

Offline

#3 2023-07-23 00:33:55

Golui
Member
Registered: 2021-11-04
Posts: 3

Re: nvidia-resume from hibernation not working with early KMS enabled

No, not really, sadly.

Offline

#4 2023-07-31 01:17:33

archnoobbtw
Member
Registered: 2023-07-31
Posts: 1

Re: nvidia-resume from hibernation not working with early KMS enabled

I had the same problem, and you were right about the cause (early KMS). I stopped the early loading, and only used kernal parameter `nvidia_drm.modeset=1`. It can hibernate fine now.

Offline

#5 2025-07-07 00:05:57

MorningMC
Member
Registered: 2025-07-06
Posts: 3
Website

Re: nvidia-resume from hibernation not working with early KMS enabled

I also had the same problem. Instead using kernel parameters, I used "options nvidia-drm modeset=1" in the modprobe drop-in. Notice that there is a "options nvidia NVreg_PreserveVideoMemoryAllocations=1" in nvidia-sleep.conf, should I comment that?

Offline

#6 2025-07-07 01:33:26

MorningMC
Member
Registered: 2025-07-06
Posts: 3
Website

Re: nvidia-resume from hibernation not working with early KMS enabled

more information here:
modprobe config and drop-in:

# Main configuration file modprobe not found
# /usr/lib/modprobe.d/bluetooth-usb.conf
# use "reset=1" as default, since it should be safe for recent devices and
# solves all kind of problems.
options btusb reset=1

# /etc/modprobe.d/firewalld-sysctls.conf
install nf_conntrack /usr/bin/modprobe --ignore-install nf_conntrack $CMDLINE_OPTS && /sbin/sysctl --quiet --pattern 'net>

# /usr/lib/modprobe.d/nvidia-sleep.conf
# [url]https://download.nvidia.com/XFree86/Linux-x86_64/560.35.03/README/powermanagement.html#PreserveAllVide719f0[/url]
# Save and restore all video memory allocations.
options nvidia NVreg_PreserveVideoMemoryAllocations=1
#
# The destination should not be using tmpfs, so we prefer
# /var/tmp instead of /tmp
options nvidia NVreg_TemporaryFilePath=/var/tmp

# /usr/lib/modprobe.d/nvidia-utils.conf
blacklist nouveau
blacklist nova_core
blacklist nova_drm

# /etc/modprobe.d/nvidia.conf
# Enable early KMS
options nvidia_drm modeset=1

# /usr/lib/modprobe.d/systemd.conf
#  SPDX-License-Identifier: LGPL-2.1-or-later
#
#  This file is part of systemd.
#
#  systemd is free software; you can redistribute it and/or modify it
#  under the terms of the GNU Lesser General Public License as published by
#  the Free Software Foundation; either version 2.1 of the License, or
#  (at your option) any later version.
#
# When bonding module is loaded, it creates bond0 by default due to max_bonds
# option default value 1. This interferes with the network configuration
# management / networkd, as it is not possible to detect whether this bond0 was
# intentionally configured by the user, or should be managed by
# networkd/NM/etc. Therefore disable bond0 creation.

options bonding max_bonds=0

# Do the same for dummy0.

options dummy numdummies=0

# Do the same for ifb0.

options ifb numifbs=0

journalctl log output (keyword "PM: \|nvidia") until hibernation failed:

Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Registered nosave memory: [mem 0x00000000-0x00000fff]
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Registered nosave memory: [mem 0x0009f000-0x000fffff]
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Registered nosave memory: [mem 0x54592000-0x54772fff]
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Registered nosave memory: [mem 0x54a99000-0x54a99fff]
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Registered nosave memory: [mem 0x59f8b000-0x5a88afff]
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Registered nosave memory: [mem 0x5c6bf000-0x63ffefff]
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Registered nosave memory: [mem 0x64000000-0xffffffff]
Jul 05 17:56:04 MorningMC-Legion kernel: ACPI: PM: Registering ACPI NVS region [mem 0x5e6bf000-0x63ebefff] (92274688 bytes)
Jul 05 17:56:04 MorningMC-Legion kernel: PM: RTC time: 09:55:51, date: 2025-07-05
Jul 05 17:56:04 MorningMC-Legion kernel: ACPI: PM: (supports S0 S3 S4 S5)
Jul 05 17:56:04 MorningMC-Legion kernel: clocksource: acpi_pm: mask: 0xffffff max_cycles: 0xffffff, max_idle_ns: 2085701024 ns
Jul 05 17:56:04 MorningMC-Legion kernel: PM:   Magic number: 1:226:929
Jul 05 17:56:04 MorningMC-Legion kernel: PM: genpd: Disabling unused power domains
Jul 05 17:56:04 MorningMC-Legion kernel: nvidia: loading out-of-tree module taints kernel.
Jul 05 17:56:04 MorningMC-Legion kernel: nvidia: module verification failed: signature and/or required key missing - tainting kernel
Jul 05 17:56:04 MorningMC-Legion kernel: nvidia: unknown parameter 'NVreg_UseEDID' ignored
Jul 05 17:56:04 MorningMC-Legion kernel: nvidia-nvlink: Nvlink Core is being initialized, major device number 238
Jul 05 17:56:04 MorningMC-Legion kernel: nvidia 0000:02:00.0: enabling device (0000 -> 0003)
Jul 05 17:56:04 MorningMC-Legion kernel: nvidia 0000:02:00.0: vgaarb: VGA decodes changed: olddecodes=io+mem,decodes=none:owns=none
Jul 05 17:56:04 MorningMC-Legion kernel: NVRM: loading NVIDIA UNIX Open Kernel Module for x86_64  575.64.03  Release Build  (root@MorningMC-Legion)  
Jul 05 17:56:04 MorningMC-Legion kernel: nvidia-modeset: Loading NVIDIA UNIX Open Kernel Mode Setting Driver for x86_64  575.64.03  Release Build  (root@MorningMC-Legion)  
Jul 05 17:56:04 MorningMC-Legion kernel: [drm] [nvidia-drm] [GPU ID 0x00000200] Loading driver
Jul 05 17:56:04 MorningMC-Legion kernel: nvidia 0000:02:00.0: Enabling HDA controller
Jul 05 17:56:04 MorningMC-Legion kernel: nvidia-modeset: WARNING: GPU:0: Unable to read EDID for display device DP-0
Jul 05 17:56:04 MorningMC-Legion kernel: nvidia-modeset: WARNING: GPU:0: Unable to read EDID for display device DP-0
Jul 05 17:56:04 MorningMC-Legion kernel: [drm] Initialized nvidia-drm 0.0.0 for 0000:02:00.0 on minor 0
Jul 05 17:56:04 MorningMC-Legion kernel: nvidia 0000:02:00.0: [drm] Cannot find any crtc or sizes
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Image signature found, resuming
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: resume from hibernation
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Marking nosave pages: [mem 0x00000000-0x00000fff]
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Marking nosave pages: [mem 0x0009f000-0x000fffff]
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Marking nosave pages: [mem 0x54592000-0x54772fff]
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Marking nosave pages: [mem 0x54a99000-0x54a99fff]
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Marking nosave pages: [mem 0x59f8b000-0x5a88afff]
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Marking nosave pages: [mem 0x5c6bf000-0x63ffefff]
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Marking nosave pages: [mem 0x64000000-0xffffffff]
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Basic memory bitmaps created
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Using 3 thread(s) for lzo decompression
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Loading and decompressing image data (2094572 pages)...
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Image loading progress:   0%
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Image loading progress:  10%
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Image loading progress:  20%
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Image loading progress:  30%
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Image loading progress:  40%
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Image loading progress:  50%
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Image loading progress:  60%
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Image loading progress:  70%
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Image loading progress:  80%
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Image loading progress:  90%
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Image loading progress: 100%
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Image loading done
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Read 8378288 kbytes in 5.36 seconds (1563.11 MB/s)
Jul 05 17:56:04 MorningMC-Legion kernel: PM: Image successfully loaded
Jul 05 17:56:04 MorningMC-Legion kernel: nvidia 0000:02:00.0: PM: pci_pm_freeze(): nv_pmops_freeze [nvidia] returns -5
Jul 05 17:56:04 MorningMC-Legion kernel: nvidia 0000:02:00.0: PM: dpm_run_callback(): pci_pm_freeze returns -5
Jul 05 17:56:04 MorningMC-Legion kernel: nvidia 0000:02:00.0: PM: failed to quiesce async: error -5
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Failed to load image, recovering.
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: Basic memory bitmaps freed
Jul 05 17:56:04 MorningMC-Legion kernel: PM: hibernation: resume failed (-5)
Jul 05 17:56:04 MorningMC-Legion systemd[1]: Starting Load/Save Screen Backlight Brightness of backlight:nvidia_0...
Jul 05 17:56:04 MorningMC-Legion systemd[1]: Finished Load/Save Screen Backlight Brightness of backlight:nvidia_0.

According to hyprland wiki, I kept early KMS as well. how can I solve this problem without disabling Nvidia support?

Last edited by MorningMC (2025-07-07 01:35:50)

Offline

#7 2025-07-07 06:07:29

seth
Member
Registered: 2012-09-03
Posts: 66,079

Re: nvidia-resume from hibernation not working with early KMS enabled

Disable EarlyMKS, delay the hyprland start until the GPU is setup (eg. iffff you actually run into such problems "while ! nvidia-smi; do sleep 0.3; done; exec Hyprland")

Offline

#8 2025-07-08 11:09:15

MorningMC
Member
Registered: 2025-07-06
Posts: 3
Website

Re: nvidia-resume from hibernation not working with early KMS enabled

ok problem solved
just add these codes in /usr/share/sddm/scripts/wayland-session before executing Hyprland

# Launch Nvidia modules
modprobe nvidia_drm nvidia_modeset nvidia_uvm nvidia

if command -v nvidia-smi &> /dev/null; then
    # Wait for Nvidia driver initalized
    while ! nvidia-smi &> /dev/null; 
        do sleep 0.3; 
    done
fi

also turn on modeset and disable NVreg_PreserveVideoMemoryAllocations

Offline

Board footer

Powered by FluxBB