Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] nvidia-drivers and suspend to RAM
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
andi456
Apprentice
Apprentice


Joined: 06 Mar 2005
Posts: 219
Location: Germany

PostPosted: Fri Sep 20, 2024 7:38 pm    Post subject: [Solved] nvidia-drivers and suspend to RAM Reply with quote

Hi,

my habit using sys-power/hibernate-script to suspend my main machine to RAM after a while in order to not let the computer run without reason, cannot be kept up, if I do not change some configuration, but I don't know exactly how

When issuing suspend to ram, the machine immediately returns back to power on and dmesg tells me the following about the reason why:

Code:

NVRM: GPU 0000:06: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.
nvidia 0000:06:00.0: PM: pci_pm_suspend(): nvidia_isr_kthread_bh+0x560/0x810 [nvidia] returns -5
nvidia 0000:06:00.0: PM: dpm_run_callback(): pci_pm_suspend+0x0/0x150 returns -5
nvidia 0000:06:00.0: PM: failed to suspend: error -5
PM: Some devices failed to suspend, or early wake event detected

As far as I understand the README by nvidia, I've been lucky that s2ram has been working for so long, and now I have to somehow make suspend work via elogind, as I don't use systemd. Is there any documentation for that?

Kind regards.


Last edited by andi456 on Sat Sep 21, 2024 9:43 am; edited 1 time in total
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2816

PostPosted: Fri Sep 20, 2024 9:17 pm    Post subject: Reply with quote

The recent nvidia-drivers revbumps (-r1) had a one-time warning that you may have missed:
Code:
    if [[ ${REPLACING_VERSIONS##* } ]] &&
        ver_test ${REPLACING_VERSIONS##* } -lt 560.35.03-r1 # may get repeated
    then
        elog
        elog "For suspend/sleep, 'NVreg_PreserveVideoMemoryAllocations=1' is now default"
        elog "with this version of ${PN}. This is recommended (or required) by"
        elog "major DEs especially with wayland but, *if* experience regressions with"
        elog "suspend, try reverting to =0 in '${EROOT}/etc/modprobe.d/nvidia.conf'."
        elog
        elog "May notably be an issue when using neither systemd nor elogind to suspend."
        elog
        elog "Also, the systemd suspend/hibernate/resume services are now enabled by"
        elog "default, and for openrc+elogind a similar hook has been installed."
    fi
So you if you want to return to the previous behaviour and everything was fine "for you", then you can edit nvidia.conf to return to =0 then reboot.

As for elogind, `loginctl suspend` should work in theory (same as systemd). Not something I ever tried and most users been testing this using their DE's suspend/sleep button instead.

Alternatively, not familiar with hibernate-script, but in theory anything can be used if you can just make them call /usr/bin/nvidia-sleep.sh (takes suspend, hibernate, or resume as arguments) to do the same thing that elogind/systemd would be doing. I imagine calling sleep.sh resume may be difficult without some kind of "on resume" hooks w/ a daemon though.

Switching to =1 would be esp. needed if you ever plan to use wayland as resume otherwise (often) resullts in graphical corruption. Both Gnome and Plasma also recommend that this is set, which is why this is the new default. May matter less for simple setups.
Back to top
View user's profile Send private message
andi456
Apprentice
Apprentice


Joined: 06 Mar 2005
Posts: 219
Location: Germany

PostPosted: Sat Sep 21, 2024 9:42 am    Post subject: Reply with quote

Thanks for your quick answer. Indeed, I must have overlooked the new default in /etc/modprobe.d/nvidia.conf

I've set PreserveVideoMemoryAllocations back to 0 for now and will probably switch to the eloginctl method in the future, as the elogind-daemon is running anyway, although i use awesome wm.
Back to top
View user's profile Send private message
Frautoincnam
Guru
Guru


Joined: 19 May 2017
Posts: 314

PostPosted: Sun Sep 22, 2024 5:29 pm    Post subject: Reply with quote

I had the same problem although using elogind and loginctl suspend/hibernate (openrc and X11).
I had to set NVreg_PreserveVideoMemoryAllocations=0 to get a display back when waking up from hibernation, but entering suspend/hibernate and waking up from it are much slower than before. I hope a future update will fix the problem, but I won't know when to go back to NVreg_PreserveVideoMemoryAllocations=1.
Back to top
View user's profile Send private message
andi456
Apprentice
Apprentice


Joined: 06 Mar 2005
Posts: 219
Location: Germany

PostPosted: Mon Sep 23, 2024 3:50 pm    Post subject: Reply with quote

The wake up process is quite slow with NVreg_PreserveVideoMemoryAllocations=0

Well, one has to try from time to time to set it to 1 or so it seems in order to be able to try out wayland, for example. The latter also requires "options nvidia-drm modeset=0" which completely freezes my system on boot.
Back to top
View user's profile Send private message
Frautoincnam
Guru
Guru


Joined: 19 May 2017
Posts: 314

PostPosted: Mon Sep 23, 2024 5:00 pm    Post subject: Reply with quote

andi456 wrote:
The wake up process is quite slow with NVreg_PreserveVideoMemoryAllocations=0

I found that I can save 5sec on suspend/hibernate with InhibitDelayMaxSec=0

Quote:
Well, one has to try from time to time to set it to 1

Yes of course.

Quote:
or so it seems in order to be able to try out wayland, for example.

I have 3 monitors and the configuration with wayland was always a disaster each time I tried. I prefer not.

Quote:
The latter also requires "options nvidia-drm modeset=0" which completely freezes my system on boot.

Good to know. I'll try it with NVreg_PreserveVideoMemoryAllocations=1 to see.

Thanks.
Back to top
View user's profile Send private message
Ionen
Developer
Developer


Joined: 06 Dec 2018
Posts: 2816

PostPosted: Mon Sep 23, 2024 7:30 pm    Post subject: Reply with quote

andi456 wrote:
The wake up process is quite slow with NVreg_PreserveVideoMemoryAllocations=0

Well, one has to try from time to time to set it to 1 or so it seems in order to be able to try out wayland, for example. The latter also requires "options nvidia-drm modeset=0" which completely freezes my system on boot.
There could be something strange going on but... everything here sounds.. backward?

1. NVreg_PreserveVideoMemoryAllocations=1 (not =0), can be the one that is slower because (afaik) it saves+reload memory allocations to disk, and in the event of a slow device on /var/tmp it can be noticeable. Note that the path can be changed in nvidia.conf (to a faster device), tmpfs is also a potential option given enough space (not that this makes much sense for hibernation given tmpfs' ram will be saved to disk).

2. The latter requires modeset=0...? Does that refer to wayland? Because wayland *requires* modeset=1, nvidia-drivers also sets =1 by default with USE=wayland. Afaik there are not a whole lot of things that don't work with =1 nowadays, and there is little reason to use =0. The nvidia upstream default of =0 with USE=-wayland is only kept not to cause surprises given it's what it has been for decades and because NVIDIA docs still call it "experimental".. but at this point about all major distros default to =1 for wayland. It'd probably make sense to do modeset=1 regardles of USE=wayland like Allocations=1 at this point.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum