% sysctl dev.cpu.{0,1}.cx_usage gives 100% all the time while % top gives over 99% idle

Hi there,

My laptop is thinkpad T400, FreeBSD 13.0 release upgraded from 12.2, default kernel.
Question as titled.
Following the instructions on this forum and other resources, I've tried to tweak config files to lower the power consumption. In /etc/rc.conf, these are added:
Code:
powerd_enable="YES"
powerd_flags="-a hiadaptive -b adaptive"
performance_cx_lowest="Cmax"
economy_cx_lowest="Cmax"
kld_list="acpi_ibm"

In /boot/loader.conf, these are added:
Code:
hw.pci.do_power_nodrive="3"
hint.p4tcc.0.disabled="1"
hint.acpi_throttle.0.disabled="1"
compat.linuxkpi.fastboot="1"
compat.linuxkpi.semaphores="1"
compat.linuxkpi.enable_rc6="7"
compat.linuxkpi.enable_dc="2"
compat.linuxkpi.enable_fbc="1"

Code:
% sysctl dev.cpu.{0,1}.cx_usage
dev.cpu.0.cx_usage: 100.00% 0.00% 0.00% last 1186us
dev.cpu.1.cx_usage: 100.00% 0.00% 0.00% last 887us

By running % top, I see 99.x% idle.

It doesn't look right to me. What am I doing wrong or missing?
 
The 100% you see is the C1 power saving state for a cpu. (the core clock is turned off)
To list the cpu states of all the cpu's:
Code:
sysctl -a | grep -i cx | sort
 
I guess the real question is, can I relax because from % top the CPU idle time is already 99%?
 
Here is the output from a T430 laptop:
Code:
% sysctl dev.cpu.{0,1,2,3}.cx_usage
dev.cpu.0.cx_usage: 15.02% 84.97% last 1906us
dev.cpu.1.cx_usage: 11.53% 88.46% last 346us
dev.cpu.2.cx_usage: 10.97% 89.02% last 804us
dev.cpu.3.cx_usage: 10.61% 89.38% last 1240us
How to explain the difference from the output on T400?
 
Here is the output from a T430 laptop:
Code:
% sysctl dev.cpu.{0,1,2,3}.cx_usage
dev.cpu.0.cx_usage: 15.02% 84.97% last 1906us
dev.cpu.1.cx_usage: 11.53% 88.46% last 346us
dev.cpu.2.cx_usage: 10.97% 89.02% last 804us
dev.cpu.3.cx_usage: 10.61% 89.38% last 1240us
How to explain the difference from the output on T400?
What's the value of
Code:
 # sysctl hw.acpi.cpu.cx_lowest
if not C8?

My T430s was stuck on C1 at 100% until I set that, or at least less than C1.

Now I get C2 on AC and C3 on battery, nearer 100% on the lowest.

Power use at idle on battery consequently dropped from ~16.5 to ~13.5W
 
What's the value of
Code:
 # sysctl hw.acpi.cpu.cx_lowest
if not C8?

My T430s was stuck on C1 at 100% until I set that, or at least less than C1.

Now I get C2 on AC and C3 on battery, nearer 100% on the lowest.

Power use at idle on battery consequently dropped from ~16.5 to ~13.5W

On T400
Code:
% sysctl -a | grep -i cx | sort
dev.cpu.0.cx_lowest: C8
dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc/bma
dev.cpu.0.cx_supported: C1/1/1 C2/2/1 C3/3/57
dev.cpu.0.cx_usage_counters: 81246 0 0
dev.cpu.0.cx_usage: 100.00% 0.00% 0.00% last 1758us
dev.cpu.1.cx_lowest: C8
dev.cpu.1.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc/bma
dev.cpu.1.cx_supported: C1/1/1 C2/2/1 C3/3/57
dev.cpu.1.cx_usage_counters: 95039 0 0
dev.cpu.1.cx_usage: 100.00% 0.00% 0.00% last 79us
dev.hdaa.0.%desc: Conexant CX20561 (Hermosa) Audio Function Group
dev.hdacc.0.%desc: Conexant CX20561 (Hermosa) HDA CODEC
dev.pcm.0.%desc: Conexant CX20561 (Hermosa) (Analog 2.0+HP/2.0)
dev.pcm.1.%desc: Conexant CX20561 (Hermosa) (Internal Analog Mic)
hw.acpi.cpu.cx_lowest: C8
hw.acpi.thermal.tz0._ACx: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
hw.acpi.thermal.tz1._ACx: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1

