| View previous topic :: View next topic |
| Author |
Message |
pd1986 Apprentice

Joined: 19 Feb 2012 Posts: 251 Location: Paris
|
Posted: Sat Apr 14, 2012 3:32 pm Post subject: how to configure laptop-mode? |
|
|
hello
I tried to configure laptop-mode by following the Gentoo Power management guide and the man page. But it doesn't work. I don't where I am wrong. Please figure it out for me. Thanks in advance.
Here is the details
objective: change the cpu governor and lcd brightness automatically as laptop plugged or unplugged
Problem:
at first, I have to say that I can change it manually by, for example, "cpufreq-set -c 0 -g ondemand" for cpu frequency and "echo 4 > /sys/class/thermal/cooling_device0/cur_state"(which is to control LCD brightness)
For cpu frequency modulation, I modified file "/etc/laptop-mode/conf.d/cpufreq.conf" as follows
| Quote: | 31 # Should laptop mode tools control the CPU frequency settings?
32 #
33 # Set to 0 to disable
34 CONTROL_CPU_FREQUENCY="auto"
35
36
37 #
38 # Legal values are "slowest" for the slowest speed that your
39 # CPU is able to operate at, "fastest" for the fastest speed,
40 # "medium" for some value in the middle, or any value listed in
41 # /sys/devices/system/cpu/cpu*/cpufreq/scaling_available_frequencies.
42 # The "governor" can be any governor installed on your system, this usually
43 # includes "ondemand", "conservative", and "performance". The
44 # "IGNORE_NICE_LOAD" setting specifies that background programs that have
45 # a low priority ("nice level") should not cause the CPU frequency to
46 # be increased. (You generally want this to be enabled in battery mode.)
47 #
48 BATT_CPU_MAXFREQ=fastest
49 BATT_CPU_MINFREQ=slowest
50 BATT_CPU_GOVERNOR=conservative
51 BATT_CPU_IGNORE_NICE_LOAD=1
52 LM_AC_CPU_MAXFREQ=fastest
53 LM_AC_CPU_MINFREQ=slowest
54 LM_AC_CPU_GOVERNOR=ondemand
55 LM_AC_CPU_IGNORE_NICE_LOAD=1
56 NOLM_AC_CPU_MAXFREQ=fastest
57 NOLM_AC_CPU_MINFREQ=slowest
58 NOLM_AC_CPU_GOVERNOR=ondemand
59 NOLM_AC_CPU_IGNORE_NICE_LOAD=0
|
As the same as that before, for LCD brightness, I modified file "/etc/laptop-mode/conf.d/lcd-brightness.conf" as follows
| Quote: | 61 BATT_BRIGHTNESS_COMMAND="echo 4"
62 LM_AC_BRIGHTNESS_COMMAND="echo 1"
63 NOLM_AC_BRIGHTNESS_COMMAND="echo 0"
64 BRIGHTNESS_OUTPUT="/sys/class/thermal/cooling_device0/cur_state"
|
Then, when I unplugged the AC adapter, I can see that the laptop_mode is switched on from off by
but the cpufrequency governor and the LCD brightness weren't changed.
Here is the details of configuration file
"/etc/laptop-mode/laptop-mode.conf"
| Quote: |
ENABLE_LAPTOP_MODE_TOOLS=1
VERBOSE_OUTPUT=0
LOG_TO_SYSLOG=1
DEBUG=0
ENABLE_LAPTOP_MODE_ON_BATTERY=1
ENABLE_LAPTOP_MODE_ON_AC=0
ENABLE_LAPTOP_MODE_WHEN_LID_CLOSED=0
ENABLE_AUTO_MODULES=1
MINIMUM_BATTERY_CHARGE_PERCENT=3
DISABLE_LAPTOP_MODE_ON_CRITICAL_BATTERY_LEVEL=1
HD="/dev/[hs]d[abcdefgh]"
PARTITIONS="auto /dev/mapper/*"
ASSUME_SCSI_IS_SATA=1
LM_BATT_MAX_LOST_WORK_SECONDS=600
LM_AC_MAX_LOST_WORK_SECONDS=360
CONTROL_READAHEAD=1
LM_READAHEAD=3072
NOLM_READAHEAD=128
CONTROL_NOATIME=0
USE_RELATIME=1
CONTROL_HD_IDLE_TIMEOUT=1
LM_AC_HD_IDLE_TIMEOUT_SECONDS=20
LM_BATT_HD_IDLE_TIMEOUT_SECONDS=20
NOLM_HD_IDLE_TIMEOUT_SECONDS=7200
CONTROL_HD_POWERMGMT="auto"
BATT_HD_POWERMGMT=1
LM_AC_HD_POWERMGMT=254
NOLM_AC_HD_POWERMGMT=254
CONTROL_HD_WRITECACHE=0
NOLM_AC_HD_WRITECACHE=1
NOLM_BATT_HD_WRITECACHE=0
LM_HD_WRITECACHE=0
CONTROL_MOUNT_OPTIONS=1
LM_DIRTY_RATIO=60
NOLM_DIRTY_RATIO=40
LM_DIRTY_BACKGROUND_RATIO=1
NOLM_DIRTY_BACKGROUND_RATIO=10
DEF_UPDATE=5
DEF_XFS_AGE_BUFFER=15
DEF_XFS_SYNC_INTERVAL=30
DEF_XFS_BUFD_INTERVAL=1
DEF_MAX_AGE=30
XFS_HZ=100
LM_SECONDS_BEFORE_SYNC=2 |
"/etc/laptop-mode/conf.d/cpufreq.conf"
| Quote: | DEBUG=0
CONTROL_CPU_FREQUENCY="auto"
BATT_CPU_MAXFREQ=fastest
BATT_CPU_MINFREQ=slowest
BATT_CPU_GOVERNOR=conservative
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
CONTROL_CPU_THROTTLING=0
BATT_CPU_THROTTLING=medium
LM_AC_CPU_THROTTLING=medium
NOLM_AC_CPU_THROTTLING=minimum
|
"/etc/laptop-mode/conf.d/lcd-brightness.conf"
| Quote: |
DEBUG=0
CONTROL_BRIGHTNESS=1
BATT_BRIGHTNESS_COMMAND="echo 4"
LM_AC_BRIGHTNESS_COMMAND="echo 1"
NOLM_AC_BRIGHTNESS_COMMAND="echo 0"
BRIGHTNESS_OUTPUT="/sys/class/thermal/cooling_device0/cur_state"
|
|
|
| Back to top |
|
 |
