diff --git a/_posts/sysadm/2023-11-17-cooling-down-thinkpad-p1-gen-5.tl b/_posts/sysadm/2023-11-17-cooling-down-thinkpad-p1-gen-5.tl new file mode 100644 index 0000000..e854035 --- /dev/null +++ b/_posts/sysadm/2023-11-17-cooling-down-thinkpad-p1-gen-5.tl @@ -0,0 +1,92 @@ +--- +layout: default +title: Cooling down ThinkPad P1 gen 5 +date: 2023-11-17 21:58 +0100 +tags: ThinkPad +--- +P1 heats up considerably, even when running on battery. This makes it unpleasant +to hold on your lap, puts stress on NVME drives, and even causes the keyboard +keys to get hot. + +h2. Power off discrete GPU. + +* "Hybrid graphics - Archlinux wiki":https://wiki.archlinux.org/title/Hybrid_graphics#Fully_Power_Down_Discrete_GPU +* "optimus-switch - Github":https://github.com/dglt1/optimus-switch +* "Intel - Gentoo wiki":https://wiki.gentoo.org/wiki/Intel +* "Intel graphics - Archlinux wiki":https://wiki.archlinux.org/title/intel_graphics + +It's impossible to turn off Nvidia GPU through BIOS. Energy consumption of +discrete GPU can be monitored with: + +{% highlight bash %} +nvidia-smi +{% endhighlight %} + +In reality the above value (4W on battery, 5W on AC in desktop environment) seems to be +underestimation. Powering off the dGPU using steps below changes energy +consumption reported by @powertop@ from *24W before* to *16W after* on battery. + +# Make sure kernel driver for Intel GPU is compiled (@DRM_I915@). + +#_ Remove _/etc/modprobe.d/nvidia.conf_ if present. + +#_ Blacklist @nvidia@ kernel modules and configure @i915@ appropriately. + +{% highlight file caption=/etc/modprobe.d/intel.conf %} +blacklist nouveau +blacklist ttm +install nvidia /bin/false +install nvidia-modeset /bin/false +install nvidia-peermem /bin/false +install nvidia-drm /bin/false +install nvidia-uvm /bin/false + +# Stops display from "blinking" or "flashing" +# during boot when using the intel driver. +options i915 enable_fbc=1 +options i915 fastboot=1 +{% endhighlight %} + +#_ Configure _xorg_ to use Intel device with @modesetting@ driver +(@xf86-video-intel@ is outdated and does not suppot hardwware acceleration on +newer GPU models). Use @lspci@ to find bus ID of Intel GPU. + +{% highlight file caption=/etc/X11/xorg.conf.d/20intel.conf %} +Section "Device" + Identifier "Intel Graphics" + Driver "modesetting" + BusID "PCI:0:2:0" + #Option "AccelMethod" "glamor" # default + #Option "TearFree" "true" +EndSection +{% endhighlight %} + +#_ Power off Nvidia PCI device on every boot using _udev_ rules. + +{% highlight file caption=/etc/udev/rules.d/00-nvidia-remove.rules %} +# Remove NVIDIA USB xHCI Host Controller devices, if present +ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c0330", ATTR{power/control}="auto", ATTR{remove}="1" + +# Remove NVIDIA USB Type-C UCSI devices, if present +ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x0c8000", ATTR{power/control}="auto", ATTR{remove}="1" + +# Remove NVIDIA Audio devices, if present +ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x040300", ATTR{power/control}="auto", ATTR{remove}="1" + +# Remove NVIDIA VGA/3D controller devices +ACTION=="add", SUBSYSTEM=="pci", ATTR{vendor}=="0x10de", ATTR{class}=="0x03[0-9]*", ATTR{power/control}="auto", ATTR{remove}="1" +{% endhighlight %} + +#_ Regenerate _initramfs_ and reboot. + +{% highlight bash %} +genkernel initramfs +reboot +{% endhighlight %} + + +h2. Limit CPU/platform/integrated GPU energy usage with @tlp@ + +Active seetings can be verified using: +* @tlp-stat -p@ for CPU and platform, +* @tlp-stat -g@ for GPU