Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Gentoo laptop power management
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo
View previous topic :: View next topic  
Author Message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 215

PostPosted: Sat Apr 30, 2016 6:50 pm    Post subject: Gentoo laptop power management Reply with quote

When I first installed gentoo I went and did some changes to increase the battery life which worked great, although I think I've read that there is more you can do than what I did.

I created two files in /etc/local.d with .start and .stop to change power management modes:

Code:
 1 iw dev wlan0 set power_save on;
 2 ethtool -s eth0 wol d;
 3 echo '1' > '/sys/devices/system/cpu/sched_mc_power_savings';
 4 echo '1500' > '/proc/sys/vm/dirty_writeback_centisecs';
 5 echo 'min_power' > '/sys/class/scsi_host/host0/link_power_management_policy';
 6 echo 'min_power' > '/sys/class/scsi_host/host1/link_power_management_policy';
 7 echo 'min_power' > '/sys/class/scsi_host/host2/link_power_management_policy';
 8 echo 'min_power' > '/sys/class/scsi_host/host3/link_power_management_policy';
 9 echo 'min_power' > '/sys/class/scsi_host/host4/link_power_management_policy';
10 echo 'min_power' > '/sys/class/scsi_host/host5/link_power_management_policy';


I am wondering where the config files and software are for determining the power management settings so I can further get more run time out of the laptop.

I have a HP laptop with a Intel(R) Core(TM) i5-3317U CPU @ 1.70GHz and I was reading that there are lots of changes to enter deeper power saving modes (I think i read something about C2 vs C7?) and I would like to know what they are so I can implement them.

Thanks.
Back to top
View user's profile Send private message
Martux
Veteran
Veteran


Joined: 04 Feb 2005
Posts: 1917

PostPosted: Sun May 01, 2016 6:02 am    Post subject: Reply with quote

You might want to have a look into these two:
sys-power/powertop
sys-power/thermald
Have them both running on my i7 laptop with good results.
_________________
"Coincidence is God's way of remaining anonymous."
Albert Einstein
"The road to success is always under construction"
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 215

PostPosted: Sun May 01, 2016 4:56 pm    Post subject: Reply with quote

Thanks for the suggestions. I had powertop installed, and all the tunables are set to good.

I installed thermald though and set it to run at the default runtime via rc-update. Should this be started sooner?

Also what does thermald do exactly and does it have any configurable options I should need to know about? Is there a wiki page, google couldn't find it with "thermald gentoo" as keywords.

According to powertop my package stays at C6 79% of the time as well as my cores. It never enters C7 mode, is there much difference?

Code:



          Package   |             Core    |            CPU 0       CPU 1
                    |                     | C0 active   1.4%        1.8%
                    |                     | POLL        0.0%    0.0 ms  0.2%    8.2 ms
                    |                     | C1          0.8%    0.3 ms  0.7%    0.3 ms
C2 (pc2)    1.7%    |                     | C2         96.9%   11.0 ms 96.4%   11.0 ms
C3 (pc3)    0.0%    | C3 (cc3)    0.0%    |
C6 (pc6)   84.0%    | C6 (cc6)   94.0%    |
C7 (pc7)    0.0%    | C7 (cc7)    0.0%    |

                    |             Core    |            CPU 2       CPU 3
                    |                     | C0 active   1.3%        1.7%
                    |                     | POLL        0.0%    0.0 ms  0.0%    1.2 ms
                    |                     | C1          0.7%    0.3 ms  0.5%    0.2 ms
                    |                     | C2         97.2%   11.5 ms 96.9%   15.4 ms
                    | C3 (cc3)    0.0%    |
                    | C6 (cc6)   94.7%    |
                    | C7 (cc7)    0.0%    |

                    |             GPU     |
                    |                     |
                    | Powered On  7.6%    |
                    | RC6         7.9%    |
                    | RC6p       84.5%    |
                    | RC6pp       0.0%    |
                    |                     |
                    |                     |


Is there anything else that can be done really? I went as far as hotkeying functions so I could dim my screen and such.
Back to top
View user's profile Send private message
Martux
Veteran
Veteran


Joined: 04 Feb 2005
Posts: 1917

PostPosted: Sun May 01, 2016 5:07 pm    Post subject: Reply with quote

I don't do more either. Of course I have the screen dimmed as much as possible (in KDE you can do that with the mouse wheel over the battery icon) and all tunables to "good". Thermald seems to take advantage of some low level processor features and doesn't need/want configuration IIRC. Lately, I have learned about RAPL support in kernel and since I activated it, powertop shows it activated, but I can't say I could have measured any impact from it. It's my understanding that with newer Intel CPUs, you should not rely on generic ACPI, but use the Intel-specific kernel stuff. Are you super unhappy with your battery life (or is it much better in Win), or are you just trying to tewak the last bit out of it?
_________________
"Coincidence is God's way of remaining anonymous."
Albert Einstein
"The road to success is always under construction"
Back to top
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2158
Location: Berlin, Germany

