bayasdev / envycontrol

Easy GPU switching for Nvidia Optimus laptops under Linux
https://bayas.dev/envycontrol
MIT License
1.18k stars 60 forks source link

[BUG] Nvidia dGPU not powering down in hybrid mode #96

Open DreamingCuttlefish opened 1 year ago

DreamingCuttlefish commented 1 year ago

Describe the bug When I set envycontrol to hybrid mode, the nvidia gpu does not power down and continues to suck around 11W of power in the background. This does not occur in integrated mode.

To Reproduce Steps to reproduce the behavior:

  1. Run sudo envycontrol -s hybrid --dm sddm --rtd3 3
  2. reboot
  3. check powertop/nvtop/nvidia-smi
  4. see high power usage of the nvidia gpu, listed as being used by Xorg in nvidia-smi

Expected behavior The nvidia gpu should be powered off unless it is actively being used by an application

Screenshots Screenshot_20230330_020410 image image image

System Information:


**Additional context**
Add any other context about the problem here. If possible try to reproduce the problem with `--verbose` flag and attach its output.

n/a

DreamingCuttlefish commented 1 year ago

Also; the laptop will not suspend in hybrid mode either.

bayasdev commented 1 year ago

Try with a different value for the rtd3 flag

DreamingCuttlefish commented 1 year ago

Try with a different value for the rtd3 flag

I've tried setting rtd3 to 1, 2, and 3 (no reason to try 0) and all of them return the same result when I run nvidia-smi in terms of gpu power usage

bayasdev commented 1 year ago

Try with a different value for the rtd3 flag

I've tried setting rtd3 to 1, 2, and 3 (no reason to try 0) and all of them return the same result when I run nvidia-smi in terms of gpu power usage

AFAIK nvidia-smi wakes up the GPU (even on Windows)

Try

sudo cat /sys/bus/pci/devices/0000:01:00.0/power/runtime_status
DreamingCuttlefish commented 1 year ago

Here's the output running that command right after rebooting my laptop: image

jSQrD-dev commented 1 year ago

I'm having the same issue.

Operating System: EndeavourOS 
KDE Plasma Version: 5.27.3
KDE Frameworks Version: 5.104.0
Qt Version: 5.15.8
Kernel Version: 6.2.8-zen1-1-zen (64-bit)
Graphics Platform: X11
Processors: 16 × Intel® Core™ i7-10875H CPU @ 2.30GHz
Memory: 15.4 GiB of RAM
Graphics Processor: Mesa Intel® UHD Graphics, NVIDIA GeForce RTX 2060 with Max-Q Design/PCIe/SSE2
Manufacturer: Dell Inc.
Product Name: XPS 17 9700

My laptop also refuses to sleep or hibernate because of this issue.

[ 211.472546] nvidia 0000:01:08.8: PM: pci_pm_suspend(): nv_pmops_suspend+8x8/0xf8 [nvidia] returns -5
[ 211.472901] nvidia 0000:01:00.0: PM: dpm_run_callback(): pci_pm_suspend+0x0/0x1c8 returns -5
[ 211.472986] nvidia 0000:01:00.0: PM: failed to suspend async: error -5
[ 213.086448] PM: Some devices failed to suspend, or early wake event detected
[ 214.418818] nvidia 0000:01:00.0: PM: pci_pm_suspend(): nv_pmops_suspend+0x0/0xf8 [nvidia] returns -5
[ 214.411152] nvidia 0000:01:00.0: PM: dpm_run_callback(): pci_pm_suspend+8x8/0x1c0 returns -5
[ 214.411158] nvidia 0000:01:00.0: PM: failed to suspend async: error -5
[ 214.689623] PM: Some devices failed to suspend, or early wake event detected
[ 473.114476] nvidia 8800:01:08.8: PM: pci_pm_suspend(): nv_pmops_suspend+8x0/0xf0 [nvidial returns. -5
[ 473.114817] nvidia 8800:01:08.8: PM: dpm_run_callback(): pci_pm_suspend+0x8/0x1c8 returns -5
[ 473.114822] nvidia 0888:01:00.0: PM: failed to suspend async: error -5
[
474.7111451 PM: Some devices failed to suspend, or early wake event detected
[ 476.238492] nvidia 8800:01:08.8: PM: pci_pm_suspend(): nv_pmops_suspend+8x8/8xf8 [nvidia] returns -5
[
476.232369] nvidia 0888:01:08.8: PM: dpm_run_callback(): pci_pm_suspend+0x8/8x1c8 returns -5
[
476.232376] nvidia 8888:81:88.8: PM: failed to suspend async: error -5
[ 476.518286] PM: Some devices failed to suspend, or early wake event detected
[488.571695] nvidia 0800:01:00.0: PM: pci_pm_suspend(): nv pmops_suspend+8x8/0xf0 [nvidia] returns -5
[488.572835] nvidia 8800:01:08.8: PM: dpm_run_callback(): pci_pm_suspend+0x0/0x1c0 returns -5
488.572848] nvidia 8888:81:88.8: PM: failed to suspend async: error -5
488.782814] PM: Some devices failed to suspend, or early wake event detected
[
[ 498.878667] nvidia 8888:81:88.8: PM: pci_pm_suspend(): nv_pmops_suspend+0x0/0xf0 [nvidia] returns -5
498.8718811 nvidia 8888:81:88.8: PM: dpm_run_callback(): pci_pm_suspend+8x0/0x1c0 returns -5
498.871887] nvidia 8888:81:88.8: PM: failed to suspend async: error -5
[
[
[ 498.286859] PM: Some devices failed to suspend, or early wake event detected
[
497.8853151 ACPI Error: Thread 3384661248 cannot release Mutex [ECMX] acquired by thread 1705034240 (28221828/exmutex-378)
497.8853911 ACPI Error: Aborting method _SB.PC18.LPCB.ECDV._066 due to previous error (AE_AML_NOT_OHNER) (28221820/psparse-529) 498.751962] Bluetooth: hci8: Opcode 8x c24 failed: -110
[
[ 498.751972] Bluetooth: hci0: command 8x8488 tx timeout
[
498.767386] Bluetooth: hci8: Opcode 8x 488 failed: -187
[ 498.784417] Bluetooth: hci8: Suspend notifier action (3) failed: -107
[ 498.785315) Bluetooth: hci8: unexpected event for opcode 8x2042
bayasdev commented 1 year ago

@J-SQRD-Dev

sudo systemctl enable nvidia-{suspend,resume,hibernate}
jSQrD-dev commented 1 year ago

@bayasdev Thank you.