On T430
Code:
% sysctl -a | grep -i cx | sort
dev.cpu.0.cx_lowest: C8
dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc
dev.cpu.0.cx_supported: C1/1/1 C2/2/104
dev.cpu.0.cx_usage_counters: 213507 874285
dev.cpu.0.cx_usage: 19.62% 80.37% last 182us
dev.cpu.1.cx_lowest: C8
dev.cpu.1.cx_method: C1/mwait/hwc C2/mwait/hwc
dev.cpu.1.cx_supported: C1/1/1 C2/2/104
dev.cpu.1.cx_usage_counters: 118925 670942
dev.cpu.1.cx_usage: 15.05% 84.94% last 943us
dev.cpu.2.cx_lowest: C8
dev.cpu.2.cx_method: C1/mwait/hwc C2/mwait/hwc
dev.cpu.2.cx_supported: C1/1/1 C2/2/104
dev.cpu.2.cx_usage_counters: 202596 1065609
dev.cpu.2.cx_usage: 15.97% 84.02% last 15us
dev.cpu.3.cx_lowest: C8
dev.cpu.3.cx_method: C1/mwait/hwc C2/mwait/hwc
dev.cpu.3.cx_supported: C1/1/1 C2/2/104
dev.cpu.3.cx_usage_counters: 110302 523490
dev.cpu.3.cx_usage: 17.40% 82.59% last 54us
hw.acpi.cpu.cx_lowest: C8
hw.acpi.thermal.tz0._ACx: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1
 
Sorry, no idea why the T400 isn't using its higher C-states, particularly while not at all busy.

I noticed this in its /boot/loader.conf:
hw.pci.do_power_nodrive="3"


a) it belongs in sysctl.conf not loader.conf
b) "nodriver" not "nodrive"
c) sure you wanted it?

Check sysctl -d hw.pci.do_power_nodriver

Otherwise I'm clueless.
 
Sorry, no idea why the T400 isn't using its higher C-states, particularly while not at all busy.

I noticed this in its /boot/loader.conf:
hw.pci.do_power_nodrive="3"


a) it belongs in sysctl.conf not loader.conf
b) "nodriver" not "nodrive"
c) sure you wanted it?

Check sysctl -d hw.pci.do_power_nodriver

Otherwise I'm clueless.

Don't remember from where I copied that line in /boot/loader.conf. And I don't know exactly what it does, only that it was recommended as one of the measures to save power. Anyway, if it is in wrong place and wrong in syntax, it has no effect.
One thing though, on T400 the battery was totally dead, so I got rid of it, while on T430 the battery can last 10 minutes or so. Does it make a difference in terms of CPU usage?
 
One thing though, on T400 the battery was totally dead, so I got rid of it, while on T430 the battery can last 10 minutes or so. Does it make a difference in terms of CPU usage?
As mentioned above, my T430s uses C1 and (>97%) C2 states on AC power, but on battery C1, C2 and (almost 100%) C3 states, at 99%+ idle, no X, for upto 2.5 hours.

I assume the AC/battery choice is in the AML code for the machine.

Are you running the latest BIOS on your T400? I had an X200 of similar vintage that a BIOS upgrade helped - I forget how.

I'd replace dead|dying batteries, at least to survive short power outages. OTOH if never running on battery then power use is no issue, unless overheating.

Good luck.
 
Back
Top