pd1986 Apprentice

Joined: 19 Feb 2012 Posts: 251 Location: Paris
|
Posted: Sat Apr 14, 2012 7:56 pm Post subject: |
|
|
Sorry for forgetting to point you the environment
kernel: 3.2.12-gentoo
desktop: xfce4 |
|
| Back to top |
|
 |
pd1986 Apprentice

Joined: 19 Feb 2012 Posts: 251 Location: Paris
|
Posted: Mon Apr 30, 2012 7:33 pm Post subject: |
|
|
| still unsolved, need help. please |
|
| Back to top |
|
 |
Nicias Guru

Joined: 06 Dec 2005 Posts: 318
|
Posted: Tue May 01, 2012 6:36 pm Post subject: |
|
|
What does | Code: | | cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors | return? |
|
| Back to top |
|
 |
pd1986 Apprentice

Joined: 19 Feb 2012 Posts: 251 Location: Paris
|
Posted: Tue May 01, 2012 6:38 pm Post subject: |
|
|
| Nicias wrote: | What does | Code: | | cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors | return? |
it returns all the available governors
conservative ondemand powersave userspace performance
I can convert governor among these options manually. |
|
| Back to top |
|
 |
Nicias Guru

Joined: 06 Dec 2005 Posts: 318
|
Posted: Tue May 01, 2012 6:53 pm Post subject: |
|
|
I just looked around my system, and I control my cpu via cpufrequtils. I have this in my /etc/laptop-mode/conf.d/start-stop-programs.conf
| Code: |
....
#
# Should laptop mode start and stop programs?
#
CONTROL_START_STOP=1
#
# Services to start/stop depending on the power state.
#
#
# These services are started/stopped through their init scripts, together with
# the files from the directories mentioned above. Specify the services as a
# space separated list.
#
BATT_STOP="cpufrequtils sshd ntpd fcron"
BATT_START="lcd-dim"
LM_AC_STOP="lcd-dim"
LM_AC_START="cpufequtils sshd ntpd fcron"
NOLM_AC_STOP=""
NOLM_AC_START="" |
Then in /etc/conf.d/cpufrequitls I have | Code: | # /etc/conf.d/cpufrequtils: config file for /etc/init.d/cpufrequtils
# Options when starting cpufreq (given to the `cpufreq-set` program)
START_OPTS="--governor conservative"
# Options when stopping cpufreq (given to the `cpufreq-set` program)
STOP_OPTS="--governor powersave" |
lcd-dim is an init script I wrote myself: | Code: | #!/sbin/runscript
start() {
ebegin "Setting LCD brightness"
setpci -s 00:02.0 F4.B=${INTEL_DIM}
eend $?
}
stop () {
ebegin "Setting LCD brightness"
setpci -s 00:02.0 F4.B=${INTEL_NORMAL}
eend $?
} |
with /etc/conf.d/lcd-dim
| Code: |
# brightness level in ac mode. Default is 7. (intel is in hex)
INTEL_NORMAL=ff
# brightness level in battery mode. Default is 4. (intel is in hex.)
INTEL_DIM=10
|
I'm calling it "INTEL" since I used to have a complicated scheme to deal with my hybrid graphics, but bumblebee has sorted that out.
cpufrequtils, sshd, fcron, and ntpd are in the default runlevel.
Come to think of it, I should remove sshd from the whole thing I don't need to run it that often. |
|
| Back to top |
|
 |
pd1986 Apprentice

Joined: 19 Feb 2012 Posts: 251 Location: Paris
|
Posted: Wed May 02, 2012 12:38 pm Post subject: |
|
|
| Nicias wrote: | I just looked around my system, and I control my cpu via cpufrequtils. I have this in my /etc/laptop-mode/conf.d/start-stop-programs.conf
| Code: |
....
#
# Should laptop mode start and stop programs?
#
CONTROL_START_STOP=1
#
# Services to start/stop depending on the power state.
#
#
# These services are started/stopped through their init scripts, together with
# the files from the directories mentioned above. Specify the services as a
# space separated list.
#
BATT_STOP="cpufrequtils sshd ntpd fcron"
BATT_START="lcd-dim"
LM_AC_STOP="lcd-dim"
LM_AC_START="cpufequtils sshd ntpd fcron"
NOLM_AC_STOP=""
NOLM_AC_START="" |
Then in /etc/conf.d/cpufrequitls I have | Code: | # /etc/conf.d/cpufrequtils: config file for /etc/init.d/cpufrequtils
# Options when starting cpufreq (given to the `cpufreq-set` program)
START_OPTS="--governor conservative"
# Options when stopping cpufreq (given to the `cpufreq-set` program)
STOP_OPTS="--governor powersave" |
lcd-dim is an init script I wrote myself: | Code: | #!/sbin/runscript
start() {
ebegin "Setting LCD brightness"
setpci -s 00:02.0 F4.B=${INTEL_DIM}
eend $?
}
stop () {
ebegin "Setting LCD brightness"
setpci -s 00:02.0 F4.B=${INTEL_NORMAL}
eend $?
} |
with /etc/conf.d/lcd-dim
| Code: |
# brightness level in ac mode. Default is 7. (intel is in hex)
INTEL_NORMAL=ff
# brightness level in battery mode. Default is 4. (intel is in hex.)
INTEL_DIM=10
|
I'm calling it "INTEL" since I used to have a complicated scheme to deal with my hybrid graphics, but bumblebee has sorted that out.
cpufrequtils, sshd, fcron, and ntpd are in the default runlevel.
Come to think of it, I should remove sshd from the whole thing I don't need to run it that often. |
You mean that I need to start these script by this?
| Quote: | BATT_STOP="cpufrequtils sshd ntpd fcron"
BATT_START="lcd-dim"
LM_AC_STOP="lcd-dim"
LM_AC_START="cpufequtils sshd ntpd fcron"
NOLM_AC_STOP=""
NOLM_AC_START="" |
I don't this kind of configuration, every cmd is empty. this is mine
| Quote: | BATT_STOP=""
BATT_START=""
LM_AC_STOP=""
LM_AC_START=""
NOLM_AC_STOP=""
NOLM_AC_START="" |
I don't think the problem comes from there
However, does the configuration file in /etc/laptop-mode/con.f/ work automatically? like lcd-brightness.conf, cpufreq.conf.
is it enought if I have
| Quote: | | ENABLE_AUTO_MODULES=1 |
in laptop-mode.conf? |
|
| Back to top |
|
 |
Nicias Guru

Joined: 06 Dec 2005 Posts: 318
|
Posted: Wed May 02, 2012 12:52 pm Post subject: |
|
|
I'm not using the configuration in /etc/laptop-mode/conf.d/ so don't know if and how well they work. I have laptop mode offload most of it's configuration to services, so I can override them if I want. For example, if I want to use my full speed cpu, I can start cpufrequtils by hand, and then I'm good to go.
I'm suggesting if you are having trouble with laptop mode managing your cpu governer, have it control the cpufrequtils service instead. So comment out your /etc/laptop-mode/conf.d/cpufreq.conf. Add cpufreq to line lines in /etc/laptop-mode/conf.d/start-stop-programs.conf where I have it, and configure your /etc/conf.d/cpufrequtils |
|
| Back to top |
|
 |
pd1986 Apprentice

Joined: 19 Feb 2012 Posts: 251 Location: Paris
|
Posted: Fri May 04, 2012 3:40 pm Post subject: |
|
|
| Nicias wrote: | I'm not using the configuration in /etc/laptop-mode/conf.d/ so don't know if and how well they work. I have laptop mode offload most of it's configuration to services, so I can override them if I want. For example, if I want to use my full speed cpu, I can start cpufrequtils by hand, and then I'm good to go.
I'm suggesting if you are having trouble with laptop mode managing your cpu governer, have it control the cpufrequtils service instead. So comment out your /etc/laptop-mode/conf.d/cpufreq.conf. Add cpufreq to line lines in /etc/laptop-mode/conf.d/start-stop-programs.conf where I have it, and configure your /etc/conf.d/cpufrequtils |
Thanks, I will do the same. |
|
| Back to top |
|
 |
Nicias Guru

Joined: 06 Dec 2005 Posts: 318
|
Posted: Fri May 04, 2012 4:54 pm Post subject: |
|
|
| Great, let me know how it goes. |
|
| Back to top |
|
 |
pd1986 Apprentice

Joined: 19 Feb 2012 Posts: 251 Location: Paris
|
Posted: Fri May 04, 2012 6:45 pm Post subject: |
|
|
| Nicias wrote: | | Great, let me know how it goes. |
In fact, cpufrequtils starts when the system boots. So I just wrote a script file (not service) to control the cpufreq and lcd brightness, but in this case, it seems there is no interest in using laptop-mode.
In addition, do you know what to do to make laptop last longer in using battery besides decreasing lcd brightness and change the cpu frequency governor? I heard of hdparm to control hard disk which is included in laptop-mode, but I don't if laptop-mode can do it well. That's also why I want to know how to configure laptop-mode to make it work well.
I also use powertop to see which program consume the most. I find three ones, swapper/0, swapper/1 and kworker/0:3. They use more than 60% of total power. I don't know what they are. Do you have some ideas?
Thanks. |
|
| Back to top |
|
 |
Nicias Guru

Joined: 06 Dec 2005 Posts: 318
|
Posted: Fri May 04, 2012 8:45 pm Post subject: |
|
|
| laptop mode can control things like how long the kernel will keep writes cached before spinning up the drive, stuff like that. If I had to guess swapper0 and swapper1 sound like you are hitting swap on your laptop. What does "free -m" report? |
|
| Back to top |
|
 |
pd1986 Apprentice

Joined: 19 Feb 2012 Posts: 251 Location: Paris
|
Posted: Fri May 04, 2012 10:16 pm Post subject: |
|
|
| Nicias wrote: | | laptop mode can control things like how long the kernel will keep writes cached before spinning up the drive, stuff like that. If I had to guess swapper0 and swapper1 sound like you are hitting swap on your laptop. What does "free -m" report? |
I am sorry, I don't understand what you said about the laptop-mode control
yes I have swap partition in my laptop, does just swap consume more battery? I mean, in windows7 the duration of use under battery shows 3h30, but in linux, (I use xfce4), the monitor shows only 2h20. I don't understant.
for free -m
| Quote: | total used free shared buffers cached
Mem: 2002 1717 285 0 281 558
-/+ buffers/cache: 876 1125
Swap: 3071 0 3071
|
|
|
| Back to top |
|
 |
Nicias Guru

Joined: 06 Dec 2005 Posts: 318
|
Posted: Sat May 05, 2012 5:04 pm Post subject: |
|
|
I just edited some of the options in /etc/laptop-mode/laptop-mode.conf. Some of them have to do with how the harddrive is used.
No, just having swap available does not decrease battery life, but if it actually getting used, then it does. Looking at the results of "free" it appears that your available swap isn't being used at all. Which is good. Note the 0 in the Swap/used category.
I'm in over my head in terms of battery time. My method is:
- Dim LCD
- Turn off services (cron, ntp, etc)
- Turn on laptop-mode
- Follow all the suggestions powertop makes.
That is the limit of my expertise. |
|
| Back to top |
|
 |
pd1986 Apprentice

Joined: 19 Feb 2012 Posts: 251 Location: Paris
|
Posted: Sun May 06, 2012 1:32 am Post subject: |
|
|
| Nicias wrote: | I just edited some of the options in /etc/laptop-mode/laptop-mode.conf. Some of them have to do with how the harddrive is used.
No, just having swap available does not decrease battery life, but if it actually getting used, then it does. Looking at the results of "free" it appears that your available swap isn't being used at all. Which is good. Note the 0 in the Swap/used category.
I'm in over my head in terms of battery time. My method is:
- Dim LCD
- Turn off services (cron, ntp, etc)
- Turn on laptop-mode
- Follow all the suggestions powertop makes.
That is the limit of my expertise. |
Thanks, but powertop doesn't find my acpi setting for power usage, here is the info from powertop
| Quote: | ......
no ACPI power usage estimate available
......
|
I am always struggling with my acpi working because my fan doesn't work perfectly. |
|
| Back to top |
|
 |
Nicias Guru

Joined: 06 Dec 2005 Posts: 318
|
Posted: Sun May 06, 2012 11:58 am Post subject: |
|
|
| That sounds like an error in your kernel config. |
|
| Back to top |
|
 |
pd1986 Apprentice

Joined: 19 Feb 2012 Posts: 251 Location: Paris
|
Posted: Sun May 06, 2012 12:02 pm Post subject: |
|
|
| Nicias wrote: | | That sounds like an error in your kernel config. |
I think so but I haven't figure it out.
No matter I compile the kernel by "genkernel" or manually, the fan problem is always there. |
|
| Back to top |
|
 |
Nicias Guru

Joined: 06 Dec 2005 Posts: 318
|
|
| Back to top |
|
 |
pd1986 Apprentice

Joined: 19 Feb 2012 Posts: 251 Location: Paris
|
Posted: Sun May 06, 2012 3:40 pm Post subject: |
|
|
Thanks a lot |
|
| Back to top |
|
 |
|