You are not logged in.
Hello ![]()
I have an awful problem with battery consumption on my MacBook Air. The battery depletes extremely fast, only really giving me about two hours battery life.
Here's the device usage report from ptop:
The battery reports a discharge rate of 16.6 W
Usage Device name
100.0% USB device: Apple Internal Keyboard / Trackpad (Apple Inc.)
100.0% Display backlight
100.0% Display backlight
100.0% Radio device: btusb
100.6 pkts/s Network interface: wlan0 (wl)
100.0% Radio device: wl
100.0% USB device: usb-device-0424-2513
100.0% USB device: EHCI Host Controller
100.0% Audio codec hwC0D3: Intel
5.2% CPU use
0.0% USB device: EHCI Host Controller
0.0% USB device: UHCI Host Controller
0.0 ops/s GPU
0.0% USB device: usb-device-0424-2513
0.0% USB device: UHCI Host Controller
0.0% USB device: BRCM20702 Hub (Apple Inc.)
0.0% USB device: Bluetooth USB Host Controller (Apple Inc.)
0.0% Audio codec hwC0D0: Cirrus Logic
0.0% USB device: FaceTime Camera (Built-in) (Apple Inc.)
100.0% PCI Device: Intel Corporation Device 151a
100.0% PCI Device: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #2
100.0% PCI Device: Intel Corporation 6 Series/C200 Series Chipset Family USB Universal Host Controller #1
100.0% PCI Device: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller
100.0% PCI Device: Intel Corporation Device 151a
100.0% PCI Device: Intel Corporation 6 Series/C200 Series Chipset Family MEI Controller #1
100.0% PCI Device: Intel Corporation 6 Series/C200 Series Chipset Family USB Universal Host Controller #5
100.0% PCI Device: Intel Corporation Xeon E3-1200/2nd Generation Core Processor Family PCI Express Root Port
100.0% PCI Device: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 1
100.0% PCI Device: Intel Corporation 6 Series/C200 Series Chipset Family PCI Express Root Port 2
100.0% PCI Device: Intel Corporation Device 151a
100.0% PCI Device: Intel Corporation 2nd Generation Core Processor Family DRAM Controller
100.0% PCI Device: Broadcom Corporation BCM43224 802.11a/b/g/n
100.0% PCI Device: Intel Corporation 6 Series/C200 Series Chipset Family High Definition Audio Controller
100.0% PCI Device: Intel Corporation Device 151a
100.0% PCI Device: Intel Corporation 6 Series/C200 Series Chipset Family 6 port SATA AHCI Controller
0.0% PCI Device: Intel Corporation 6 Series/C200 Series Chipset Family USB Enhanced Host Controller #1As you can see, there's a fair few devices with 100% usage! So this is most likely the culprite.
I've added some commands to my rc.local to help with consumption, although they have helped a little bit, ptop is still reporting the above device status'.
Here's my rc.local:
#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
# - CPU Scaling (on demand scaling governor for all CPU's
for i in `find /sys/devices/system/cpu/*/cpufreq/scaling_governor`; do echo ondemand > $i; done;
# - CPU Scheduler
echo 1 > /sys/devices/system/cpu/sched_mc_power_savings;
# - Intel HDA
echo 1 > /sys/module/snd_hda_intel/parameters/power_save;
# - Laptop Mode
echo 5 > /proc/sys/vm/laptop_mode;
# - NMI Watchdog (turned off)
echo 0 > /proc/sys/kernel/nmi_watchdog;
# - Runtime Power Management
for i in `find /sys/devices/*/power/control`; do echo auto > $i; done;
# - SATA Active Link Powermanagement
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy;
# - USB Autosuspend (after 2 secs of inactivity)
for i in `find /sys/bus/usb/devices/*/power/control`; do echo auto > $i; done;
for i in `find /sys/bus/usb/devices/*/power/autosuspend`; do echo 2 > $i; done;
# - Device Power Management
echo auto | tee /sys/bus/i2c/devices/*/power/control > /dev/null;
echo auto | tee /sys/bus/pci/devices/*/power/control > /dev/null;
# - Set the VM dirty writeback time to 15 seconds
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs';
# - Enable wifi Power Management
iwconfig wlan0 power onHere's the modules I load on startup:
DAEMONS=(dbus slim syslog-ng crond acpid laptop-mode cpufreq_userspace acpi-cpufreq granola wl wicd alsa)And here's my bootline for Grub2:
linux /boot/vmlinuz-linux root=UUID=22843656-47cd-428f-9e27-0af678c96a06 rootflags=,relatime,data=ordered rootfstype=ext4 ro logo.nologo quietAny advice on this at all is greatly appreciated!
Last edited by Starfall (2012-07-13 09:02:37)
Visit my blog and my DeviatArt page
Offline
Have you been through the config files for laptop-mode tools? Your settings in rc.local seem to be trying to control things which laptop-mode tools also tries to control. I'm wondering if that's the best approach. (I suspect laptop-mode tools will be changing some of those settings etc.)
The same goes for the daemons controlling cpufreq vs. laptop-mode tools. Of course, maybe you've configured laptop-mode tools *not* to control these things, in which case it is probably fine...
Depending on your graphics, you may be able to pass some useful options on the kernel command line. I know this improved battery usage a lot for me.
And obviously there are the obvious things - turn off stuff you don't need (bluetooth/wireless/whatever) when on battery; dim the display; etc.
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
Offline
Thanks for the replies guys, really appreciate it!
Perhaps this is just due to confusion on my part and not configuring my system with the appropriate settings. I'm going to read up on the various different methods and ensure I've got it all worked out properly. Linking between different wiki pages in reference to different modules and tools has left me somewhat confused in respect to what works with what, so; I'll report back shortly with any progress I make/questions I have ![]()
Visit my blog and my DeviatArt page
Offline
Okay, so I've been doing a bit of reading and here's my current situation:
My modules line is now set as follows:
DAEMONS=(dbus slim syslog-ng crond @acpid @laptop-mode wl wicd alsa)My rc.local:
#!/bin/bash
#
# /etc/rc.local: Local multi-user startup script.
#
# - CPU Scaling (on demand scaling governor for all CPU's
for i in `find /sys/devices/system/cpu/*/cpufreq/scaling_governor`; do echo ondemand > $i; done;
# - CPU Scheduler
echo 1 > /sys/devices/system/cpu/sched_mc_power_savings;
# - Intel HDA
echo 1 > /sys/module/snd_hda_intel/parameters/power_save;
# - Laptop Mode
echo 5 > /proc/sys/vm/laptop_mode;
# - NMI Watchdog (turned off)
echo 0 > /proc/sys/kernel/nmi_watchdog;
# - Runtime Power Management
for i in `find /sys/devices/*/power/control`; do echo auto > $i; done;
# - SATA Active Link Powermanagement
echo min_power > /sys/class/scsi_host/host0/link_power_management_policy;
# - USB Autosuspend (after 2 secs of inactivity)
for i in `find /sys/bus/usb/devices/*/power/control`; do echo auto > $i; done;
for i in `find /sys/bus/usb/devices/*/power/autosuspend`; do echo 2 > $i; done;
# - Device Power Management
echo auto | tee /sys/bus/i2c/devices/*/power/control > /dev/null;
echo auto | tee /sys/bus/pci/devices/*/power/control > /dev/null;
# - Set the VM dirty writeback time to 15 seconds
echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs';
# - Enable wifi Power Management
iwconfig wlan0 power on;
# - Run power script
sh /etc/pm/power.d/99_macbookair;
# - Start upower for detection of powersource
upower -e And then here's a script in /etc/pm/power.d:
#!/bin/bash
# List of modules to unload, space seperated. Edit depending on your hardware and preferences.
modlist=""
# Bus list for runtime pm. Probably shouldn't touch this.
buslist="pci spi i2c"
case "$1" in
true)
# Enable some power saving settings while on battery
# Enable laptop mode
echo 5 > /proc/sys/vm/laptop_mode
# Less VM disk activity. Suggested by powertop
echo 1500 > /proc/sys/vm/dirty_writeback_centisecs
# Intel power saving
echo Y > /sys/module/snd_hda_intel/parameters/power_save_controller
echo 1 > /sys/module/snd_hda_intel/parameters/power_save
# Set backlight brightness to 50%
#echo 5 > /sys/devices/virtual/backlight/acpi_video0/brightness
# Set the brightness
xbacklight -dec 25
# USB powersaving
for i in /sys/bus/usb/devices/*/power/autosuspend; do
echo 1 > $i
done
# SATA power saving
for i in /sys/class/scsi_host/host*/link_power_management_policy; do
echo min_power > $i
done
# Disable hardware modules to save power
for mod in $modlist; do
grep $mod /proc/modules >/dev/null || continue
modprobe -r $mod 2>/dev/null
done
# Enable runtime power management. Suggested by powertop.
for bus in $buslist; do
for i in /sys/bus/$bus/devices/*/power/control; do
echo auto > $i
done
done
;;
false)
#Return settings to default on AC power
echo 0 > /proc/sys/vm/laptop_mode
echo 500 > /proc/sys/vm/dirty_writeback_centisecs
echo N > /sys/module/snd_hda_intel/parameters/power_save_controller
echo 0 > /sys/module/snd_hda_intel/parameters/power_save
xbacklight -inc 25
for i in /sys/bus/usb/devices/*/power/autosuspend; do
echo 2 > $i
done
for i in /sys/class/scsi_host/host*/link_power_management_policy
do echo max_performance > $i
done
for mod in $modlist; do
if ! lsmod | grep $mod; then
modprobe $mod 2>/dev/null
fi
done
for bus in $buslist; do
for i in /sys/bus/$bus/devices/*/power/control; do
echo on > $i
done
done
;;
esac
exit 0My battery life still isn't doing good
Does anyone have any thoughts? It's late and I've had a long day, so maybe I've some some stupid mistakes! ![]()
Visit my blog and my DeviatArt page
Offline
Are you sure gpu powersaving is enabled?
# cat /sys/module/i915/parameters/i915_enable_rc6
1P.s., i've never used "laptop mode" and the battery life on my 2011 Air seems to be okay (~4/5 hours max). I did encounter high loads and temperatures on the stock 3.4 kernel, which the -ck kernel doesn't seem to exhibit, so you could experiment a bit there as well.
ᶘ ᵒᴥᵒᶅ
Offline
Are you sure gpu powersaving is enabled?
#cat /sys/module/i915/parameters/i915_enable_rc6 1P.s., i've never used "laptop mode" and the battery life on my 2011 Air seems to be okay (~4/5 hours max). I did encounter high loads and temperatures on the stock 3.4 kernel, which the -ck kernel doesn't seem to exhibit, so you could experiment a bit there as well.
Thanks for your response litemotiv ![]()
Erm, I do have the rc6 boot flag on my boot line:
linux /boot/vmlinuz-linux root=UUID=22843656-47cd-428f-9e27-0af678c96a06 ro quiet splash pcie_aspm=force i-915.i915_enable_rc6=1 add_efi_memmapBut I get a minus one when looking to see if it's enabled? :S
cat /sys/module/i915/parameters/i915_enable_rc6
-1I would have at least expected a zero if it was off... but a minus one? D: Doesn't seem good!
As for your comments on battery life without laptop-mode, that sounds great! I certainly do get temperature issues. I'll read up on the ck kernel, would you perhaps put the power consumption improvement down to using it?
Many thanks in advance for any advice you have.
Last edited by Starfall (2012-07-05 16:38:34)
Visit my blog and my DeviatArt page
Offline
@starfall pcie_aspm=force is no longer required. It has been patched in latest kernels. Their is an error in your boot line
i-915.i915_enable_rc6=1you are using a dash (-) between i and 915. It should be
i915.i915_enable_rc6=1Offline
As for your comments on battery life without laptop-mode, that sounds great! I certainly do get temperature issues. I'll read up on the ck kernel, would you perhaps put the power consumption improvement down to using it?
I think gpu powersaving is the main contributor, enabling that will likely double your battery life.
I haven't compared the actual difference in uptime with the 3.4 stock kernel, but idle temperatures there were roughly 5-10 degrees celsius higher, so if that wasn't just a calculation difference it should be a sign of higher energy usage somewhere...
Oh by the way, i'm not sure what the add_efi_memmap kernel parameter does, but i suspect you won't need that one.
ᶘ ᵒᴥᵒᶅ
Offline
Starfall wrote:As for your comments on battery life without laptop-mode, that sounds great! I certainly do get temperature issues. I'll read up on the ck kernel, would you perhaps put the power consumption improvement down to using it?
I think gpu powersaving is the main contributor, enabling that will likely double your battery life.
I haven't compared the actual difference in uptime with the 3.4 stock kernel, but idle temperatures there were roughly 5-10 degrees celsius higher, so if that wasn't just a calculation difference it should be a sign of higher energy usage somewhere...
Oh by the way, i'm not sure what the add_efi_memmap kernel parameter does, but i suspect you won't need that one.
Great! thanks
As per my last post, does it even look like I have rc6 gpu powersaving on (as per the -1 output of the command you asked me to run)?
I believe I need add_efi_memmap for booting in EFI mode ![]()
I do have another issue that I've just ran into, so I hope you or someone else can help. I added 'elevator=bfq' to the end of my bootline, rebuilt my grub.cfg with
grub-mkconfig - o /boot/grub/grub.cfgand now I'm getting a kernel panic with the below message:
Unable to mount root fs on unknown-block(0,0)
Pid: 1, comm: BFS/0 Not tainted 3.4.4-ck #1![]()
Visit my blog and my DeviatArt page
Offline
Great! thanks
As per my last post, does it even look like I have rc6 gpu powersaving on (as per the -1 output of the command you asked me to run)?
No -1 is the code that powersaving is disabled (see donniezazen's remark).
I believe I need add_efi_memmap for booting in EFI mode
I'm also booting in EFI and i don't have it, although i don't use grub but boot with config_efi_stub...
I do have another issue that I've just ran into, so I hope you or someone else can help. I added 'elevator=bfq' to the end of my bootline, rebuilt my grub.cfg with
grub-mkconfig - o /boot/grub/grub.cfgand now I'm getting a kernel panic with the below message:
Unable to mount root fs on unknown-block(0,0) Pid: 1, comm: BFS/0 Not tainted 3.4.4-ck #1
I think you need to check the grub config, since it doesn't seem to point to the right partition. You can compare the -ck entry to the -arch entry for any differences.
ᶘ ᵒᴥᵒᶅ
Offline
@starfall pcie_aspm=force is no longer required. It has been patched in latest kernels. Their is an error in your boot line
i-915.i915_enable_rc6=1you are using a dash (-) between i and 915. It should be
i915.i915_enable_rc6=1
Thank you very much donniezazen! ![]()
Visit my blog and my DeviatArt page
Offline
Thank you! I hadn't even noticed his post.
Hm, well, I think I'd best keep it in there, just to be safe ![]()
Ah, okay, well I certainly only changed the one bit for BFS. Would running mkinitcpio to make the new ramdisk work? If so, how on earth would I go about applying that with the new ck kernel? o_0
Thanks in advance!
EDIT: Removing
elevator=bfqfrom my grub2's boot line didn't work. I'm booting to fallback mode right now to type this.
Here's my grub2's grubcfg if it helps:
#
# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#
### BEGIN /etc/grub.d/00_header ###
insmod part_gpt
insmod part_msdos
if [ -s $prefix/grubenv ]; then
load_env
fi
set default="0"
if [ x"${feature_menuentry_id}" = xy ]; then
menuentry_id_option="--id"
else
menuentry_id_option=""
fi
export menuentry_id_option
if [ "${prev_saved_entry}" ]; then
set saved_entry="${prev_saved_entry}"
save_env saved_entry
set prev_saved_entry=
save_env prev_saved_entry
set boot_once=true
fi
function savedefault {
if [ -z "${boot_once}" ]; then
saved_entry="${chosen}"
save_env saved_entry
fi
}
function load_video {
if [ x$feature_all_video_module = xy ]; then
insmod all_video
else
insmod efi_gop
insmod efi_uga
insmod ieee1275_fb
insmod vbe
insmod vga
insmod video_bochs
insmod video_cirrus
fi
}
if [ x$feature_default_font_path = xy ] ; then
font=unicode
else
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 22843656-47cd-428f-9e27-0af678c96a06
else
search --no-floppy --fs-uuid --set=root 22843656-47cd-428f-9e27-0af678c96a06
fi
font="/usr/share/grub/unicode.pf2"
fi
if loadfont $font ; then
set gfxmode=auto
load_video
insmod gfxterm
set locale_dir=$prefix/locale
set lang=en_GB
insmod gettext
fi
terminal_input console
terminal_output gfxterm
set timeout=5
### END /etc/grub.d/00_header ###
### BEGIN /etc/grub.d/10_linux ###
menuentry 'Arch Linux GNU/Linux, with Linux ck kernel' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-ck kernel-true-22843656-47cd-428f-9e27-0af678c96a06' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 22843656-47cd-428f-9e27-0af678c96a06
else
search --no-floppy --fs-uuid --set=root 22843656-47cd-428f-9e27-0af678c96a06
fi
echo 'Loading Linux ck kernel ...'
linux /boot/vmlinuz-linux-ck root=/dev/sda2 ro quiet splash i915.i915_enable_rc6=1 add_efi_memmap
}
menuentry 'Arch Linux GNU/Linux, with Linux core repo kernel' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-core repo kernel-true-22843656-47cd-428f-9e27-0af678c96a06' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 22843656-47cd-428f-9e27-0af678c96a06
else
search --no-floppy --fs-uuid --set=root 22843656-47cd-428f-9e27-0af678c96a06
fi
echo 'Loading Linux core repo kernel ...'
linux /boot/vmlinuz-linux root=UUID=22843656-47cd-428f-9e27-0af678c96a06 ro quiet splash i915.i915_enable_rc6=1 add_efi_memmap
echo 'Loading initial ramdisk ...'
initrd /boot/initramfs-linux.img
}
menuentry 'Arch Linux GNU/Linux, with Linux core repo kernel (Fallback initramfs)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-core repo kernel-fallback-22843656-47cd-428f-9e27-0af678c96a06' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod ext2
set root='hd0,gpt2'
if [ x$feature_platform_search_hint = xy ]; then
search --no-floppy --fs-uuid --set=root --hint-bios=hd0,gpt2 --hint-efi=hd0,gpt2 --hint-baremetal=ahci0,gpt2 22843656-47cd-428f-9e27-0af678c96a06
else
search --no-floppy --fs-uuid --set=root 22843656-47cd-428f-9e27-0af678c96a06
fi
echo 'Loading Linux core repo kernel ...'
linux /boot/vmlinuz-linux root=UUID=22843656-47cd-428f-9e27-0af678c96a06 ro quiet splash i915.i915_enable_rc6=1 add_efi_memmap
echo 'Loading initial ramdisk ...'
initrd /boot/initramfs-linux-fallback.img
}
### END /etc/grub.d/10_linux ###
### BEGIN /etc/grub.d/20_linux_xen ###
### END /etc/grub.d/20_linux_xen ###
### BEGIN /etc/grub.d/20_memtest86+ ###
### END /etc/grub.d/20_memtest86+ ###
### BEGIN /etc/grub.d/30_os-prober ###
### END /etc/grub.d/30_os-prober ###
### BEGIN /etc/grub.d/40_custom ###
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
### END /etc/grub.d/40_custom ###
### BEGIN /etc/grub.d/41_custom ###
if [ -f ${config_directory}/custom.cfg ]; then
source ${config_directory}/custom.cfg
elif [ -z "${config_directory}" -a -f $prefix/custom.cfg ]; then
source $prefix/custom.cfg;
fi
### END /etc/grub.d/41_custom ###And there's my fstab:
/etc/fstab: static file system information
#
# <file system> <dir> <type> <options> <dump> <pass>
tmpfs /tmp tmpfs nodev,nosuid 0 0
# DEVICE DETAILS: /dev/sda2 UUID=22843656-47cd-428f-9e27-0af678c96a06 LABEL=/
UUID=22843656-47cd-428f-9e27-0af678c96a06 / ext4 discard,defaults 0 1Last edited by Starfall (2012-07-06 17:25:43)
Visit my blog and my DeviatArt page
Offline
Unfortunately, I haven't made any progress with this, I'd appreciate any help anyone can give. Many thanks in advance.
Visit my blog and my DeviatArt page
Offline
Sorry Starfall, are you still having problems with this? Since this is a different issue than the rest of this thread, i would advise you to start a separate thread for you boot problems. Grub2 issues are more generic and a dedicated thread will likely attract more answers as well (i haven't used grub2 myself so i can't provide you with any useful insight).
Last edited by litemotiv (2012-07-12 20:02:21)
ᶘ ᵒᴥᵒᶅ
Offline
@Starfall
You don't seem to have an initrd entry for the ck kernel entry?
CLI Paste | How To Ask Questions
Arch Linux | x86_64 | GPT | EFI boot | refind | stub loader | systemd | LVM2 on LUKS
Lenovo x270 | Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz | Intel Wireless 8265/8275 | US keyboard w/ Euro | 512G NVMe INTEL SSDPEKKF512G7L
Offline
@Starfall
You don't seem to have an initrd entry for the ck kernel entry?
Hey cfr,
Thanks for the response, fortunately, I managed to solve this by simply compiling the kernel from the AUR instead. I wasn't previously able to do so, so opted for the 'easy' solution, however that proved quite the contrary
Increased my tempfs size and installed zram to enable me to compile the kernel instead, now it's all working ![]()
Appreciate all the help people have given me on this, I'm marking the thread as solved.
Visit my blog and my DeviatArt page
Offline