linrunner / TLP

TLP - Optimize Linux Laptop Battery Life
https://linrunner.de/tlp
GNU General Public License v2.0
2.51k stars 129 forks source link

TLP / Kernel 6.2 / Gentoo #671

Closed anathonous closed 1 year ago

anathonous commented 1 year ago

Describe the bug

scaling_max_freq gets set to 400mhz and isn't switching.

Expected behavior

pstate settings should change.

To Reproduce

Steps to reproduce the unexpected behavior:

Does the problem occur on battery or AC or both? Both

Actions to reproduce the behaviour. Boot computer t

--- TLP 1.5.0 --------------------------------------------

+++ Processor CPU model = Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver = intel_pstate /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor = performance /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = performance powersave /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq = 400000 [kHz] /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq = 2900000 [kHz] /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference = performance [HWP.EPP] /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power

/sys/devices/system/cpu/cpu1..cpu3: omitted for clarity, use -v to show all

/sys/devices/system/cpu/intel_pstate/status = active /sys/devices/system/cpu/intel_pstate/min_perf_pct = 13 [%] /sys/devices/system/cpu/intel_pstate/max_perf_pct = 100 [%] /sys/devices/system/cpu/intel_pstate/no_turbo = 0 /sys/devices/system/cpu/intel_pstate/hwp_dynamic_boost = 1 /sys/devices/system/cpu/intel_pstate/turbo_pct = 23 [%] /sys/devices/system/cpu/intel_pstate/num_pstates = 27

/sys/module/workqueue/parameters/power_efficient = N /proc/sys/kernel/nmi_watchdog = 1

+++ Platform Profile /sys/firmware/acpi/platform_profile = (not available) /sys/firmware/acpi/platform_profile_choices = (not available) /sys/devices/platform/thinkpad_acpi/dytc_lapmode = (not available) Additional context

It's a Lenovo X1 Carbon Gen 5 with Gen 9 Intel Skylake. The issue appears to be with the way pstate max_freq and minfreq are set for the scaling driver.

I can manually go in and set it. /sys/devices/system/cpu/cpufreq/policy0/scaling_max_freq

Any insight would be great. I am using 6.2 RC 3 on Gentoo ~amd64 Testing. -Nate

linrunner commented 1 year ago

Your issue cannot be processed without complete outputs as described in the issue template.

Provide them via https://gist.github.com/ please.

anathonous commented 1 year ago

sudo tlp-stat --- TLP 1.5.0 --------------------------------------------

+++ Configured Settings: /etc/tlp.conf L0029: TLP_ENABLE="0" defaults.conf L0005: TLP_WARN_LEVEL="3" defaults.conf L0006: TLP_PERSISTENT_DEFAULT="0" defaults.conf L0007: DISK_IDLE_SECS_ON_AC="0" defaults.conf L0008: DISK_IDLE_SECS_ON_BAT="2" defaults.conf L0009: MAX_LOST_WORK_SECS_ON_AC="15" defaults.conf L0010: MAX_LOST_WORK_SECS_ON_BAT="60" /etc/tlp.conf L0116: CPU_ENERGY_PERF_POLICY_ON_AC="performance" /etc/tlp.conf L0117: CPU_ENERGY_PERF_POLICY_ON_BAT="balance_power" /etc/tlp.conf L0152: SCHED_POWERSAVE_ON_AC="0" /etc/tlp.conf L0153: SCHED_POWERSAVE_ON_BAT="1" defaults.conf L0015: NMI_WATCHDOG="0" /etc/tlp.conf L0177: DISK_DEVICES="nvme0n1 sda" /etc/tlp.conf L0185: DISK_APM_LEVEL_ON_AC="254 254" /etc/tlp.conf L0186: DISK_APM_LEVEL_ON_BAT="128 128" /etc/tlp.conf L0196: DISK_APM_CLASS_DENYLIST="usb ieee1394" /etc/tlp.conf L0225: DISK_IOSCHED="mq-deadline mq-deadline" defaults.conf L0021: SATA_LINKPWR_ON_AC="med_power_with_dipm max_performance" defaults.conf L0022: SATA_LINKPWR_ON_BAT="med_power_with_dipm min_power" /etc/tlp.conf L0254: AHCI_RUNTIME_PM_ON_AC="on" /etc/tlp.conf L0255: AHCI_RUNTIME_PM_ON_BAT="auto" /etc/tlp.conf L0261: AHCI_RUNTIME_PM_TIMEOUT="15" /etc/tlp.conf L0343: PCIE_ASPM_ON_AC="performance" /etc/tlp.conf L0344: PCIE_ASPM_ON_BAT="powersave" defaults.conf L0028: RADEON_DPM_PERF_LEVEL_ON_AC="auto" defaults.conf L0029: RADEON_DPM_PERF_LEVEL_ON_BAT="auto" defaults.conf L0030: RADEON_POWER_PROFILE_ON_AC="default" defaults.conf L0031: RADEON_POWER_PROFILE_ON_BAT="default" /etc/tlp.conf L0315: WIFI_PWR_ON_AC="off" /etc/tlp.conf L0316: WIFI_PWR_ON_BAT="on" /etc/tlp.conf L0321: WOL_DISABLE="Y" /etc/tlp.conf L0329: SOUND_POWER_SAVE_ON_AC="0" /etc/tlp.conf L0330: SOUND_POWER_SAVE_ON_BAT="1" defaults.conf L0037: SOUND_POWER_SAVE_CONTROLLER="Y" /etc/tlp.conf L0269: BAY_POWEROFF_ON_AC="0" /etc/tlp.conf L0270: BAY_POWEROFF_ON_BAT="0" defaults.conf L0040: BAY_DEVICE="sr0" /etc/tlp.conf L0349: RUNTIME_PM_ON_AC="on" /etc/tlp.conf L0350: RUNTIME_PM_ON_BAT="auto" defaults.conf L0043: RUNTIME_PM_DRIVER_DENYLIST="mei_me nouveau radeon" /etc/tlp.conf L0381: USB_AUTOSUSPEND="1" defaults.conf L0045: USB_EXCLUDE_AUDIO="1" defaults.conf L0046: USB_EXCLUDE_BTUSB="0" defaults.conf L0047: USB_EXCLUDE_PHONE="0" defaults.conf L0048: USB_EXCLUDE_PRINTER="1" defaults.conf L0049: USB_EXCLUDE_WWAN="0" defaults.conf L0050: USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN="0" defaults.conf L0051: RESTORE_DEVICE_STATE_ON_STARTUP="0" defaults.conf L0052: RESTORE_THRESHOLDS_ON_BAT="0" defaults.conf L0053: NATACPI_ENABLE="1" defaults.conf L0054: TPACPI_ENABLE="1" defaults.conf L0055: TPSMAPI_ENABLE="1" /etc/tlp.conf L0087: CPU_SCALING_GOVERNOR_ON_AC="schedutil" /etc/tlp.conf L0088: CPU_SCALING_GOVERNOR_ON_BAT="schedutil" /etc/tlp.conf L0099: CPU_SCALING_MIN_FREQ_ON_AC="0" /etc/tlp.conf L0100: CPU_SCALING_MAX_FREQ_ON_AC="100" /etc/tlp.conf L0101: CPU_SCALING_MIN_FREQ_ON_BAT="0" /etc/tlp.conf L0102: CPU_SCALING_MAX_FREQ_ON_BAT="90" /etc/tlp.conf L0126: CPU_MIN_PERF_ON_AC="0" /etc/tlp.conf L0127: CPU_MAX_PERF_ON_AC="100" /etc/tlp.conf L0128: CPU_MIN_PERF_ON_BAT="0" /etc/tlp.conf L0129: CPU_MAX_PERF_ON_BAT="75" /etc/tlp.conf L0136: CPU_BOOST_ON_AC="1" /etc/tlp.conf L0137: CPU_BOOST_ON_BAT="1" /etc/tlp.conf L0145: CPU_HWP_DYN_BOOST_ON_AC="1" /etc/tlp.conf L0146: CPU_HWP_DYN_BOOST_ON_BAT="1" /etc/tlp.conf L0169: PLATFORM_PROFILE_ON_AC="performance" /etc/tlp.conf L0170: PLATFORM_PROFILE_ON_BAT="balanced" /etc/tlp.conf L0282: INTEL_GPU_MIN_FREQ_ON_AC="300" /etc/tlp.conf L0283: INTEL_GPU_MIN_FREQ_ON_BAT="300" /etc/tlp.conf L0284: INTEL_GPU_MAX_FREQ_ON_AC="1000" /etc/tlp.conf L0285: INTEL_GPU_MAX_FREQ_ON_BAT="800" /etc/tlp.conf L0286: INTEL_GPU_BOOST_FREQ_ON_AC="1000" /etc/tlp.conf L0287: INTEL_GPU_BOOST_FREQ_ON_BAT="800" /etc/tlp.conf L0468: DEVICES_TO_ENABLE_ON_AC="bluetooth nfc wifi wwan" /etc/tlp.conf L0532: DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan" /etc/tlp.conf L0538: DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan" /etc/tlp.conf L0555: DEVICES_TO_ENABLE_ON_UNDOCK="wifi" /etc/tlp.conf L0552: DEVICES_TO_DISABLE_ON_DOCK="wifi wwan"

