You are not logged in.

#1 2017-04-07 23:06:12

blahhumbug
Member
Registered: 2016-10-08
Posts: 64

TLP: CPU_SCALING_MIN_FREQ_ON_BAT not working after suspend/resume

I'm using TLP and kernel 4.10.8.  On a fresh boot, when the laptop (XPS 9360) is on battery, the CPU frequencies drop to 800mhz at idle.  This matches my TLP configuration:

> grep CPU_SCALING /etc/default/tlp
CPU_SCALING_GOVERNOR_ON_AC=performance
CPU_SCALING_GOVERNOR_ON_BAT=powersave
CPU_SCALING_MIN_FREQ_ON_AC=1000000
CPU_SCALING_MAX_FREQ_ON_AC=3500000
CPU_SCALING_MIN_FREQ_ON_BAT=800000
CPU_SCALING_MAX_FREQ_ON_BAT=3500000

But after the first suspend/resume cycle, the CPU's will only drop to 2.7ghz.  If I reboot, they will then drop to 800mhz again.

I haven't run across any similar reports and am wondering if anyone else has noticed this behavior with the 4.10.x kernels.  I believe I saw frequency scaling working well with 4.9.x, but am not 100% sure that I tested a suspend/resume scenario.

The only thing I've noticed was the following in journalctl, but based on this report, the message appears to be a non-issue.

Apr 07 16:01:37 archxps systemd-udevd[5705]: Process '/usr/bin/tlp auto' failed with exit code 4.

Edit: Realized that this probably has nothing to do with TLP and is more likely kernel related.   TLP does appear to be doing it's job.

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  = powersave
/sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq  =   800000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq  =  3500000 [kHz]

Edit2: Found a possible workaround using pstate_frequency (AUR).

https://github.com/pyamsoft/pstate-frequency/issues/17

I'm able to get the frequencies to ramp down to 500mhz after a suspend by running

pstate-frequency -S -p auto

Last edited by blahhumbug (2017-04-08 03:48:03)

Offline

#2 2017-04-08 13:27:53

linrunner
Member
Registered: 2013-04-21
Posts: 52

Re: TLP: CPU_SCALING_MIN_FREQ_ON_BAT not working after suspend/resume

Is tlp-sleep.service enabled? See http://linrunner.de/en/tlp/docs/tlp-faq … stemdunits

ps. imho frequency limits do not make sense with intel_pstate, I recommend using CPU_MIN/MAX_PERF_ON_AC/BAT instead. See http://linrunner.de/en/tlp/docs/tlp-con … ml#scaling

Last edited by linrunner (2017-04-08 13:31:03)

Offline

#3 2017-04-08 13:59:59

blahhumbug
Member
Registered: 2016-10-08
Posts: 64

Re: TLP: CPU_SCALING_MIN_FREQ_ON_BAT not working after suspend/resume

I've enabled both services, but when I check with systemctl list-units, only tlp.service is shown.  systemctl status reports:

tlp-sleep.service - TLP suspend/resume
   Loaded: loaded (/usr/lib/systemd/system/tlp-sleep.service; enabled; vendor preset: disabled)
   Active: inactive (dead)
     Docs: http://linrunner.de/tlp

There are no journalctl logs for tlp on sleep/resume, and I thought I recalled seeing those in the past, so I am uncertain if it is working properly

When I remove the explicit frequencies from /etc/default/tlp, then the CPU frequency appears to just stay clamped to 500mhz in battery mode.  Even under stress pstate never  increases the frequency.

 Set the min/max frequency available for the scaling governor.
# Possible values strongly depend on your CPU. For available frequencies see
# the output of tlp-stat -p.
#CPU_SCALING_MIN_FREQ_ON_AC=0
#CPU_SCALING_MAX_FREQ_ON_AC=0
#CPU_SCALING_MIN_FREQ_ON_BAT=0
#CPU_SCALING_MAX_FREQ_ON_BAT=0

