nokyan / resources

Keep an eye on system resources
GNU General Public License v3.0
611 stars 46 forks source link

Nvidia RTD3 Power Management Unawareness Bug in Hybrid Graphics Laptops #207

Open funkemunky opened 2 months ago

funkemunky commented 2 months ago

Is there an existing issue for this?

Current Behavior

When I am opening Resources app, the nvidia GPU wakes up from suspension when it is not in use by any application. The nvidia gpu status stays active when in use.

Resources is not being rendered using the nvidia gpu, but its monitoring of the dedicated gpu results in it keeping it awake indefinitely.

Expected Behavior

The nvidia gpu should ideally not be awoken when not in use. I know that there might be a limitation with the nvidia driver preventing it from being monitored even though it is in use. However, a workaround could be implemented by hooking into the nvidia driver and checking to see if it is

1) Already awake 2) The reason it is awake 3) If the reason it is awake being Resources, stop monitoring.

Steps To Reproduce

  1. Check your PCI information for your nvidia card on your hybrid graphics system. I use "cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status". If it returns "suspended", the nvidia gpu is asleep.
  2. Open Resources application, and run the same command again. You will notice it returns "active", and does not stop.
  3. Check nvidia-smi to see if anything other than gnome-shell is being used, or on KDE if anything at all is being used. If either of the previous conditions are met, then it is Resources preventing rtd3 from suspending the GPU.

Environment

Program Version: 1.4.0
Package: Flatpak
System Version: Fedora 40 (all drivers and packages are up to date running their latest major versions).

*Hardware Information*
CPU: AMD Ryzen 7840H with 780m Radeon Graphics
GPU: NVidia 4060 
MEMORY: 6400MTs 32GB On-board memory
Storage: 1TB SY-Hynix NVME SSD

System Model: Lenovo Legion Slim 5 14" AMD

Anything else?

I would be happy to contribute any potential fixes and provide a test environment if you don't have an equivalent available.

nokyan commented 2 months ago

Hi, thanks for reporting the issue. I'd prefer having a switch somewhere on the GPU page to toggle automatic halting of monitoring. That switch could also say that enabling that could save battery life, otherwise it might be confusing for users as to why Resources seemingly randomly stops monitoring the GPU. But I'll definitely take this into consideration. :)

FiestaLake commented 1 month ago

Hi, thanks for reporting the issue. I'd prefer having a switch somewhere on the GPU page to toggle automatic halting of monitoring. That switch could also say that enabling that could save battery life, otherwise it might be confusing for users as to why Resources seemingly randomly stops monitoring the GPU. But I'll definitely take this into consideration. :)

You can also make it check "cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status" consistently and show zero usage if the gpu is in d3.