Comment 70 for bug 1765363

Revision history for this message
Vasyl (exposight) wrote :

I confirm the issue on Ubuntu 18.04 base with kernel 4.15.0-88, NVidia drivers 435.21 and 440.59 make no difference in the behavior. After 'prime-select intel' the nvidia driver is not loaded at all and intel graphcs are active, but according to PowerTop the NVIDIA chip still consumes the power. Acer laptop, NVidia 1050 Ti, Intel i5-7300HQ.

(TLDR: see SOLUTION at the end of the comment!)

Good thing is: as reported in comment #61 above by Vincente, command from PowerTop Tunables tab (Runtime PM for PCI device NVIDIA Corporation GP107M) actually helps to power off the NVidia chip and power consumption goes down by a ~10W. Unfortunately, that does not persist after system restart.

After checking the relevant NVidia driver manual http://us.download.nvidia.com/XFree86/Linux-x86_64/440.59/README/dynamicpowermanagement.html I have found that same command to enable the runtime power management which PowerTop uses:
 echo auto > /sys/bus/pci/devices/0000\:01\:00.0/power/control
or a variant with proper privileges:
 sudo sh -c 'echo auto > /sys/bus/pci/devices/0000:01:00.0/power/control'
That does the trick as well, so PowerTop is not needed to enable it.

GREAT THING AND THE SOLUTION: after reading the 'Automated Setup' section in the nvidia manual above, I have found a way to automate that. No bbswitch, no tlp tools, no extra scripts/services! Just create a file named 80-nvidia-poweroff.rules in /lib/udev/rules.d/ directory with the following content:

# Enable runtime PM for NVIDIA VGA/3D controller devices by default (if the driver is not / will not be bound)
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030000", DRIVER=="", TEST=="power/control", ATTR{power/control}="auto"
ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x030200", DRIVER=="", TEST=="power/control", ATTR{power/control}="auto"

Save and reboot the system. Done! The nvidia chip will be in power off mode already when you open the PowerTop to check that. And that will work only when the intel is selected as an active controller by prime-select tool, so should be safe when nvidia is set as active instead.

P.S. I wish this to be done automatically when installing the nvidia driver... No magic for installer to create that file.