# Set Intel P-state performance: 0..100 (%)
# Limit the max/min P-state to control the power dissipation of the CPU.
# Values are stated as a percentage of the available performance.
# Requires an Intel Core i processor with intel_pstate driver.
CPU_MIN_PERF_ON_AC=0
CPU_MAX_PERF_ON_AC=100
CPU_MIN_PERF_ON_BAT=0
CPU_MAX_PERF_ON_BAT=100

In AC mode, tlp-stat reports:

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  = powersave
/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  =  3500000 [kHz]

In battery mode:

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  = powersave
/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  =   420000 [kHz]

So it looks like 500mhz is the minimum frequency that pstate will take my Kabylake too, and the scaling frequency min/max are both set lower than that, so it just clamps to 500mhz.

Edit:

With CPU_MIN_PERF_ON_BAT=20

/sys/devices/system/cpu/cpu1/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor  = powersave
/sys/devices/system/cpu/cpu1/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq  =   700000 [kHz]
/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq  =   700000 [kHz]

/sys/devices/system/cpu/intel_pstate/min_perf_pct      = 20
/sys/devices/system/cpu/intel_pstate/max_perf_pct      = 20
/sys/devices/system/cpu/intel_pstate/no_turbo          = 1
/sys/devices/system/cpu/intel_pstate/turbo_pct         = 29
/sys/devices/system/cpu/intel_pstate/num_pstates       = 32

So it seems that intel_pstate is clamping both min and max to the CPU_MIN_PERF_ON_BAT value and CPU_MAX_PERF_ON_BAT is not getting used.

Edit2:
To see if this is just how the powersave governor works, I changed the battery profile to use the performance governor, but I see the same behavior where the min and max pct both get set to the CPU_MIN_PERF_ON_BAT.   Only the AC profile appears to use the MAX value.

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  =   700000 [kHz]
/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq  =   700000 [kHz]

/sys/devices/system/cpu/intel_pstate/min_perf_pct      = 20
/sys/devices/system/cpu/intel_pstate/max_perf_pct      = 20
/sys/devices/system/cpu/intel_pstate/no_turbo          = 1
/sys/devices/system/cpu/intel_pstate/turbo_pct         = 29
/sys/devices/system/cpu/intel_pstate/num_pstates       = 32

Last edited by blahhumbug (2017-04-08 14:21:13)

Offline

#4 2017-04-08 15:37:56

blahhumbug
Member
Registered: 2016-10-08
Posts: 64

Re: TLP: CPU_SCALING_MIN_FREQ_ON_BAT not working after suspend/resume

I seem to have broken my TLP config.   On a fresh boot on AC, everything is good.   If I unplug it switches to battery and powersave.   But when I reconnect AC, it stays stuck in powersave, although, scaling_max_freq jumps up to 3.5GHZ.

After running "tlp start" with AC connected.

--- TLP 0.9 --------------------------------------------

+++ Processor
CPU model      = Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz

/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  =  3500000 [kHz]

/sys/devices/system/cpu/cpu1/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor  = performance
/sys/devices/system/cpu/cpu1/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq  =   400000 [kHz]
/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq  =  3500000 [kHz]

/sys/devices/system/cpu/cpu2/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor  = performance
/sys/devices/system/cpu/cpu2/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq  =   400000 [kHz]
/sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq  =  3500000 [kHz]

/sys/devices/system/cpu/cpu3/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu3/cpufreq/scaling_governor  = performance
/sys/devices/system/cpu/cpu3/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq  =   400000 [kHz]
/sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq  =  3500000 [kHz]

/sys/devices/system/cpu/intel_pstate/min_perf_pct      = 100
/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/turbo_pct         = 29
/sys/devices/system/cpu/intel_pstate/num_pstates       = 32

x86_energy_perf_policy.cpu0                            = performance
x86_energy_perf_policy.cpu1                            = performance
x86_energy_perf_policy.cpu2                            = performance
x86_energy_perf_policy.cpu3                            = performance