+++ System Info System = LENOVO ThinkPad X1C 5th W10DG 20K3S00V00 BIOS = N1MET72W (1.57 ) OS Release = Gentoo Linux Kernel = 6.2.0-rc3-x86_64 #5 SMP PREEMPT_DYNAMIC Sat Jan 14 02:50:02 CST 2023 x86_64 /proc/cmdline = BOOT_IMAGE=/vmlinuz-6.2.0-rc3-x86_64 root=UUID=de4e762b-0bae-4cbe-863d-f67ce6939c6c ro rootflags=subvol=activeroot crypt_root=UUID=9dd20dc5-0bfc-4dab-9a50-2b2d92f996c3 splash quiet Init system = systemd Boot mode = UEFI

+++ TLP Status State = disabled RDW state = disabled (TLP disabled) Last run = 09:14:53 AM, 3043 sec(s) ago Mode = AC Power source = AC

Error: tlp.service is not enabled, power saving will not apply on boot.

Invoke 'systemctl enable tlp.service' to correct this!

***Warning: laptop-mode-tools detected, this may cause conflicts with TLP. Please uninstall laptop-mode-tools.

+++ Processor CPU model = Intel(R) Core(TM) i5-6300U CPU @ 2.40GHz

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver = intel_pstate /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor = performance /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = performance powersave /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq = 400000 [kHz] /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq = 2900000 [kHz] /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_preference = performance [HWP.EPP] /sys/devices/system/cpu/cpu0/cpufreq/energy_performance_available_preferences = default performance balance_performance balance_power power

/sys/devices/system/cpu/cpu1..cpu3: omitted for clarity, use -v to show all

/sys/devices/system/cpu/intel_pstate/status = active /sys/devices/system/cpu/intel_pstate/min_perf_pct = 13 [%] /sys/devices/system/cpu/intel_pstate/max_perf_pct = 100 [%] /sys/devices/system/cpu/intel_pstate/no_turbo = 0 /sys/devices/system/cpu/intel_pstate/hwp_dynamic_boost = 1 /sys/devices/system/cpu/intel_pstate/turbo_pct = 23 [%] /sys/devices/system/cpu/intel_pstate/num_pstates = 27

/sys/module/workqueue/parameters/power_efficient = N /proc/sys/kernel/nmi_watchdog = 1

+++ Platform Profile /sys/firmware/acpi/platform_profile = (not available) /sys/firmware/acpi/platform_profile_choices = (not available) /sys/devices/platform/thinkpad_acpi/dytc_lapmode = (not available)

