Graphics and some graphics card functionality broken after computer is put to sleep for a long period of time

Hello.

I am running into an issue with my NVIDIA GPU on linux, it seems when my computer is put to sleep for a long period of time, some functionality breaks, I’ll provide some examples of this that comes to mind.

I run the KDE plasma desktop environment, when I put my computer to sleep, typically overnight and bring it back up, sometimes NVENC encoding will no longer work in OBS.

When starting up certain applications (has been especially noticed when starting up Counter-strike: Global Offensive and Counter-strike: Source) the window manager freezes as well as the KDE toolbar, unable to open new applications or interact with any part of the window manager, only being able to alt-tab between existing applications for a long period of time even after such applications have been closed.
Sometimes because of this, my microphone will also stop working until the window manager restarts itself or I reboot.

I have also opened a bug report with the KDE developers and they confirmed this is happening due to an NVIDIA.
I cannot link this bug report because as a new user here I am not allowed to post more than one link. If you’d like me to link it let me know.

below I have attached the output from running nvidia-bug-report.sh

nvidia-bug-report.log.gz (877.0 KB)

Linux distribution: Void Linux x86_64 glibc
Kernel version: 6.0.12_1
NVIDIA Driver Version: 525.60.11
NVML Version: 12.525.60.11

Thanks.

Known bug in the nvidia-uvm module, workaround creating a script to unload it on suspend. Or rmmod/insmod it after resume.

Please check if enabling
https://download.nvidia.com/XFree86/Linux-x86_64/495.44/README/powermanagement.html
fixes it.
There also seems to be an issue with your usb ports after resume so your mouse and webcam report errors. Please check for a bios update.

Hi, thanks for the reply and suggested workarounds.
my mouse never has issues, however I believe my webcam is genuinely faulty (I suspect a wiring issue) so pay no mind to that :).
I will give your suggested workarounds a try and report back.
How would you suggest I unload the uvm module on suspend without doing it manually everytime?

https://blog.christophersmart.com/2016/05/11/running-scripts-before-and-after-suspend-with-systemd/

ah my system doesnt use systemd, i will have to figure out another way, thanks anyway!