/proc/sys/kernel/nmi_watchdog                          = 0

+++ Undervolting
PHC kernel not available.

After disconnecting AC

--- TLP 0.9 --------------------------------------------

+++ Processor
CPU model      = Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  = powersave
/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  =   420000 [kHz]

/sys/devices/system/cpu/cpu1/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor  = powersave
/sys/devices/system/cpu/cpu1/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq  =   400000 [kHz]
/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq  =   420000 [kHz]

/sys/devices/system/cpu/cpu2/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor  = powersave
/sys/devices/system/cpu/cpu2/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq  =   400000 [kHz]
/sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq  =   420000 [kHz]

/sys/devices/system/cpu/cpu3/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu3/cpufreq/scaling_governor  = powersave
/sys/devices/system/cpu/cpu3/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq  =   400000 [kHz]
/sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq  =   420000 [kHz]

/sys/devices/system/cpu/intel_pstate/min_perf_pct      = 12
/sys/devices/system/cpu/intel_pstate/max_perf_pct      = 12
/sys/devices/system/cpu/intel_pstate/no_turbo          = 1
/sys/devices/system/cpu/intel_pstate/turbo_pct         = 29
/sys/devices/system/cpu/intel_pstate/num_pstates       = 32

x86_energy_perf_policy.cpu0                            = powersave
x86_energy_perf_policy.cpu1                            = powersave
x86_energy_perf_policy.cpu2                            = powersave
x86_energy_perf_policy.cpu3                            = powersave

/proc/sys/kernel/nmi_watchdog                          = 0

+++ Undervolting
PHC kernel not available.

After reconnecting AC

--- TLP 0.9 --------------------------------------------

+++ Processor
CPU model      = Intel(R) Core(TM) i7-7500U CPU @ 2.70GHz

/sys/devices/system/cpu/cpu0/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor  = powersave
/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  =  3500000 [kHz]

/sys/devices/system/cpu/cpu1/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu1/cpufreq/scaling_governor  = powersave
/sys/devices/system/cpu/cpu1/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu1/cpufreq/scaling_min_freq  =   400000 [kHz]
/sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq  =  3500000 [kHz]

/sys/devices/system/cpu/cpu2/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu2/cpufreq/scaling_governor  = powersave
/sys/devices/system/cpu/cpu2/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu2/cpufreq/scaling_min_freq  =   400000 [kHz]
/sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq  =  3500000 [kHz]

/sys/devices/system/cpu/cpu3/cpufreq/scaling_driver    = intel_pstate
/sys/devices/system/cpu/cpu3/cpufreq/scaling_governor  = powersave
/sys/devices/system/cpu/cpu3/cpufreq/scaling_available_governors = performance powersave
/sys/devices/system/cpu/cpu3/cpufreq/scaling_min_freq  =   400000 [kHz]
/sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq  =  3500000 [kHz]

/sys/devices/system/cpu/intel_pstate/min_perf_pct      = 12
/sys/devices/system/cpu/intel_pstate/max_perf_pct      = 100
/sys/devices/system/cpu/intel_pstate/no_turbo          = 1
/sys/devices/system/cpu/intel_pstate/turbo_pct         = 29
/sys/devices/system/cpu/intel_pstate/num_pstates       = 32

x86_energy_perf_policy.cpu0                            = powersave
x86_energy_perf_policy.cpu1                            = powersave
x86_energy_perf_policy.cpu2                            = powersave
x86_energy_perf_policy.cpu3                            = powersave

/proc/sys/kernel/nmi_watchdog                          = 0

+++ Undervolting
PHC kernel not available.

And my full config

# ------------------------------------------------------------------------------
# tlp - Parameters for power save
# See full explanation: http://linrunner.de/en/tlp/docs/tlp-configuration.html

# Hint: some features are disabled by default, remove the leading # to enable
# them.

# Set to 0 to disable, 1 to enable TLP.
TLP_ENABLE=1