+++ Temperatures /proc/acpi/ibm/thermal = 79 -128 0 0 0 0 0 0 [°C] /proc/acpi/ibm/fan = 5567 [/min]

+++ File System /proc/sys/vm/laptop_mode = 0 /proc/sys/vm/dirty_writeback_centisecs = 500 /proc/sys/vm/dirty_expire_centisecs = 3000 /proc/sys/vm/dirty_ratio = 40 /proc/sys/vm/dirty_background_ratio = 10

+++ Disks Devices = nvme0n1 sda

/dev/nvme0n1: Type = NVMe Disk ID = nvme-WD_BLACK_SN750_SE_1TB_22015N800418 Model = WD_BLACK SN750 SE 1TB
Firmware = 711250WD Temp = 56 °C Scheduler = none [mq-deadline] kyber bfq (multi queue)

Runtime PM: /sys/block/nvme0n1/device/power/control = on, autosuspend_delay_ms = (not available)

/dev/sda: not present.

+++ Intel Graphics /sys/class/drm/card0/device/driver = i915

/sys/class/drm/card0/power/rc6_enable = 1 (enabled) /sys/module/i915/parameters/enable_fbc = 1 (enabled) /sys/kernel/debug/dri/0/i915_edp_psr_status = PSR mode: disabled

/sys/class/drm/card0/gt_min_freq_mhz = 300 [MHz] /sys/class/drm/card0/gt_max_freq_mhz = 1000 [MHz] /sys/class/drm/card0/gt_boost_freq_mhz = 1000 [MHz] /sys/class/drm/card0/gt_RPn_freq_mhz = 300 [MHz] (GPU min) /sys/class/drm/card0/gt_RP0_freq_mhz = 1000 [MHz] (GPU max)

+++ Wireless bluetooth = on nfc = none (no device) wifi = off (software) wwan = none (no device)

hci0(btusb) : bluetooth, connected wlp4s0(iwlwifi) : wifi, not connected, power management = unknown

+++ Audio /sys/module/snd_hda_intel/parameters/power_save = 0 /sys/module/snd_hda_intel/parameters/power_save_controller = N

+++ PCIe Active State Power Management /sys/module/pcie_aspm/parameters/policy = [default] performance powersave powersupersave (using BIOS preferences)

+++ PCIe Runtime Power Management Enable devices = (disabled) Disable devices = (disabled) Device denylist = (disabled) Driver denylist = mei_me nouveau radeon

/sys/bus/pci/devices/0000:00:00.0/power/control = on (0x060000, Host bridge, skl_uncore) /sys/bus/pci/devices/0000:00:02.0/power/control = on (0x030000, VGA compatible controller, i915) /sys/bus/pci/devices/0000:00:08.0/power/control = on (0x088000, System peripheral, no driver) /sys/bus/pci/devices/0000:00:14.0/power/control = on (0x0c0330, USB controller, xhci_hcd) /sys/bus/pci/devices/0000:00:14.2/power/control = on (0x118000, Signal processing controller, intel_pch_thermal) /sys/bus/pci/devices/0000:00:16.0/power/control = on (0x078000, Communication controller, mei_me) /sys/bus/pci/devices/0000:00:1c.0/power/control = on (0x060400, PCI bridge, pcieport) /sys/bus/pci/devices/0000:00:1c.2/power/control = on (0x060400, PCI bridge, pcieport) /sys/bus/pci/devices/0000:00:1c.4/power/control = on (0x060400, PCI bridge, pcieport) /sys/bus/pci/devices/0000:00:1d.0/power/control = on (0x060400, PCI bridge, pcieport) /sys/bus/pci/devices/0000:00:1f.0/power/control = on (0x060100, ISA bridge, no driver) /sys/bus/pci/devices/0000:00:1f.2/power/control = on (0x058000, Memory controller, no driver) /sys/bus/pci/devices/0000:00:1f.3/power/control = on (0x040300, Audio device, snd_hda_intel) /sys/bus/pci/devices/0000:00:1f.4/power/control = on (0x0c0500, SMBus, i801_smbus) /sys/bus/pci/devices/0000:00:1f.6/power/control = on (0x020000, Ethernet controller, e1000e) /sys/bus/pci/devices/0000:02:00.0/power/control = on (0xff0000, Unassigned class [ff00], rtsx_pci) /sys/bus/pci/devices/0000:04:00.0/power/control = on (0x028000, Network controller, iwlwifi) /sys/bus/pci/devices/0000:05:00.0/power/control = on (0x010802, Non-Volatile memory controller, nvme) /sys/bus/pci/devices/0000:06:00.0/power/control = on (0x060400, PCI bridge, pcieport) /sys/bus/pci/devices/0000:07:00.0/power/control = on (0x060400, PCI bridge, pcieport) /sys/bus/pci/devices/0000:07:01.0/power/control = on (0x060400, PCI bridge, pcieport) /sys/bus/pci/devices/0000:07:02.0/power/control = on (0x060400, PCI bridge, pcieport) /sys/bus/pci/devices/0000:07:04.0/power/control = on (0x060400, PCI bridge, pcieport) /sys/bus/pci/devices/0000:3c:00.0/power/control = on (0x0c0330, USB controller, xhci_hcd)

+++ USB Autosuspend = enabled Device allowlist = (not configured) Device denylist = (not configured) Exclude audio = enabled Exclude bluetooth = disabled Exclude phones = disabled Exclude printers = enabled Exclude WWAN = disabled

Bus 003 Device 003 ID 0bda:8153 control = on, autosuspend_delay_ms = 0 -- Realtek Semiconductor Corp. RTL8153 Gigabit Ethernet Adapter (r8152) Bus 003 Device 002 ID 05e3:0626 control = auto, autosuspend_delay_ms = 0 -- Genesys Logic, Inc. Hub (hub) Bus 003 Device 001 ID 1d6b:0003 control = on, autosuspend_delay_ms = 0 -- Linux Foundation 3.0 root hub (hub) Bus 001 Device 006 ID 1d5c:7102 control = on, autosuspend_delay_ms = 0 -- Fresco Logic Generic Billboard Device (no driver) Bus 001 Device 005 ID 1395:005d control = on, autosuspend_delay_ms = 2000 -- DSEA A/S Sennheiser Main Audio (snd-usb-audio, usbhid) Bus 001 Device 004 ID 1a40:0801 control = auto, autosuspend_delay_ms = 0 -- Terminus Technology Inc. USB 2.0 Hub (hub) Bus 001 Device 003 ID 046d:c52b control = on, autosuspend_delay_ms = 2000 -- Logitech, Inc. Unifying Receiver (usbhid) Bus 001 Device 002 ID 05e3:0610 control = auto, autosuspend_delay_ms = 0 -- Genesys Logic, Inc. Hub (hub) Bus 001 Device 001 ID 1d6b:0002 control = on, autosuspend_delay_ms = 0 -- Linux Foundation 2.0 root hub (hub) Bus 004 Device 001 ID 1d6b:0003 control = on, autosuspend_delay_ms = 0 -- Linux Foundation 3.0 root hub (hub) Bus 002 Device 006 ID 138a:0097 control = on, autosuspend_delay_ms = 0 -- Validity Sensors, Inc. (no driver) Bus 002 Device 005 ID 13d3:5682 control = on, autosuspend_delay_ms = 0 -- IMC Networks SunplusIT Integrated Camera (uvcvideo) Bus 002 Device 004 ID 8087:0a2b control = on, autosuspend_delay_ms = 0 -- Intel Corp. Bluetooth wireless interface (btusb) Bus 002 Device 003 ID 046d:08e5 control = on, autosuspend_delay_ms = 0 -- Logitech, Inc. C920 PRO HD Webcam (uvcvideo, snd-usb-audio) Bus 002 Device 002 ID 046d:c548 control = on, autosuspend_delay_ms = 2000 -- Logitech, Inc. USB Receiver (usbhid) Bus 002 Device 001 ID 1d6b:0002 control = on, autosuspend_delay_ms = 0 -- Linux Foundation 2.0 root hub (hub)