PostPosted: Sun May 01, 2016 5:07 pm    Post subject: Reply with quote

If you use an Intel GPU, it supports some deeper sleep states if you pass i915.allow_pc8=1 kernel parameter.

About C7 state, not all systems support this. You could look in your BIOS/UEFI setup whether an option to enable that exists. Or you could try to boot another distro live image (e.g. Ubuntu) to check if C7 works there.
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 215

PostPosted: Sun May 01, 2016 6:14 pm    Post subject: Reply with quote

Martux wrote:
It's my understanding that with newer Intel CPUs, you should not rely on generic ACPI, but use the Intel-specific kernel stuff. Are you super unhappy with your battery life (or is it much better in Win), or are you just trying to tewak the last bit out of it?


I am happy with it, I am just trying to do the most tweaks I can to get as much as I can out of it. I use it mostly for web browsing and development work on the go so there is nothing resource intensive running so I imagine with the right tweaks I can get a bit more out of it.

Is there any specific kernel settings/options I should look out for when configuration the kernel? If I recall I have it set to Intel P state control and the performance, userspace, and ondemand governors enabled.

Quote:
If you use an Intel GPU, it supports some deeper sleep states if you pass i915.allow_pc8=1 kernel parameter.

About C7 state, not all systems support this. You could look in your BIOS/UEFI setup whether an option to enable that exists. Or you could try to boot another distro live image (e.g. Ubuntu) to check if C7 works there.


I do have an Intel chipset GPU in this laptop. How do I pass kernel parameters to the kernel? I assume I have to modify the grub legacy config somewhere?

And yea I will try loading Ubuntu to check if the C7 states get used at all. I went through my bios multiple times in the past and not once have seen anything mentioning C7 or power saving modes that wasn't already enabled.
Back to top
View user's profile Send private message
Martux
Veteran
Veteran


Joined: 04 Feb 2005
Posts: 1917

PostPosted: Sun May 01, 2016 6:38 pm    Post subject: Reply with quote

abduct wrote:

I do have an Intel chipset GPU in this laptop. How do I pass kernel parameters to the kernel? I assume I have to modify the grub legacy config somewhere?


Yeah, just add it to the line of your gentoo installation in grub.conf. I also didn't try that, will you report if you have any impact with this setting?
_________________
"Coincidence is God's way of remaining anonymous."
Albert Einstein
"The road to success is always under construction"
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 215

PostPosted: Sun May 01, 2016 7:06 pm    Post subject: Reply with quote

Martux wrote:
abduct wrote:

I do have an Intel chipset GPU in this laptop. How do I pass kernel parameters to the kernel? I assume I have to modify the grub legacy config somewhere?


Yeah, just add it to the line of your gentoo installation in grub.conf. I also didn't try that, will you report if you have any impact with this setting?


I can see with powertop if the GPU enters a deeper power setting for any length of time if you want (which is better than nothing). I don't think I have the time for a full benchmark of 100% -> 0% battery for with and without the option though.

Edit:: No changes in power top. The Idle stats page still reports:

Code:
                    |             GPU     |
                    |                     |
                    | Powered On  9.4%    |
                    | RC6         9.7%    |
                    | RC6p       80.8%    |
                    | RC6pp       0.0%    |
                    |                     |
                    |                     |


I am not sure if it was supposed to show up as RC8 or not. I will also have to double check to make sure I have the right drivers installed. I can't recall off the top of my head, but X11 works so something has to be there.

Dmesg shows:

Code:
# dmesg | grep i915
[    0.000000] Command line: root=/dev/sda3 i915.allow_pc8=1
[    0.000000] Kernel command line: root=/dev/sda3 i915.allow_pc8=1
[    0.839822] i915 0000:00:02.0: irq 24 for MSI/MSI-X
[    0.868068] [drm] Initialized i915 1.6.0 20140905 for 0000:00:02.0 on minor 0
[    0.922813] [drm] GMBUS [i915 gmbus vga] timed out, falling back to bit banging on pin 2
[    1.772630] i915 0000:00:02.0: fb0: inteldrmfb frame buffer device
[    1.772640] i915 0000:00:02.0: registered panic notifier


So I am not sure.

Just checked https://wiki.gentoo.org/wiki/Intel and I have everything configured to the wiki so no idea.
Back to top
View user's profile Send private message
Martux
Veteran
Veteran


Joined: 04 Feb 2005
Posts: 1917

PostPosted: Sun May 01, 2016 7:36 pm    Post subject: Reply with quote

I think the powertop values for your GPU look fine, it's very similair here.
My older laptop: Intel(R) Core(TM) i7-4712MQ CPU @ 2.30GHz is still going to C7 a lot if I read this correct:
Code:

                    | C3 (cc3)    1,9%    | C3-HSW      2,0%    0,6 ms  0,6%    0,8 ms
                    | C6 (cc6)    0,6%    | C6-HSW      0,8%    0,9 ms  0,1%    0,5 ms
                    | C7 (cc7)   81,1%    | C7s-HSW    86,1%    3,1 ms 91,9%    7,4 ms

The newer one too. Have you disabled any generic ACPI driver in kernel?
I also found it pretty tough to configure everything intel related properly, for example in kernel config's device driver section I still found stuff under "x86-specific bla bla".

My dmesg line looks just like yours. What's the expected battery life of your machine and what you get?
I have a skylake ultrabook, that was tested with realistic 6h battery run time (w/o WIFI, screen dimmed) and I can get that only under good circumstances (means if the device is idling a lot).
_________________
"Coincidence is God's way of remaining anonymous."
Albert Einstein
"The road to success is always under construction"
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 215

PostPosted: Sun May 01, 2016 7:48 pm    Post subject: Reply with quote

I will have to double check to see if I have the generic ACPI drivers disabled. I think I got them all, but I might of missed something.

I was just wondering if there was more to do than I possibly already done to squeeze life out of it. I am fine with its life right now (around 3-4 hours) but I like tuning my machines to the most they can handle.

My laptop is the HP-4-1130us which amazon states should have a 7 hour battery life, which I definitely never even seen close to those numbers.

Is there a way to force bluetooth off by the way? I never use it and I can't tell if it is enabled or not.


Last edited by abduct on Sun May 01, 2016 7:50 pm; edited 1 time in total
Back to top
View user's profile Send private message
Martux
Veteran
Veteran


Joined: 04 Feb 2005
Posts: 1917

PostPosted: Sun May 01, 2016 7:50 pm    Post subject: Reply with quote

Depending on the init system you are using, you can just not enable bluetooth by any runlevel service or systemd service.
_________________
"Coincidence is God's way of remaining anonymous."
Albert Einstein
"The road to success is always under construction"
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Sun May 01, 2016 7:51 pm    Post subject: Re: Gentoo laptop power management Reply with quote

abduct wrote:
Code:
 5 echo 'min_power' > '/sys/class/scsi_host/host0/link_power_management_policy';
 6 echo 'min_power' > '/sys/class/scsi_host/host1/link_power_management_policy';
 7 echo 'min_power' > '/sys/class/scsi_host/host2/link_power_management_policy';
 8 echo 'min_power' > '/sys/class/scsi_host/host3/link_power_management_policy';
 9 echo 'min_power' > '/sys/class/scsi_host/host4/link_power_management_policy';
10 echo 'min_power' > '/sys/class/scsi_host/host5/link_power_management_policy';

abduct ... you should probably use a loop there:

Code:
for i in /sys/class/scsi_host/host[0-5]/link_power_management_policy ; do
   echo 'min_power' > "$i"
done

This is mine, started via local.d

Code:
#!/bin/sh

for i in /sys/class/scsi_host/host[0-3]/link_power_management_policy ; do
   echo 'min_power' > "$i"
done

for i in /sys/bus/usb/devices/[1-5]*/power/control ; do
   echo 'auto' > "$i"
done

for i in /sys/bus/pci/devices/0000:*/power/control ; do
   echo 'auto' > "$i"
done

# vim:ft=sh:ts=4:sw=4:noexpandtab

Other parameter (like 'vm.dirty_writeback_centisecs') are in /etc/sysctl.conf.

best ... khay
Back to top
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2158
Location: Berlin, Germany

PostPosted: Sun May 01, 2016 7:58 pm    Post subject: Reply with quote

abduct wrote:
I am not sure if it was supposed to show up as RC8 or not. I will also have to double check to make sure I have the right drivers installed. I can't recall off the top of my head, but X11 works so something has to be there.
i915.allow_pc8=1 will allow the system to enter package C8+ states (which is not the same as core C states, so I am not sure if powertop will display this correctly. EDIT: apparently, turbostat will display Pkg%c8/9/10). Also this state will only be reached when display output is suspended.

abduct wrote:
Is there a way to force bluetooth off by the way? I never use it and I can't tell if it is enabled or not.
Look in /sys/class/rfkill or "emerge rfkill" for convenience.

Last edited by chithanh on Sun May 01, 2016 8:13 pm; edited 1 time in total
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 215

PostPosted: Sun May 01, 2016 8:00 pm    Post subject: Re: Gentoo laptop power management Reply with quote

Martux wrote:
Depending on the init system you are using, you can just not enable bluetooth by any runlevel service or systemd service.


Okay perfect I found it and it was already stopped so I guess I don't have to worry about that.

khayyam wrote:

abduct ... you should probably use a loop there:

Other parameter (like 'vm.dirty_writeback_centisecs') are in /etc/sysctl.conf.

best ... khay


Thanks that looks way nicer and I even got to add some options I didn't know I could control.

My laptop is the HP-4-1130us which amazon states should have a 7.5 hour battery life, which I definitely never even seen close to those numbers. It is probably a marketing thing, but yea if those are actually real, I only get 3-4 hours out of the 7.5.

Quote:
i915.allow_pc8=1 will allow the system to enter package C8+ states (which is not the same as core C states, so I am not sure if powertop will display this correctly). Also this state will only be reached when display output is suspended.


When does the screen get suspended? When the lid is closed and output does not happen, or is a software setting that needs to be triggered?
Back to top
View user's profile Send private message
Martux
Veteran
Veteran


Joined: 04 Feb 2005
Posts: 1917

PostPosted: Sun May 01, 2016 8:05 pm    Post subject: Reply with quote

My laptop is advertised as "up to 15h, which is in fact a joke. That can really only be achieved if nothing is done with it :)
_________________
"Coincidence is God's way of remaining anonymous."
Albert Einstein
"The road to success is always under construction"
Back to top
View user's profile Send private message
chithanh
Developer
Developer


Joined: 05 Aug 2006
Posts: 2158
Location: Berlin, Germany

PostPosted: Sun May 01, 2016 8:10 pm    Post subject: Re: Gentoo laptop power management Reply with quote

abduct wrote:

When does the screen get suspended? When the lid is closed and output does not happen, or is a software setting that needs to be triggered?
When the lid is closed and/or the screen is in dpms off mode, for example

If your Bluetooth is USB based, then disabling it via rfkill will often remove power to the USB module. Else it will remain powered even if it is not used.
The advertised battery life is usually with wifi disabled and screen dimmed to 100 cd/m² brightness.
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 215

PostPosted: Sun May 01, 2016 8:17 pm    Post subject: Re: Gentoo laptop power management Reply with quote

chithanh wrote:
abduct wrote:

When does the screen get suspended? When the lid is closed and output does not happen, or is a software setting that needs to be triggered?
When the lid is closed and/or the screen is in dpms off mode, for example

If your Bluetooth is USB based, then disabling it via rfkill will often remove power to the USB module. Else it will remain powered even if it is not used.
The advertised battery life is usually with wifi disabled and screen dimmed to 100 cd/m² brightness.


Okay thats perfect then. My bluetooth is usb based as per lsusb, and I often leave my screen closed and ssh into it when I can from a desktop.

I am going to run my laptop down and see if I get some better gains out of it with these changes in this thread. I'll report back later.

Edit:: 20% down 1 hour 15 minutes. At this rate 100% to 0% will be 6 hours 15 minutes. If this is true I might of gained upwards of 1-2 hours from my previous times. This is with the lid closed in a completely idle state besides sshd, a bash loop, and wifi enabled. Will update when I get to 50% or something. I will also time it eventually doing basic tasks such as using firefox to stream youtube or watching movies with the screen open to simulate basic usage.
Back to top
View user's profile Send private message
khayyam
Watchman
Watchman


Joined: 07 Jun 2012
Posts: 6227
Location: Room 101

PostPosted: Mon May 02, 2016 12:14 am    Post subject: Re: Gentoo laptop power management Reply with quote

abduct wrote:
[...] This is with the lid closed in a completely idle state besides sshd, a bash loop, and wifi enabled.

abduct ... laptops often have the keyboard as a source of passive cooling, so rather than close the lid (and so block a source of heat disipation) you can run 'xset dpms force standby' and have the display off.

best ... khay
Back to top
View user's profile Send private message
abduct
Apprentice
Apprentice


Joined: 19 Mar 2015
Posts: 215

PostPosted: Mon May 02, 2016 3:16 am    Post subject: Re: Gentoo laptop power management Reply with quote

khayyam wrote:
abduct wrote:
[...] This is with the lid closed in a completely idle state besides sshd, a bash loop, and wifi enabled.

abduct ... laptops often have the keyboard as a source of passive cooling, so rather than close the lid (and so block a source of heat disipation) you can run 'xset dpms force standby' and have the display off.

best ... khay


Thanks, I bound it to a fluxbox hotkey now.

So I ran the battery down to 5% before plugging it back in and I got 6 hours and 30 minutes in a completely idle state. Now if these changes did anything? Not sure since I never use the laptop in a completely idle state. I will let it charge back up and tomorrow try again with some loads like youtube playing in firefox, maybe compiling the same software over and over again via a

Code:
while true; do make; make clean; sleep 15; done


loop to simulate some kind of work. Or perhaps I will just use smplayer and run some movies through it. Although I am hopeful that these changes did increase the battery life by some marginal percent.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Other Things Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum