ThinkPad P1 (maybe X1?) Gen 4 configuration + reducing CPU usage

Hello everyone,

For the interest of the community, I managed to get my new P1 to a working state. Issues:
- can't fully disable NVIDIA (options are hybrid or dedicated, no Intel-only option)
- extreme number of interrupts eating constantly 10% of CPU time.

Investigation:
drm interrupt errors in dmesg
iichid driver also generating lots of interruptions
issues starting X

Solutions so far:

For the GPU, X configuration:
Section "Device"
Identifier "Card0"
Option "DPMS"
Code:
Driver "intel" (or "modesetting" - both work)
BusID "PCI:0@0:2:0"
EndSection

Clearing drm interrupt warnings in dmesg (information from Arch linux forums):
In /boot/loader.conf:
hw.i915kms.enable_dc=0
compat.linuxkpi.i915_enable_dc=0

Unfortunately, I couldn't get iichid to calm down (maybe need to tweak pooling times, but this is a project for later me), so I just killed iichid:
module_blacklist="iichid"
I am ok with the trackpoint only, so the trackpad is dead weight for now.

Now the fans are off in normal use and estimated battery life is now at 3h30 (my W530 gets 5h on a 10 years old battery).
To check:
- review hpstate configuration when on battery.
- confirm the nvidia is really off, maybe possible via ACPI commands.

Any suggestions, please share.
 
This seems to kill the NVIDIA GPU (I have the A2000):
acpi_call -p "\_SB.PC00.PEG1.PEGP._OFF"

Now my estimated battery life is 300 minutes. =)
 
I'm on P1 Gen 2 with NVIDIA as well. Would you mind sharing your loader.conf/rc.conf/sysctl.conf, of course, P1 focused parts only? I'm interested.
 
I am back to zero on this. Something else is going on. I think it was false alarm.

The system is fresh and absolutely nothing is installed except clean openbox. I did a quick install of prusa-slicer just to see how the GPU behaves and confirm I am getting acceleration.

I applied all power saving shenanigans on both system level and on the Intel driver. I am aware of and I boot at 5W idle on powermon.
When I use acpi_call to kill the NVIDIA, I am idling at ~2W. (X not loaded)

However, at the moment I load i915kms, I start having these spikes in CPU power. Interrupts are normal, top is at 0.1%.
The CPU goes to 5W (powermon) then every 3-4 seconds it has these spikes of 30W. (X not loaded)

So I installed the NVIDIA drivers (nvidia-modeset) and I get the same behavior. A few seconds of 5W and then spikes. Of course, if I load X and start prusa slicer, it is much faster with the nvidia.

Most of the time, I will be using the computer connected to power and since CPU utilization is not high, I suppose I am not going to lose performance by the spikes? Otherwise, I might for a while run this installation through virtualbox under windows (my soul hurts) and see if the push for freebsd laptop support bears fruit. Then I can go back to a physical boot.

The only thing missing for me to revalidate is the Linux S3 sleep mode in the BIOS.

In comparison, my W530 on FreeBSD and configured as per Vermaden's tutorials lasts for 4-5h on a 10 years old battery on normal tasks (aggressive CPU throttling) and 1:30-2h on the NVIDIA. The CPU idles at 4-5W (powermon) regardless of nvidia or i915kms. Meh, if the W530 had ECC, I'd stay with it.

will get back
 
It seems that the culprit is the Intel driver. The spikes are less frequent and the system rest at quite low levels with using modesetting.

With all optimizations applied, I got 4:30h of battery life during my usual daily routine: some coding, building a few things from ports, many browser tabs, Geany, 3-4 terminal windows, under Openbox. The computer was quite warm.
I get 5 hours on the W530 and its prehistorical battery. =)

Then I tried the same workload under VirtualBox (I assigned the physical partitions to the VM, RAIDZ on both nvmes working ok) and I got 6 hours. I expect, once FreeBSD drivers are as optimized as they are for the old W530, that we could easily get 9-10 hours. A very light workload gives me 8h under Windows on this laptop.
Another advantage is that the laptop runs much cooler and sometimes the fans even go off.

So, for now, I will settle with virtualization. I tested that I can easily reboot bare metal and I will be periodically trying to see the state of things. Maybe I will boot bare metal when docked, will see. =)

The settings I used for best battery life (they may be a bit extreme or even inadequate - I am not so experienced):

/etc/rc.conf:
powerd_enable="YES" (powerdxx did not work)
powerd_flags="-n adaptive -a adaptive -b adaptive" (keeps heat lower)
performance_cx_lowest="Cmax" (also to keep heat and noise lower - not good for performance if connected to power ofc)
economy_cx_lowest="Cmax"
devmatch_blacklist="iichid" (the touchpad driver goes crazy on the interruptions as of now)

/etc/sysctl.conf:
dev.hwpstate_intel.0.epp=100
dev.hwpstate_intel.1.epp=100
(repeat for all threads)

/boot/loader.conf:
hw.pci.do_power_nodriver=3
machdep.hwpstate_pkg_ctrl=0
hw.acpi.cpu.cppc_notify=0
net.bluetooth.usb_isoc_enable=0 (also reduced interrupts)
hw.psm.synaptics_support=0 (probably redundant since I blacklisted the driver)
module_blacklist="iicihd"
vfs.zfs.prefetch_disable=1
hw.i915kms.enable_dc=0
compat.linuxkpi.i915_enable_dc=0
(not sure if I need to use both settings pairs)
hw.i915kms.enable_fbc=1
compat.linuxkpi.i915_enable_fbc=1
kw.i915kms.fastboot=1
compat.linuxkpi.i915_fastboot=1
hw.i915kms.enable_psr=1
compat.linuxkpi.i915_enable_psr=1

X config for modesetting:
Section "Device"
Identifier "Card0"
Option "DPMS"
Driver "modesetting"
BusID "PCI:0@0:2:0"
EndSection
(you can get the bus ID via pciconf)

X config for the NVIDIA (with Intel disabled - I have not driven a display in hybrid mode - secondary driver pooped on me when I tried blender)
Section "Device"
Identifier "Device0"
Driver "nvidia"
VendorName "NVIDIA Corporation"
EndSection

Section "Monitor"
Identifier "Monitor0"
Option "DPMS"
EndSection

Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "Monitor0"
EndSection

arandr seems to work fine after X is already loaded.
 
vermaden no problem - I thank you. Your guides assisted me on migrating to freebsd. =)
Anything else I could have missed, in terms of settings?

I will periodically boot bare metal and report back in case of improvements. In any case , virtualization is here to save the day. I won't deny credit where credit is due: Windows makes a very good platform for a hypervisor, at least when it comes to power consumption, both on hyper-v and virtualbox (the ones I've tried).
 
Back
Top