Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TLP drastically reduces disk performance when on battery #776

Open
JeanLuX opened this issue Dec 30, 2024 · 3 comments
Open

TLP drastically reduces disk performance when on battery #776

JeanLuX opened this issue Dec 30, 2024 · 3 comments

Comments

@JeanLuX
Copy link

JeanLuX commented Dec 30, 2024

Hello,

I’ve been using TLP for a while, and I suspected that it was significantly slowing down disk performance when I was on battery.

I spent the whole afternoon investigating this suspicion, and it turns out that it is indeed the case, and quite significantly so.

I deliberately set the same values for the disk and CPU parameters in both battery (BAT) and AC modes, yet the issue persists.

Here is a screenshot showing the best performance (from 3 iterations) achieved in the different modes. :

ℹ️ Look for my actual (effective) configuration
# /var/run/tlp/run.conf
TLP_ENABLE="1"
TLP_WARN_LEVEL="3"
TLP_PERSISTENT_DEFAULT="0"
DISK_IDLE_SECS_ON_AC="0"
DISK_IDLE_SECS_ON_BAT="0"
MAX_LOST_WORK_SECS_ON_AC="15"
MAX_LOST_WORK_SECS_ON_BAT="15"
CPU_ENERGY_PERF_POLICY_ON_AC="balance_performance"
CPU_ENERGY_PERF_POLICY_ON_BAT="balance_performance"
NMI_WATCHDOG="0"
DISK_DEVICES=""
DISK_APM_LEVEL_ON_AC="254 254"
DISK_APM_LEVEL_ON_BAT="254 254"
DISK_APM_CLASS_DENYLIST="usb ieee1394"
DISK_IOSCHED="keep keep"
SATA_LINKPWR_ON_AC="med_power_with_dipm"
SATA_LINKPWR_ON_BAT="med_power_with_dipm"
AHCI_RUNTIME_PM_ON_AC="on"
AHCI_RUNTIME_PM_ON_BAT="on"
AHCI_RUNTIME_PM_TIMEOUT="15"
PCIE_ASPM_ON_AC="default"
PCIE_ASPM_ON_BAT="default"
RADEON_DPM_PERF_LEVEL_ON_AC="auto"
RADEON_DPM_PERF_LEVEL_ON_BAT="auto"
RADEON_POWER_PROFILE_ON_AC="default"
RADEON_POWER_PROFILE_ON_BAT="low"
WIFI_PWR_ON_AC="off"
WIFI_PWR_ON_BAT="on"
WOL_DISABLE="Y"
SOUND_POWER_SAVE_ON_AC="1"
SOUND_POWER_SAVE_ON_BAT="1"
SOUND_POWER_SAVE_CONTROLLER="Y"
BAY_POWEROFF_ON_AC="0"
BAY_POWEROFF_ON_BAT="0"
BAY_DEVICE="sr0"
RUNTIME_PM_ON_AC="on"
RUNTIME_PM_ON_BAT="on"
RUNTIME_PM_DRIVER_DENYLIST="mei_me nouveau radeon"
USB_AUTOSUSPEND="1"
USB_EXCLUDE_AUDIO="1"
USB_EXCLUDE_BTUSB="0"
USB_EXCLUDE_PHONE="0"
USB_EXCLUDE_PRINTER="1"
USB_EXCLUDE_WWAN="0"
RESTORE_DEVICE_STATE_ON_STARTUP="0"
RESTORE_THRESHOLDS_ON_BAT="0"
NATACPI_ENABLE="1"
TPACPI_ENABLE="1"
TPSMAPI_ENABLE="1"
PLATFORM_PROFILE_ON_BAT="quiet"
PLATFORM_PROFILE_ON_AC="quiet"
CPU_SCALING_GOVERNOR_ON_AC="ondemand"
CPU_SCALING_GOVERNOR_ON_BAT="ondemand"
CPU_SCALING_MAX_FREQ_ON_AC="3201000"
CPU_BOOST_ON_AC="0"
CPU_BOOST_ON_BAT="0"
RUNTIME_PM_ENABLE="03:00.0 03:00.1"
RUNTIME_PM_DENYLIST="06:00.0"

When I disable TLP (with TLP_ENABLE=0) or uninstall it, I get the correct disk performance in all situations, whether on battery or plugged in.

I’ve searched through the official documentation, but I can’t find any parameter that could explain this behavior.
Moreover, since the disk and CPU settings are identical, I should be getting similar results whether the computer is plugged into the wall or on battery. Also, I don't have this issue on Windows 11 23h2 .

Thus, the only explanation I can find is that TLP is affecting more than just these parameters within the system, though I can’t pinpoint exactly where. It seems to be an additional feature causing this issue, and we don’t have the option to fix it through the settings provided by TLP.

Expected behavior

Normally, by using the same disk and CPU settings for both AC and BAT modes, the disk performance should not be affected and should remain similar.

Additional context

System information:
Fedora Linux 41 Kinoite (41.20241228.0)
KDE Plasma version: 6.2.4
KDE Frameworks version: 6.9.0
Qt version: 6.8.1
Kernel version: 6.12.6-200.fc41.x86_64
Graphics Platform: Wayland
CPU: AMD Ryzen 7 6800HS
dGPU: AMD Radeon RX 6700S (disabled)
Memory: 24 GiB
Laptop model: ASUS GA402RJ_GA402RJ
Network card: Mediatek® Wi-Fi 6E MT7922
Disk: NVMe Crucial P3 Plus SSD 4To PCIe Gen4 (CT4000P3PSSD801)
Filesystem: BTRFS on LUKS
TLP 1.6.1 (installed with rpm-ostree install tlp)

