Occassional failure to resume: pci_pm_suspend(): nv_pmops_suspend+0x0/0x20 [nvidia] returns -5

Hello,

every now and again my desktop will fail to resume with the following entries in the log:

[15552.939528] NVRM: GPU 0000:09:00.0: PreserveVideoMemoryAllocations module parameter is set. System Power Management attempted without driver procfs suspend interface. Please refer to the 'Configuring Power Management Support' section in the driver README.
[15552.939533] PM: pci_pm_suspend(): nv_pmops_suspend+0x0/0x20 [nvidia] returns -5
[15552.939756] PM: dpm_run_callback(): pci_pm_suspend+0x0/0x160 returns -5
[15552.939766] nvidia 0000:09:00.0: PM: failed to suspend async: error -5
[15552.939826] PM: Some devices failed to suspend, or early wake event detected

I am on Fedora 34 x86_64, 470.63.01 driver and and RTX 2070. Here is my nvidia-bug-report.log.gz (1.1 MB). Any ideas what night be causing this? Thanks.

It turns out that the RPM Fusion package has enabled PreserveVideoMemoryAllocations but for some reason the systemd units did not get enabled on my machine. Enabling them has fixed my issue.

I’m having the same issue, but I don’t see what you mean by “enabling the systemd units”. Could you please provide more details about the solution?

To be more precise: since upgrading recently my Fedora, I had a systematic error when putting the computer to sleep, everytime: the screen would show some kernel messages, then flash a few times (trying to do something and failing), and I’d end up with the lock screen showing once again, and the computer still on, but keyboard/mouse/trackpad completely unresponsive. No way to do Ctrl+Alt+Del, Ctrl+Alt+F2, etc. So I had to force shutdown my computer (holding the power button for a few seconds) and restart.

I tried following some recommendations from another page which said to write to sudo emacs /etc/modprobe.d/nvidia-power-management.conf the following line:

options nvidia NVreg_PreserveVideoMemoryAllocations=1 NVreg_TemporaryFilePath=/tmp/nvidia

It didn’t help. So I disabled the option:

options nvidia PreserveVideoMemoryAllocations=0

And I am again able to put the computer to sleep and resume it.

But I’d like to not have to do it manually, since it’s probably going to break something in the future. If your solution is better, I’d please like to know what it is.

For

NVreg_PreserveVideoMemoryAllocations=1

to work properly, you need to enable the 3 systemd units (nvidia-suspend, nvidia-hibernate and nvidia-resume) with systemctl enable. So:

systemctl enable nvidia-suspend

and so on. You can find more details in chapter 21 of the readme.