# Operation mode when no power supply can be detected: AC, BAT
# Concerns some desktop and embedded hardware only.
TLP_DEFAULT_MODE=AC

# Seconds laptop mode has to wait after the disk goes idle before doing a sync.
# Non-zero value enables, zero disables laptop mode.
DISK_IDLE_SECS_ON_AC=0
DISK_IDLE_SECS_ON_BAT=2

# Dirty page values (timeouts in secs).
MAX_LOST_WORK_SECS_ON_AC=15
MAX_LOST_WORK_SECS_ON_BAT=60

# Hint: CPU parameters below are disabled by default, remove the leading #
# to enable them, otherwise kernel default values are used.

# Select a CPU frequency scaling governor.
# Intel Core i processor with intel_pstate driver:
#   powersave(*), performance
# Older hardware with acpi-cpufreq driver:
#   ondemand(*), powersave, performance, conservative
# (*) is recommended.
# Hint: use tlp-stat -p to show the active driver and available governors.
# Important:
#   You *must* disable your distribution's governor settings or conflicts will
#   occur. ondemand is sufficient for *almost all* workloads, you should know
#   what you're doing!
CPU_SCALING_GOVERNOR_ON_AC=performance
CPU_SCALING_GOVERNOR_ON_BAT=powersave

# Set the min/max frequency available for the scaling governor.
# Possible values strongly depend on your CPU. For available frequencies see
# the output of tlp-stat -p.
#CPU_SCALING_MIN_FREQ_ON_AC=0
#CPU_SCALING_MAX_FREQ_ON_AC=0
#CPU_SCALING_MIN_FREQ_ON_BAT=0
#CPU_SCALING_MAX_FREQ_ON_BAT=0

# Set Intel P-state performance: 0..100 (%)
# Limit the max/min P-state to control the power dissipation of the CPU.
# Values are stated as a percentage of the available performance.
# Requires an Intel Core i processor with intel_pstate driver.
CPU_MIN_PERF_ON_AC=0
CPU_MAX_PERF_ON_AC=100
CPU_MIN_PERF_ON_BAT=25
CPU_MAX_PERF_ON_BAT=75

# Set the CPU "turbo boost" feature: 0=disable, 1=allow
# Requires an Intel Core i processor.
# Important:
# - This may conflict with your distribution's governor settings
# - A value of 1 does *not* activate boosting, it just allows it
CPU_BOOST_ON_AC=1
CPU_BOOST_ON_BAT=0

# Minimize number of used CPU cores/hyper-threads under light load conditions
SCHED_POWERSAVE_ON_AC=0
SCHED_POWERSAVE_ON_BAT=1

# Kernel NMI Watchdog:
#   0=disable (default, saves power), 1=enable (for kernel debugging only)
NMI_WATCHDOG=0

# Change CPU voltages aka "undervolting" - Kernel with PHC patch required
# Frequency voltage pairs are written to:
#   /sys/devices/system/cpu/cpu0/cpufreq/phc_controls
# CAUTION: only use this, if you thoroughly understand what you are doing!
#PHC_CONTROLS="F:V F:V F:V F:V"

# Set CPU performance versus energy savings policy:
#   performance, normal, powersave
# Requires kernel module msr and x86_energy_perf_policy from linux-tools
ENERGY_PERF_POLICY_ON_AC=performance
ENERGY_PERF_POLICY_ON_BAT=powersave

# Hard disk devices; separate multiple devices with spaces (default: sda).
# Devices can be specified by disk ID also (lookup with: tlp diskid).
DISK_DEVICES="sda sdb"

# Hard disk advanced power management level: 1..254, 255 (max saving, min, off)
# Levels 1..127 may spin down the disk; 255 allowable on most drives.
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the hardware default for the particular disk.
DISK_APM_LEVEL_ON_AC="254 254"
DISK_APM_LEVEL_ON_BAT="128 128"

# Hard disk spin down timeout:
#   0:        spin down disabled
#   1..240:   timeouts from 5s to 20min (in units of 5s)
#   241..251: timeouts from 30min to 5.5 hours (in units of 30min)
# See 'man hdparm' for details.
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the hardware default for the particular disk.
#DISK_SPINDOWN_TIMEOUT_ON_AC="0 0"
#DISK_SPINDOWN_TIMEOUT_ON_BAT="0 0"

# Select IO scheduler for the disk devices: cfq, deadline, noop (Default: cfq);
# Separate values for multiple disks with spaces. Use the special value 'keep'
# to keep the kernel default scheduler for the particular disk.
#DISK_IOSCHED="cfq cfq"

# SATA aggressive link power management (ALPM):
#   min_power, medium_power, max_performance
SATA_LINKPWR_ON_AC=max_performance
SATA_LINKPWR_ON_BAT=min_power

# Exclude SATA host devices from link power management.
# Separate multiple hosts with spaces.
#SATA_LINKPWR_BLACKLIST="host1"

# Runtime Power Management for AHCI controllers and disks:
#   on=disable, auto=enable
# EXPERIMENTAL ** WARNING: auto will most likely cause system lockups/data loss
#AHCI_RUNTIME_PM_ON_AC=on
#AHCI_RUNTIME_PM_ON_BAT=on

# Seconds of inactivity before disk is suspended
AHCI_RUNTIME_PM_TIMEOUT=15

# PCI Express Active State Power Management (PCIe ASPM):
#   default, performance, powersave
PCIE_ASPM_ON_AC=performance
PCIE_ASPM_ON_BAT=powersave

# Radeon graphics clock speed (profile method): low, mid, high, auto, default;
# auto = mid on BAT, high on AC; default = use hardware defaults.
# (Kernel >= 2.6.35 only, open-source radeon driver explicitly)
RADEON_POWER_PROFILE_ON_AC=high
RADEON_POWER_PROFILE_ON_BAT=low

# Radeon dynamic power management method (DPM): battery, performance
# (Kernel >= 3.11 only, requires boot option radeon.dpm=1)
RADEON_DPM_STATE_ON_AC=performance
RADEON_DPM_STATE_ON_BAT=battery

# Radeon DPM performance level: auto, low, high; auto is recommended.
RADEON_DPM_PERF_LEVEL_ON_AC=auto
RADEON_DPM_PERF_LEVEL_ON_BAT=auto

# WiFi power saving mode: on=enable, off=disable; not supported by all adapters.
WIFI_PWR_ON_AC=off
WIFI_PWR_ON_BAT=on

# Disable wake on LAN: Y/N
WOL_DISABLE=Y

# Enable audio power saving for Intel HDA, AC97 devices (timeout in secs).
# A value of 0 disables, >=1 enables power save.
SOUND_POWER_SAVE_ON_AC=0
SOUND_POWER_SAVE_ON_BAT=1

# Disable controller too (HDA only): Y/N
SOUND_POWER_SAVE_CONTROLLER=Y

# Set to 1 to power off optical drive in UltraBay/MediaBay when running on
# battery. A value of 0 disables this feature (Default).
# Drive can be powered on again by releasing (and reinserting) the eject lever
# or by pressing the disc eject button on newer models.
# Note: an UltraBay/MediaBay hard disk is never powered off.
BAY_POWEROFF_ON_BAT=0
# Optical drive device to power off (default sr0).
BAY_DEVICE="sr0"

# Runtime Power Management for PCI(e) bus devices: on=disable, auto=enable
RUNTIME_PM_ON_AC=on
RUNTIME_PM_ON_BAT=auto

# Runtime PM for *all* PCI(e) bus devices, except blacklisted ones:
#   0=disable, 1=enable
RUNTIME_PM_ALL=1

# Exclude PCI(e) device adresses the following list from Runtime PM
# (separate with spaces). Use lspci to get the adresses (1st column).
#RUNTIME_PM_BLACKLIST="bb:dd.f 11:22.3 44:55.6"

# Exclude PCI(e) devices assigned to the listed drivers from Runtime PM
# (should prevent accidential power on of hybrid graphics' discrete part).
# Default is "radeon nouveau"; use "" to disable the feature completely.
# Separate multiple drivers with spaces.
RUNTIME_PM_DRIVER_BLACKLIST="radeon nouveau"

# Set to 0 to disable, 1 to enable USB autosuspend feature.
USB_AUTOSUSPEND=1

# Exclude listed devices from USB autosuspend (separate with spaces).
# Use lsusb to get the ids.
# Note: input devices (usbhid) are excluded automatically (see below)
#USB_BLACKLIST="1111:2222 3333:4444"

# WWAN devices are excluded from USB autosuspend: 0=do not exclude / 1=exclude
USB_BLACKLIST_WWAN=1

# Include listed devices into USB autosuspend even if already excluded
# by the driver or WWAN blacklists above (separate with spaces).
# Use lsusb to get the ids.
#USB_WHITELIST="1111:2222 3333:4444"

# Set to 1 to disable autosuspend before shutdown, 0 to do nothing
# (workaround for USB devices that cause shutdown problems).
#USB_AUTOSUSPEND_DISABLE_ON_SHUTDOWN=1

# Restore radio device state (Bluetooth, WiFi, WWAN) from previous shutdown
# on system startup: 0=disable, 1=enable.
# Hint: the parameters DEVICES_TO_DISABLE/ENABLE_ON_STARTUP/SHUTDOWN below
#   are ignored when this is enabled!
RESTORE_DEVICE_STATE_ON_STARTUP=0

# Radio devices to disable on startup: bluetooth, wifi, wwan.
# Separate multiple devices with spaces.
#DEVICES_TO_DISABLE_ON_STARTUP="bluetooth wifi wwan"

# Radio devices to enable on startup: bluetooth, wifi, wwan.
# Separate multiple devices with spaces.
#DEVICES_TO_ENABLE_ON_STARTUP="wifi"

# Radio devices to disable on shutdown: bluetooth, wifi, wwan
# (workaround for devices that are blocking shutdown).
#DEVICES_TO_DISABLE_ON_SHUTDOWN="bluetooth wifi wwan"

# Radio devices to enable on shutdown: bluetooth, wifi, wwan
# (to prevent other operating systems from missing radios).
#DEVICES_TO_ENABLE_ON_SHUTDOWN="wwan"

# Radio devices to enable on AC: bluetooth, wifi, wwan
#DEVICES_TO_ENABLE_ON_AC="bluetooth wifi wwan"

# Radio devices to disable on battery: bluetooth, wifi, wwan
#DEVICES_TO_DISABLE_ON_BAT="bluetooth wifi wwan"

# Radio devices to disable on battery when not in use (not connected):
# bluetooth, wifi, wwan
#DEVICES_TO_DISABLE_ON_BAT_NOT_IN_USE="bluetooth wifi wwan"

# Battery charge thresholds (ThinkPad only, tp-smapi or acpi-call kernel module
# required). Charging starts when the remaining capacity falls below the
# START_CHARGE_THRESH value and stops when exceeding the STOP_CHARGE_THRESH value.
# Main / Internal battery (values in %)
#START_CHARGE_THRESH_BAT0=75
#STOP_CHARGE_THRESH_BAT0=80
# Ultrabay / Slice / Replaceable battery (values in %)
#START_CHARGE_THRESH_BAT1=75
#STOP_CHARGE_THRESH_BAT1=80

# ------------------------------------------------------------------------------
# tlp-rdw - Parameters for the radio device wizard
# Possible devices: bluetooth, wifi, wwan

# Hints:
# - Parameters are disabled by default, remove the leading # to enable them.
# - Separate multiple radio devices with spaces.

# Radio devices to disable on connect.
#DEVICES_TO_DISABLE_ON_LAN_CONNECT="wifi wwan"
#DEVICES_TO_DISABLE_ON_WIFI_CONNECT="wwan"
#DEVICES_TO_DISABLE_ON_WWAN_CONNECT="wifi"