@linrunner
Copy link
Owner

linrunner commented Jan 3, 2025

Hi,

very strange indeed. And no, TLP does not touch any hidden tunables, everything can be seen in the output of tlp-stat.

But maybe just writing a certain tunable, regardless of the value, causes the symptoms. Perhaps in conjunction between kernel and firmware/BIOS, if the latter possibly makes changes depending on the power source.

I can only suggest trying around and deactivating individual settings completely using a blank string, as you have already done for the disk parameters. You'll have to reboot after every change.

My first suspect would be

PLATFORM_PROFILE_ON_AC=
PLATFORM_PROFILE_ON_BAT=

Platform profile is implemented by the firmware/BIOS.

Good luck.

@JeanLuX
Copy link
Author

JeanLuX commented Jan 7, 2025

Hello,

Thank you for your response.
I had already looked into the "Platform Profile" option. Regardless of whether it's set to Quiet, Balanced, or Performance, the issue persists: disk performance remains reduced when on battery power, no matter the mode.

On my laptop model, these profiles only affect the thermal envelope allocated to the CPU and GPU, as well as the fan speed/hysteresis. Nothing else.

It is only after uninstalling or disabling TLP that I achieve the same performance levels on battery and AC power.

However, I noticed that tweaking CPU_SCALING_GOVERNOR_ON_BAT can slightly improve the situation. As a result, I made some adjustments to these parameters, which provide better battery performance, but it still doesn’t match the full performance level available when plugged in or within Windows (on BAT/AC)

ℹ️ New (effective) configuration
# /var/run/tlp/run.conf
AHCI_RUNTIME_PM_ON_AC="on"
AHCI_RUNTIME_PM_ON_BAT="on"
AHCI_RUNTIME_PM_TIMEOUT="15"
BAY_DEVICE="sr0"
BAY_POWEROFF_ON_AC="0"
BAY_POWEROFF_ON_BAT="0"
CPU_BOOST_ON_AC="0"
CPU_BOOST_ON_BAT="0"
CPU_ENERGY_PERF_POLICY_ON_AC="balance_performance"
CPU_ENERGY_PERF_POLICY_ON_BAT=""
CPU_SCALING_MAX_FREQ_ON_AC="3201000"
DISK_APM_CLASS_DENYLIST="usb ieee1394"
DISK_APM_LEVEL_ON_AC="254 254"
DISK_APM_LEVEL_ON_BAT="128 128"
DISK_DEVICES="nvme0n1"
DISK_IDLE_SECS_ON_AC="0"
DISK_IDLE_SECS_ON_BAT="2"
DISK_IOSCHED="keep keep"
MAX_LOST_WORK_SECS_ON_AC="15"
MAX_LOST_WORK_SECS_ON_BAT="60"
NATACPI_ENABLE="1"
NMI_WATCHDOG="0"
PCIE_ASPM_ON_AC="default"
PCIE_ASPM_ON_BAT="default"
PLATFORM_PROFILE_ON_AC="balanced"
PLATFORM_PROFILE_ON_BAT=""
RADEON_DPM_PERF_LEVEL_ON_AC="auto"
RADEON_DPM_PERF_LEVEL_ON_BAT="auto"
RADEON_POWER_PROFILE_ON_AC="default"
RADEON_POWER_PROFILE_ON_BAT="default"
RESTORE_DEVICE_STATE_ON_STARTUP="0"
RESTORE_THRESHOLDS_ON_BAT="0"
RUNTIME_PM_DISABLE="00:02.4 06:00.0"
RUNTIME_PM_DRIVER_DENYLIST="nouveau radeon"
RUNTIME_PM_ENABLE="03:00.0 03:00.1"
RUNTIME_PM_ON_AC="on"
RUNTIME_PM_ON_BAT="auto"
SATA_LINKPWR_ON_AC="med_power_with_dipm"
SATA_LINKPWR_ON_BAT="med_power_with_dipm"
SOUND_POWER_SAVE_CONTROLLER="Y"
SOUND_POWER_SAVE_ON_AC="1"
SOUND_POWER_SAVE_ON_BAT="1"
START_CHARGE_THRESH_BAT0="40"
STOP_CHARGE_THRESH_BAT0="60"
TLP_ENABLE="1"
TLP_PERSISTENT_DEFAULT="0"
TLP_WARN_LEVEL="3"
TPACPI_ENABLE="1"
TPSMAPI_ENABLE="1"
USB_AUTOSUSPEND="1"
USB_EXCLUDE_AUDIO="1"
USB_EXCLUDE_BTUSB="0"
USB_EXCLUDE_PHONE="0"
USB_EXCLUDE_PRINTER="1"
USB_EXCLUDE_WWAN="0"
WIFI_PWR_ON_AC="off"
WIFI_PWR_ON_BAT="on"
WOL_DISABLE="Y"

image

@linrunner
Copy link
Owner

linrunner commented Jan 10, 2025

You didn't even respond to my suggestion to deactivate individual settings. Did you try it?

Btw, the clearest representation to show your changes to the defaults is:

tlp-stat --cdiff

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants