You are not logged in.

#1 2013-12-27 16:14:18

JohnSmithLinux
Member
From: The Internet
Registered: 2013-10-24
Posts: 41

How to Define Specific CPU Frequency in Laptop Mode Tools?

I would like to know how to set a specific maximum and minimum frequency for Laptop Mode Tools. Here is my /etc/laptop-mode/conf.d/cpufreq.conf:

#
# Configuration file for Laptop Mode Tools module cpufreq.
#
# For more information, consult the laptop-mode.conf(8) manual page.
#

###############################################################################
# CPU frequency scaling and throttling
# ------------------------------------
#
#__COMMENT Laptop mode tools can automatically adjust your kernel CPU frequency
#__COMMENT settings. This includes upper and lower limits and scaling governors.
#__COMMENT There is also support for CPU throttling, on systems that don't support
#__COMMENT frequency scaling.
#__COMMENT
#__COMMENT This feature only works on 2.6 kernels.
#__COMMENT
#__COMMENT
#__COMMENT IMPORTANT: In versions 1.36 and earlier, these settings were included in the
#__COMMENT main laptop-mode.conf configuration file. If they are still present, they
#__COMMENT overrule the settings in this file. To fix this, simply delete the settings
#__COMMENT from the main config file.
#
###############################################################################

# Enable debug mode for this module
# Set to 1 if you want to debug this module
DEBUG=0

#
# Should laptop mode tools control the CPU frequency settings?
#
# Set to 0 to disable
CONTROL_CPU_FREQUENCY="auto"


#
# Legal values are "slowest" for the slowest speed that your
# CPU is able to operate at, "fastest" for the fastest speed,
# "medium" for some value in the middle, or any value listed in
# /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies.
# The "governor" can be any governor installed on your system, this usually
# includes "ondemand", "conservative", and "performance". The
# "IGNORE_NICE_LOAD" setting specifies that background programs that have
# a low priority ("nice level") should not cause the CPU frequency to
# be increased. (You generally want this to be enabled in battery mode.)
#
BATT_CPU_MAXFREQ=fastest
BATT_CPU_MINFREQ=slowest
BATT_CPU_GOVERNOR=ondemand
BATT_CPU_IGNORE_NICE_LOAD=1
LM_AC_CPU_MAXFREQ=fastest
LM_AC_CPU_MINFREQ=slowest
LM_AC_CPU_GOVERNOR=ondemand
LM_AC_CPU_IGNORE_NICE_LOAD=1
NOLM_AC_CPU_MAXFREQ=fastest
NOLM_AC_CPU_MINFREQ=slowest
NOLM_AC_CPU_GOVERNOR=ondemand
NOLM_AC_CPU_IGNORE_NICE_LOAD=0


#
# Should laptop mode tools control the CPU throttling? This is only useful
# on processors that don't have frequency scaling.
# (Only works when you have /proc/acpi/processor/CPU*/throttling.)
# 
# This is only useful on older P4 processors that do not support frequency
# scaling. On such processors, this is the only way to reduce power consumption
# but at the cost of higher performance penalty.
#
# Enable this only if you have a processor that does not support frequency scaling
# On most new processors, you might want to disable it.
#
# Set to 0 to disable.
CONTROL_CPU_THROTTLING=0


#
# Legal values are "maximum" for the maximum (slowest) throttling level,
# "minimum" for minimum (fastest) throttling level, "medium" for a value
# somewhere in the middle (this is usually 50% for P4s), or any value listed
# in /proc/acpi/processor/CPU*/throttling. Be careful when using "maximum":
# this may be _very_ slow (in fact, with P4s it slows down the processor
# by a factor 8).
#
BATT_CPU_THROTTLING=medium
LM_AC_CPU_THROTTLING=medium
NOLM_AC_CPU_THROTTLING=minimum

I have a new Intel Haswell CPU, so I know that CPU throttling isn't applicable to me. In the section about scaling, how do I set a specific GHz or MHz value for the minimum and maximum CPU?

Thanks


Arch Linux | x86_64 | GPT | BIOS boot | SysLinux | systemd | EXT4
System76 Bonobo Extreme (bonx7) | Intel® Core™ i7-4900MQ CPU @ 2.80GHz (Turbo Boost 2.0 up to 3,8 GHz) | 16 GB Dual-Channel SDRAM @ 1600 MHz | 250 GB Samsung 840 EVO SSD | 750 GB WDC WD7500BPKX-75HPJT0 HDD | NVidia GeForce GTX 765M
XOrg | LightDM | GNOME Desktop

Offline

#2 2013-12-27 16:26:10

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: How to Define Specific CPU Frequency in Laptop Mode Tools?

Why would you want to do that? There is not reason whatsoever doing this would be in any way useful.

If you want to keep the temperature within certain limits, install thermald. Otherwise don't interfere with how the processor manages itself. And read this: https://plus.google.com/+ArjanvandeVen/ … Ln9T4ehywL

Offline

#3 2013-12-27 16:29:22

JohnSmithLinux
Member
From: The Internet
Registered: 2013-10-24
Posts: 41

Re: How to Define Specific CPU Frequency in Laptop Mode Tools?

Well, I don't want to CPU to go to max frequency when I'm on battery power. Please tell me how to do it if there is a way.


Arch Linux | x86_64 | GPT | BIOS boot | SysLinux | systemd | EXT4
System76 Bonobo Extreme (bonx7) | Intel® Core™ i7-4900MQ CPU @ 2.80GHz (Turbo Boost 2.0 up to 3,8 GHz) | 16 GB Dual-Channel SDRAM @ 1600 MHz | 250 GB Samsung 840 EVO SSD | 750 GB WDC WD7500BPKX-75HPJT0 HDD | NVidia GeForce GTX 765M
XOrg | LightDM | GNOME Desktop

Offline

#4 2013-12-27 16:49:36

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 19,802

Re: How to Define Specific CPU Frequency in Laptop Mode Tools?

JohnSmithLinux wrote:

Well, I don't want to CPU to go to max frequency when I'm on battery power. Please tell me how to do it if there is a way.

Just out of curiosity, why?  Are you concerned about peak current?  My hunch is (and stated without proof) is that tasks require a certain amount of energy.   One can either draw high current (thus power) for a short period of time, or moderate current for a longer period of time.  Regardless, the areas under the curve (energy) will be similar.  Battery capacity is measured in Watt Hours; another way of saying Energy.

In other words: (Big Watts x Little Time) versus (Medium Watts x Long Time) are about the same.  In my opinion, just get it done smile


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
Sometimes it is the people no one can imagine anything of who do the things no one can imagine. -- Alan Turing
---
How to Ask Questions the Smart Way

Offline

#5 2013-12-27 17:03:11

JohnSmithLinux
Member
From: The Internet
Registered: 2013-10-24
Posts: 41

Re: How to Define Specific CPU Frequency in Laptop Mode Tools?

No, I just want to save battery power. I don't want the CPU to be clocked as high when I'm on battery. I would set the CPUFreq governor to ondemand, but when I issue sudo cpupower frequency-set -g ondemand, I get:

Setting cpu: 0
Error setting new values. Common errors:
- Do you have proper administration rights? (super-user?)
- Is the governor you requested available and modprobed?
- Trying to set an invalid policy?
- Trying to set a specific frequency, but userspace governor is not available,
   for example because of hardware which cannot be set to a specific frequency
   or because the userspace governor isn't loaded?

The output of ls /lib/modules/$(uname -r)/kernel/drivers/cpufreq/ is:

acpi-cpufreq.ko.gz          cpufreq_stats.ko.gz      powernow-k8.ko.gz
amd_freq_sensitivity.ko.gz  cpufreq_userspace.ko.gz  speedstep-lib.ko.gz
cpufreq_conservative.ko.gz  p4-clockmod.ko.gz
cpufreq_powersave.ko.gz     pcc-cpufreq.ko.gz

Doing modprobe cpufreq_ondemand and trying again does nothing.

So, since I can't use the ondemand governor and then raise the threshold, I need to limit the CPU frequency.

Thanks.


Arch Linux | x86_64 | GPT | BIOS boot | SysLinux | systemd | EXT4
System76 Bonobo Extreme (bonx7) | Intel® Core™ i7-4900MQ CPU @ 2.80GHz (Turbo Boost 2.0 up to 3,8 GHz) | 16 GB Dual-Channel SDRAM @ 1600 MHz | 250 GB Samsung 840 EVO SSD | 750 GB WDC WD7500BPKX-75HPJT0 HDD | NVidia GeForce GTX 765M
XOrg | LightDM | GNOME Desktop

Offline

#6 2013-12-27 19:50:39

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: How to Define Specific CPU Frequency in Laptop Mode Tools?

Limiting the CPU frequency will *not* save power. It will consume more power because tasks will take longer to complete, meaning it'll take longer for the CPU to go into idle.

On haswell, the intel_pstate driver will be used to manage the CPU. It does not use the cpufreq governors, it has two internal ones - powersave and performance. The default is powersave. So there's nothing you need to set.

Offline

#7 2013-12-28 03:24:07

thiagowfx
Member
Registered: 2013-07-09
Posts: 586

Re: How to Define Specific CPU Frequency in Laptop Mode Tools?

Not exactly laptop-mode-tools, but I could add that with tlp you can configure the CPU frequency easier. From its config file, you can

# Set the min/max frequency available for the scaling governor.

and

# Select a cpu frequency scaling governor: ondemand/powersave/performance/conservative

It is pretty straightforward to edit it. But I should add that I agree with @Gusar. Recently I set my CPU governor to powersave, but I didn't notice much difference compared to ondemand.

Offline

#8 2013-12-28 06:56:28

Gusar
Member
Registered: 2009-08-25
Posts: 3,605

Re: How to Define Specific CPU Frequency in Laptop Mode Tools?

I have the feeling tlp will only work with cpufreq governors, but not with the intel_pstate internal ones. intel_pstate does not export frequency stuff the way cpufreq does. It does have its own knobs to tweak things, but they're very different from the cpufreq stuff. And I don't think they're meant to be messed with manually unless one knows very well what they're doing.

Offline

Board footer

Powered by FluxBB