+++ Battery Care Plugin: thinkpad Supported features: charge thresholds, recalibration Driver usage:

+++ ThinkPad Battery Status: BAT0 (Main / Internal) /sys/class/power_supply/BAT0/manufacturer = SMP /sys/class/power_supply/BAT0/model_name = 01AV431 /sys/class/power_supply/BAT0/cycle_count = 552 /sys/class/power_supply/BAT0/energy_full_design = 57020 [mWh] /sys/class/power_supply/BAT0/energy_full = 46620 [mWh] /sys/class/power_supply/BAT0/energy_now = 44680 [mWh] /sys/class/power_supply/BAT0/power_now = 0 [mW] /sys/class/power_supply/BAT0/status = Not charging

/sys/class/power_supply/BAT0/charge_control_start_threshold = 96 [%] /sys/class/power_supply/BAT0/charge_control_end_threshold = 100 [%] /sys/class/power_supply/BAT0/charge_behaviour = [auto] inhibit-charge force-discharge

Charge = 95.8 [%] Capacity = 81.8 [%]

+++ Recommendations

nkoch@Space ~ $

linrunner commented 1 year ago

Until you fix this, there will be no support here:

Error: tlp.service is not enabled, power saving will not apply on boot. Invoke 'systemctl enable tlp.service' to correct this!

*Warning: laptop-mode-tools detected, this may cause conflicts with TLP. Please uninstall laptop-mode-tools.**

Afterwards I need the outputs for AC and battery operation, as the template says. I would also like to point out that outputs should be provided via Gist, otherwise it will get too messy and long here. Thanks.

anathonous commented 1 year ago

CPU_SCALING_FREQ was the issue. They need to be commented out. I got help on reddit.

linrunner commented 1 year ago

Just for the record: you've got quite a lot of issues with your configuration.

/etc/tlp.conf L0087: CPU_SCALING_GOVERNOR_ON_AC="schedutil" /etc/tlp.conf L0088: CPU_SCALING_GOVERNOR_ON_BAT="schedutil"

The _intelpstate driver does not provide a schedutil scaling governor. So your setting is ignored CPU ends up with the performance governor:

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver = intel_pstate /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor = performance /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = performance powersave

Which means no power saving and max CPU frequency all the time together with the side effect that these settings won't apply:

/etc/tlp.conf L0116: CPU_ENERGY_PERF_POLICY_ON_AC="performance" /etc/tlp.conf L0117: CPU_ENERGY_PERF_POLICY_ON_BAT="balance_power"

You have already noticed these invalid values, frequencies must be in kHz, otherwise the driver ignores them.

/etc/tlp.conf L0100: CPU_SCALING_MAX_FREQ_ON_AC="100" /etc/tlp.conf L0102: CPU_SCALING_MAX_FREQ_ON_BAT="90"

I recommend to either set frequencies or limit performance by percentage, but not both:

/etc/tlp.conf L0127: CPU_MAX_PERF_ON_AC="100" /etc/tlp.conf L0129: CPU_MAX_PERF_ON_BAT="75"

Since the performance governor is active, it doesn't really matter what you configured, the driver will ignore it anyway. Use powersave instead.

Good luck.

anathonous commented 1 year ago

https://wiki.gentoo.org/wiki/User:Nathanlkoch/Tutorials/Lenovo/Hardware/X1Carbon5thGen

I'm using a conjunction of both laptop-mode and tlp. laptop-mode has some nice exec features. I will keep tweaking.

Thank you.

linrunner commented 1 year ago

Of course, you are free to do so. But please spare me issues about the unpredictable results of such a system configuration.