stockmind / dell-xps-9560-ubuntu-respin

Collection of scripts and tweaks to adapt Ubuntu and Linux Mint ISO images to let them run smooth on Dell XPS 15 9560.
345 stars 155 forks source link

Completely turn off nvidia gpu #60

Open LoafingBunny opened 5 years ago

LoafingBunny commented 5 years ago

Hi, today I managed to turn off the nvidia gpu, so as to have a power consumption of ~8W as reported by powertop. When the gpu is on, the power used is ~15W so effectively reducing by half the battery time.

I'm not totally sure how, can be many factors, I'll try to describe them here also as a reminder for me

So, first of all, update the kernel (5.0.0-25-generic) and the nvidia driver (430.26):

I removed bumblebee and bbswitch.

Blacklist all modules related to nvidia as described here : https://wiki.archlinux.org/index.php/Dell_XPS_15_9570#Manually_loading/unloading_NVIDIA_module Because I'm using wayland I didn't care about the x11 settings. I copy the three files required:

# /etc/modprobe.d/disable-ipmi.conf

install ipmi_msghandler /usr/bin/false
install ipmi_devintf /usr/bin/false

# /etc/modprobe.d/disable-nvidia.conf

install nvidia /bin/false

# /etc/modprobe.d/blacklist.conf

blacklist nouveau
blacklist rivafb
blacklist nvidiafb
blacklist rivatv
blacklist nv
blacklist nvidia
blacklist nvidia-drm
blacklist nvidia-modeset
blacklist nvidia-uvm
blacklist ipmi_msghandler
blacklist ipmi_devintf

ok, now when the gpu is on (power usage high) you can remove it with this command:

tee /sys/bus/pci/devices/0000\:01\:00.0/remove <<<1 alternatively also work to remove all the related nvidia modules:

rmmod nvidia-drm
rmmod nvidia-uvm
rmmod nvidia-modeset
rmmod nvidia

Now the gpu is off, as you should see from powertop. To re-enable it at any time, first rescan

tee /sys/bus/pci/rescan <<<1

now when I call nvidia-smi it automatically loads the drivers too, and the gpu turns on. Note that some additional fine tuning might be required, but everything is written in the link.