Laptop battery life - brand new X1 Carbon 6th gen only 4 hours on FreeBSD

i-bsd

Member

Reaction score: 7
Messages: 57

Can anyone point me to a guide for optimizing battery life?

Just installed on a brand new laptop yesterday that is supposed to offer 10+ hours but `acpiconf -i 0` shows around 4 hours of life.
 

JAW

Member

Reaction score: 14
Messages: 39

Can anyone point me to a guide for optimizing battery life?

Just installed on a brand new laptop yesterday that is supposed to offer 10+ hours but `acpiconf -i 0` shows around 4 hours of life.
Installing the drm-next-kmod port, along with setting up powerd gave me huge gains on my Intel Broadwell based MacbookAir. I could only get around 6 hours max without and now get 16 hours;

# acpiconf -i 0
Code:
Design capacity:    71500 mWh
Last full capacity:    66060 mWh
Technology:        secondary (rechargeable)
Design voltage:        7600 mV
Capacity (warn):    250 mWh
Capacity (low):        100 mWh
Low/warn granularity:    10 mWh
Warn/full granularity:    10 mWh
Model number:      
Serial number:      
Type:          
OEM info:      
State:            discharging
Remaining capacity:    100%
Remaining time:        16:06
Present rate:        4123 mW
Present voltage:    8468 mV
/etc/rc.conf
Code:
# Enable power daemon (cpu frequency control)
powerd_enable="YES"
powerd_flags="-a adaptive -b adaptive -n adaptive"
performance_cx_lowest="Cmax"
economy_cx_lowest="Cmax"

# Load Intel GPU kernel modesetting module
kld_list="/boot/modules/i915kms.ko"
/boot/loader.conf
Code:
# Disable legacy p4 and acpi power management                 
hint.p4tcc.0.disabled=1
hint.acpi_throttle.0.disabled=1

# Any PCI devices that do not have a driver put into ACPI D3 power state (off)
hw.pci.do_power_nodriver=3

# Enable GPU power-saving idle states
drm.i915.enable_rc6=7
Edit: I also disabled Bluetooth as I have no need for it, which saved a bit of power.
 
  • Thanks
Reactions: hph
OP
OP
i-bsd

i-bsd

Member

Reaction score: 7
Messages: 57

Phishfry,

If I install powerd++, how do I enable it in rc.conf? Docs don't explain it (or does it automatically replace powerd)?

JAW,

Can you explain this line: `powerd_flags="-a adaptive -b adaptive -n adaptive"`

Are there hardware risks with these changes? (understandably don't want to damage a brand new laptop battery or CPU)
 

bookwormep

Well-Known Member

Reaction score: 154
Messages: 282

Also, a small point to consider, OEM's under charge the batteries before shipping out brand new equipment orders. It is just a safety measure for those Lithium ion batteries.
(You need to fully charge the batteries when equipment arrives.)
 
OP
OP
i-bsd

i-bsd

Member

Reaction score: 7
Messages: 57

Somebody shared this with me on Reddit:

https://delta-xi.net/#056

about Si03 on Linux and then copying it over to FreeBSD to utilize deep power state on X1 Carbon 6th gen.

I haven't seen anything about this anywhere else so reluctant to try it. Anybody able to weigh in? I managed to get my laptop to ~8 hours yesterday by adding a few recommendations to rc.conf and loader.conf which is better than before.

Would prefer 10+ though.
 

JAW

Member

Reaction score: 14
Messages: 39

Phishfry,
Can you explain this line: `powerd_flags="-a adaptive -b adaptive -n adaptive"`

Are there hardware risks with these changes? (understandably don't want to damage a brand new laptop battery or CPU)
man powerd
Adaptive mode will change the CPU frequency in response to the current load, so if not doing anything it will lower the frequency (down to 500Mhz on my Broadwell), but if you start compiling or something it will ramp the CPU frequency up.

The "-a, -b, -n" switches tell powerd which mode to use for AC, Battery, and Unknown AC status, respectively.

It's completely safe, in fact my laptop runs much cooler with it enabled.
 

JAW

Member

Reaction score: 14
Messages: 39

JAW,

How did you disable bluetooth?
I have these lines in /boot/loader.conf

Code:
# Disable USB Apple/Broadcom hub and Bluetooth driver (uhub1 / ubt0)
hint.uhub.1.disabled="1"
hint.ubt.0.disabled="1"
However, Minbari's link was a better approach, using devd rules to disable it. Disabling the driver by adding hints into loader.conf is dependent on the hub always being enumerated as uhub 1. :-/
 

JAW

Member

Reaction score: 14
Messages: 39

Somebody shared this with me on Reddit:

https://delta-xi.net/#056

about Si03 on Linux and then copying it over to FreeBSD to utilize deep power state on X1 Carbon 6th gen.

I haven't seen anything about this anywhere else so reluctant to try it. Anybody able to weigh in? I managed to get my laptop to ~8 hours yesterday by adding a few recommendations to rc.conf and loader.conf which is better than before.

Would prefer 10+ though.
Are you using the drm-next-kmod driver for your integrated Intel graphics? Installing that driver gave me the biggest power saving by far, in conjunction with the previously mentioned line in /boot/loader.conf

Code:
# Enable GPU power-saving idle states
drm.i915.enable_rc6=7
 
OP
OP
i-bsd

i-bsd

Member

Reaction score: 7
Messages: 57

Yea I installed drm-next-kmod.

I'm getting ~8 hours now. I *think* that's about as good as it's going to get.

The hard thing is, I received my X1 Carbon 6th Gen about two days ago, and immediately erased Windows to install FreeBSD without actually benchmarking it first so I have no idea what the battery is currently capable of.

I'm assuming 8 hours is pretty good considering I got the 2k screen which supposedly reduces battery life by 2 hours compared to the regular HD screen.
 

Minbari

Well-Known Member

Reaction score: 189
Messages: 363

With the following settings on T430 (i7 3612QM), my battery (6 cells) is offering me ~2,5 hours after 4 years of use.

Code:
# Power: hiadaptive speed while on AC, adaptive on battery power
powerd_enable="YES"
powerd_flags="-a hiadaptive -b adaptive -i 75 -r 85 -p 500"
performance_cx_lowest="Cmax"
economy_cx_lowest="Cmax"
 
OP
OP
i-bsd

i-bsd

Member

Reaction score: 7
Messages: 57

Is this with the modifications made to the ACPI DSDT table as per https://delta-xi.net/#056 or simply by installing drm-next-kmod

Any dificulties with using such a hiDPI screen?
I haven't attempted the changes explained on delta-xi.net no because I never use hibernation on laptops. Just drm-next-kmod.

No problems with the screen. Looks fantastic. See my video here:
 

PacketMan

Aspiring Daemon

Reaction score: 144
Messages: 895

I would like to add: never underestimate how WiFi can be an energy sucking pig. I have no experience with WiFi on FreeBSD and how to optimize its configuration, but personal experience (on cell phones) has shown me that Wifi can drain a battery very fast in certain situations. One of those situations was Disney World. They have done a really good job at putting WiFi APs all over their properties. Even though I was not using my phone much, just the act of walking around caused my cell phone WiFi radio/controller to be frequently 'interacting' with the AP network. I simply turned off WiFi until I needed to use it. When in the waiting lines I heard other people saying the same thing that their batteries were draining real quick. So back to FreeBSD, maybe there are some WiFi optimizations that can be done, and/or turning it off when not required.
 

Sensucht94

Well-Known Member

Reaction score: 402
Messages: 390

No problems with the screen. Looks fantastic. See my video here:
Cool, as of 30 seconds ago, I'm your first subscriber ;)
I had opened this thread just to give you all the hints JAW provided; make sure to follow them, that's the hint.

As lebarondermerde noticed, sysutils/powerdxx, whose maintainer is himself, usually gives better results than the powerd found in base system. powerd and powerdxx are not harmful at all (unless you set crazy settings like forcing a minimum clock frequency close to the CPU expected maximum), you can compare them with Linux' TLP.

An ideal (IMHO) /etc/rc.conf entry would be then (for a 8th gen i7):
Code:
powerdxx_enable="YES"
powerdxx_flags="-f -a adaptive -b hiadaptive -n hiadaptive -p 100 --batt-max 3.5ghz -H80"
Some small additional tweaks to append to JAW's suggestions:

- inside /etc/rc.conf
Code:
#enable dynamically sleeping wifi NIC
ifconfig_wlan0="WPA SYNCDHCP powersave"
- inside /boot/loader.conf
Code:
# Intel i915 tunables (many of those are often default in Linux distros)
       #enable power savings
       drm.i915.powersave=1
       #enable render C-state 6.
       drm.i915.enable_rc6="7"
       #enable Intel IOMMU,
       drm.i915.intel_iommu_enabled="1"
       #enable LVDS downlock,
       drm.i915.lvds_downclock=1
       #use semaphores for inter-ring sync
       drm.i915.semaphores="1"
       #enable framebuffer compression
       drmi915_enable_fbc=1

#higher sound card buffering latency
hw.snd.latency=7

#enable LCD screen brightness control (see below)
  acpi_video_load="YES"

#enable Thinkpad ACPI driver (see below); will likely allow suspending/resuming easily, see           # acpi_ibm(4) man page
  acpi_ibm_load="YES"

#limit ZFS ARC (4G instead of default  half=8Gb out of 16)
  vfs.zfs.arc_max="4G"

#enable CPU freq monitoring
  cpufreq_load="YES"
#enable temperature monitoring
  coretemp_load="YES"
- inside /etc/sysctl.conf
Code:
#tweak brightness values (WARNING: admitted values for a given monitor are returned by
# sysctl  hw.acpi.video.<device>.levels; below are example ideal values)
    hw.acpi.video.lcd0.brightness=85
    hw.acpi.video.lcd0.economy=60
    hw.acpi.video.lcd0.fullpower=95

# acpi_ibm tunables
  dev.acpi_ibm.0.lcd_brightness=85
  dev.acpi_ibm.0.thinklight=0
  dev.acpi_ibm.0.bluetooth=0 #disables bluetooth
- enable USB peripheral powersaving at boot through a custom rc init script, like /usr/local/etc/rc.d/usb_power. Use usbconfig(8) to determine which slots are connected to which peripherals and enable powersaving subsequently for them. For example, if usbconfig returns that ports ugen0.3, ugen1.4 and ugen2.1 are connected, create a rc script file like above with the following content:
Code:
/usr/sbin/usbconfig -d ugen0.3 power_save
/usr/sbin/usbconfig -d ugen1.4 power_save
/usr/sbin/usbconfig -d ugen2.1 power_save
Suggestions to enhance battery life and consume less:

- use a lightweight WM (cwm, dwm, jwm, icewm, ratpoison, stumpwm) without a composite manager. Compositors are a true battery killers

- do not use browsers depending on QtWebEngine; Seamonkey and Palemoon are the best compromise in terms of features/consumption ratio

- compile from source with fewest features possible

- do not use a display manager

- rely on CLI the most you can

- do not enable hald, avahidaemon or consolekit
 
OP
OP
i-bsd

i-bsd

Member

Reaction score: 7
Messages: 57

Thanks for this. Very helpful.

But I added the i915 lines you mentioned and it *massively* slows down X on my system (open up urxvt in i3 has a 2 second delay).

Code:
# Intel i915 tunables (many of those are often default in Linux distros)
       #enable power savings
       drm.i915.powersave=1
       #enable render C-state 6.
       drm.i915.enable_rc6="7"
       #enable Intel IOMMU,
       drm.i915.intel_iommu_enabled="1"
       #enable LVDS downlock,
       drm.i915.lvds_downclock=1
       #use semaphores for inter-ring sync
       drm.i915.semaphores="1"
       #enable framebuffer compression
       drmi915_enable_fbc=1
 

Sensucht94

Well-Known Member

Reaction score: 402
Messages: 390

Thanks for this. Very helpful.

But I added the i915 lines you mentioned and it *massively* slows down X on my system (open up urxvt in i3 has a 2 second delay).
well it's expected to hsve a great impact, this is the most power saving configuration posdibe for the intel driver; I think you may want to enable/disable each of them one at a time and which of them has the most conventient power consumption/performance ratio; personally, outside JAW's entries I'd keep just semaphores or framebuffer compression ;)


Another tip: a custom kernel including only the drivers you need can help too; also,do not enable the Linux compat layer like you used to with Nvidia, unless you truly need it
 
OP
OP
i-bsd

i-bsd

Member

Reaction score: 7
Messages: 57

nope, a mistake of mine, there's naturally a dot in between, sorry for the inconvenience
Ok no worries. But is it .enable or _enable?

Should it be:
Code:
drm.i915.enable_fbc="1"
I can't find a clear example of this online so not sure.
 

Sensucht94

Well-Known Member

Reaction score: 402
Messages: 390

Ok no worries. But is it .enable or _enable?

Should it be:
Code:
drm.i915.enable_fbc="1"
I can't find a clear example of this online so not sure.
Yes it's correct that way (it's not a module to "_enable", rather a kernel module tunable optionderiving from the corresponding linux i915 driver option). See drm2/i915/i915_drv.c for a list of tunable options:
Code:
int i915_enable_fbc __read_mostly = -1;
TUNABLE_INT("drm.i915.enable_fbc", &i915_enable_fbc);
module_param_named(i915_enable_fbc, i915_enable_fbc, int, 0600);
MODULE_PARM_DESC(i915_enable_fbc,
        "Enable frame buffer compression for power savings "
        "(default: -1 (use per-chip default))");
 
Top