Battery draining on ThinkPad T14

I've recently installed FreeBSD 14.0-CURRENT on my ThinkPad T14 (Gen1, Intel) and after setting everything up I noticed that the battery is draining really quick (about 1% every one or two seconds with only a terminal window opened and dwm running as window manager and with the display brightness at 50%) and I know that this isn't normal because I had Linux installed before and it was lasting a lot more. I enabled powerd but nothing seems to change. Is there a way I can lower the power usage? on Linux I used laptop-mode-tools and it seemed to work well, but I'm completely new to the FreeBSD world so I don't know if there are equivalents or other ways around, nor I can find anything useful. Any idea on how to solve?
 
Can you post one output of sysutil/i7z?
I'm not sure if this is what you're asking for but this is the logfile I got:

Code:
1677663011.248111864
1185.495605
872.718140
863.001770
824.230835

Code:
------------------------------
--[core id]--- Other information
-------------------------------------
--[0] Processor number 0
--[0] Socket number/Hyperthreaded Sibling number  0,4
--[0] Core id number 0
--[0] Display core in i7z Tool: Yes

--[1] Processor number 1
--[1] Socket number/Hyperthreaded Sibling number  0,5
--[1] Core id number 1
--[1] Display core in i7z Tool: Yes

--[2] Processor number 2
--[2] Socket number/Hyperthreaded Sibling number  0,6
--[2] Core id number 2
--[2] Display core in i7z Tool: Yes

--[3] Processor number 3
--[3] Socket number/Hyperthreaded Sibling number  0,7
--[3] Core id number 3
--[3] Display core in i7z Tool: Yes

--[4] Processor number 4
--[4] Socket number/Hyperthreaded Sibling number  0,0
--[4] Core id number 0
--[4] Display core in i7z Tool: No

--[5] Processor number 5
--[5] Socket number/Hyperthreaded Sibling number  0,1
--[5] Core id number 1
--[5] Display core in i7z Tool: No

--[6] Processor number 6
--[6] Socket number/Hyperthreaded Sibling number  0,2
--[6] Core id number 2
--[6] Display core in i7z Tool: No

--[7] Processor number 7
--[7] Socket number/Hyperthreaded Sibling number  0,3
--[7] Core id number 3
--[7] Display core in i7z Tool: No
 
What I'm looking for is one screenful after that. Should look like this:
Code:
Socket [0] - [physical cores=6, logical cores=12, max online cores ever=6]
  TURBO ENABLED on 6 Cores, Hyper Threading ON
  Max Frequency without considering Turbo 2307.32 MHz (100.32 x [23])
  Max TURBO Multiplier (if Enabled) with 1/2/3/4/5/6 Cores is  41x/41x/40x/40x/39x/39x
  Real Current Frequency 2045.47 MHz [100.32 x 20.39] (Max of below)
        Core [core-id]  :Actual Freq (Mult.)      C0%   Halt(C1)%  C3 %   C6 %  Temp      VCo
        Core 1 [0]:       1994.57 (19.88x)      8.11    92.7       0       0    55      0.812
        Core 2 [1]:       1980.93 (19.75x)      9.85    91.2       0       0    55      0.811
        Core 3 [2]:       2005.07 (19.99x)      6.22    94.3       0       0    56      0.810
        Core 4 [3]:       1997.67 (19.91x)      8.48    92.3       0       0    56      0.811
        Core 5 [4]:       2003.80 (19.97x)      7.11    93.5       0       0    55      0.811
        Core 6 [5]:       2045.47 (20.39x)      8.47    92.1       0       0    55      0.811
 
I'd hazard a guess that it might be because of processor C states not being set. Try running:

sysctl dev.cpu.0.cx_supported

And see what the values are. For a laptop I'd expect at least C6 to be reported. Then try running:

sysctl dev.cpu.0.cx_lowest

Which will tell you the currently supported C states. I expect your battery drain is because it's set to C1.

Resolving this is easy though, go to /etc/rc.conf and add the following, along with the value from the cx_supported command. Such as:
Code:
performance_cx_lowest="C6"
economy_cx_lowest="C6"

You can also set it per core directly with sysctl, so:
sysctl dev.cpu.0.cx_lowest=C6
 
I'd hazard a guess that it might be because of processor C states not being set. Try running:

sysctl dev.cpu.0.cx_supported

And see what the values are. For a laptop I'd expect at least C6 to be reported. Then try running:

You won't see C6 reported on FreeBSD, which deals with what Intel call "OS C-states" or ACPI C-states: C1, C2 or C3.

What Linux reports in i7z as C6 and C7 are within ACPI C-state C3. Using the Linux terms in relation to FreeBSD sysctl settings only breeds confusion.

Suggested reading of recent discussion, the latter part of this thread:

High temperature and fan speed | Page 3 | The FreeBSD Forums

Erichans post covers lots of it, including references - that lead to others, notably (pdf):

Energy-Efficient Platforms – Considerations for Application Software and Services

particularly the illustrative graphic at section 2.1.2 Software C-state to Hardware C-state Mapping

sysctl dev.cpu.0.cx_lowest

Which will tell you the currently supported C states. I expect your battery drain is because it's set to C1.

Quite likely.

Resolving this is easy though, go to /etc/rc.conf and add the following, along with the value from the cx_supported command. Such as:
Code:
performance_cx_lowest="C6"
economy_cx_lowest="C6"

dev.cpu.0.cx_supported may differ whether on AC or battery on some systems.

It's more common to specify 'Cmax' aka C8, meaning the lowest possible ACPI C-state especially on battery, though C2 may be better on AC if overheating isn't a problem.

You can also set it per core directly with sysctl, so:
sysctl dev.cpu.0.cx_lowest=C6

You can, but when power source changes between AC and battery, performance or economy state will be reset, which actually sets sysctl hw.acpi.cpu.cx_lowest, which in turn sets each dev.cpu.N.cx_lowest to that.
 
Back
Top