# Radio devices to enable on disconnect.
#DEVICES_TO_ENABLE_ON_LAN_DISCONNECT="wifi wwan"
#DEVICES_TO_ENABLE_ON_WIFI_DISCONNECT=""
#DEVICES_TO_ENABLE_ON_WWAN_DISCONNECT=""

# Radio devices to enable/disable when docked.
#DEVICES_TO_ENABLE_ON_DOCK=""
#DEVICES_TO_DISABLE_ON_DOCK=""

# Radio devices to enable/disable when undocked.
#DEVICES_TO_ENABLE_ON_UNDOCK="wifi"
#DEVICES_TO_DISABLE_ON_UNDOCK=""

With TLP_DEBUG="bat disk lock nm path pm rf run sysfs udev usb" and tlp-stat -T

--- TLP 0.9 --------------------------------------------

-- Logs begin at Fri 2017-03-10 15:47:25 PST, end at Sat 2017-04-08 09:03:58 PDT. --
Mar 14 19:21:08 archxps tlp[23600]: Applying power save settings...done.
-- Reboot --
Mar 15 20:53:08 archxps tlp[435]: Applying power save settings...done.
-- Reboot --
Mar 17 12:19:44 archxps tlp[27435]: Applying power save settings...done.
-- Reboot --
Mar 18 19:28:40 archxps tlp[26711]: Applying power save settings...done.
-- Reboot --
Mar 20 12:14:48 archxps tlp[29674]: Applying power save settings...done.
-- Reboot --
Mar 30 06:31:01 archxps tlp[10196]: Applying power save settings...done.
Mar 30 06:31:04 archxps tlp[10255]: Applying power save settings...done.
Mar 30 06:31:04 archxps tlp[10255]: Setting battery charge thresholds...done.
Mar 30 06:35:02 archxps tlp[10851]: Applying power save settings...done.
Mar 30 06:35:02 archxps tlp[10905]: Applying power save settings...done.
Mar 30 06:35:02 archxps tlp[10905]: Setting battery charge thresholds...done.
-- Reboot --
Apr 05 22:27:43 archxps tlp[31676]: Applying power save settings...done.

So it seems there are no new trace events at all for the last few days.  But as far as I can tell everything is enabled.

Last edited by blahhumbug (2017-04-08 16:06:14)

Offline

#5 2017-04-11 20:11:51

linrunner
Member
Registered: 2013-04-21
Posts: 52

Re: TLP: CPU_SCALING_MIN_FREQ_ON_BAT not working after suspend/resume

I think it's just strange behaviour (or malfunction) of intel_pstate on your hardware, but let's see what TLP does.

IMPORTANT: your edited outputs are not helpful, please show *all* of

tlp-stat

for each test step. I suggest you use a paste service for that.

Trace data is only generated for new events *after* you add TLP_DEBUG="...". Just leave trace enabled.

Please show tlp-stat and the relevant trace lines (Tip: select according to the timestamp) for:

1. Change of power source AC --> battery
2. Change of power source battery --> AC
3. tlp start (on AC)

Offline

#6 2017-04-12 02:05:59

blahhumbug
Member
Registered: 2016-10-08
Posts: 64

Re: TLP: CPU_SCALING_MIN_FREQ_ON_BAT not working after suspend/resume

Thanks linrunner.   Here is the info requested starting from a cold boot.  I also disabled thermald for these tests to be sure it was not interfering.  I also use KDE so powerdevil is active, but I do not believe it changes governors or pstate settings.

There are mismatches in expectations for all cases.   I am able to manually change the governor and min/max frequency percentages using pstate-frequency to the settings listed in the tlp configuration, so I do not believe this is a hardware issue.

Dell XPS 9360
i7-7500U CPU @ 2.70GHz (family: 0x6, model: 0x8e, stepping: 0x9)

systemctl list-units: http://sprunge.us/bgBQ

Test Case: Cold Boot AC -> 'tlp start' -> BAT -> AC

Expected:
    a. Cold boot:      governor=performance, min_perf_pct=50%   max_perf_pct=100%
    b. tlp start:      governor=performance, min_perf_pct=50%   max_perf_pct=100%
    c. BAT:            governor=powersave,   min_perf_pct=25%,  max_perf_pct=75%
    d. AC:             governor=performance, min_perf_pct=50%,  max_perf_pct=100%

Observed
    a. Cold boot: FAIL governor=powersave,   min_perf_pct=12%,  max_perf_pct=100%
    b. tlp start: FAIL governor=performance, min_perf_pct=100%, max_perf_pct=100%
    c. BAT:       FAIL governor=powersave,   min_perf_pct=12%,  max_perf_pct=12%
    d. AC:        FAIL governor=powersave,   min_perf_pct=12%,  max_perf_pct=100%

tlp-stat a
Trace a

tlp-stat b
Trace b

tlp-stat c
Trace c

tlp-stat d
Trace d

Edit: It seems that 'tlp --trace' reports nothing new happening except on boot.  After running tlp-start, unplugging AC, and replugging AC, nothing new showed up in any of the tlp-stat --trace reports.   But you can see that settings are indeed changing in each tlp-stat report.   Maybe TLP is not actually executing and some other service is the one changing the settings?

Last edited by blahhumbug (2017-04-12 02:36:03)

Offline

#7 2017-04-15 17:07:57

linrunner
Member
Registered: 2013-04-21
Posts: 52

Re: TLP: CPU_SCALING_MIN_FREQ_ON_BAT not working after suspend/resume

Sorry, I'm getting lost in those long traces. Could you please test again and filter the traces by the timestamp so that they show only the *actual* event a, b, c, d? If there's no trace output for the event, then just state the fact.

When you get no trace output for the events where the power source changes, then maybe your ACPI BIOS doesn't generate the necessary udev events for AC plugged or unplugged. I added power supply diagnostics to the next TLP version. Install the beta packages tlp-git and tlp-rdw-git  from the AUR.

Then connect AC and show the output of

tlp-stat --psup

Next invoke

tlp-stat --pev

unplug and re-plug AC and show the output.

Last edited by linrunner (2017-04-15 17:08:18)

Offline

#8 2017-04-21 20:48:13

tlvince
Member
Registered: 2010-07-06
Posts: 68
Website

Re: TLP: CPU_SCALING_MIN_FREQ_ON_BAT not working after suspend/resume

I'm experiencing the same thing except for CPU_MAX_PERF_ON_[AC|BAT]. After running on battery, suspend/resume and plugging in AC, CPU is locked to CPU_MAX_PERF_ON_BAT ("30" in my case). However, running something like the following has no effect either, so this may well be a kernel (v4.10.10)/intel_pstate issue:

sudo tee /sys/devices/system/cpu/intel_pstate/max_perf_pct <<<100

Just in case you have any ideas:

* tlp-stat (whilst on AC)
* tlp-stat --psup
* tlp-stat --pev (AC, bat, AC)

Edit: pstate-frequency does indeed workaround the issue. It seems MSR_IA32_ENERGY_PERF_BIAS can change on resume, though I can't reproduce this reliably. For now, installing x86_energy_perf_policy and enabling pstate-frequency-sleep.service does the job.

Last edited by tlvince (2017-04-21 21:32:07)

Offline

#9 2017-04-28 16:24:21

linrunner
Member
Registered: 2013-04-21
Posts: 52

Re: TLP: CPU_SCALING_MIN_FREQ_ON_BAT not working after suspend/resume

I don't understand why tlp-sleep.service (tlp resume) and your manual command fail to write the sysfiles and pstate-frequency-sleep.service (pstate-frequency -S -p auto) succeeds. They all perform essentially the same writing actions (as root).

Last edited by linrunner (2017-04-28 16:25:19)

Offline

Board footer

Powered by FluxBB