• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

C states not used

Crivens

Moderator
Staff member
Moderator

Thanks: 485
Messages: 1,406

#1
I noticed that some time ago my laptops did stop using C states, and looking it up with sysctrl shows that f.e. C2 is unused in 30 seconds idle time. Yes, powerd is running, est is loaded, Cmax is set in tuneables to C3. It happens on a core2duo as well as core1solo. I can supply more info when I am back on my machines.

Did I miss some migration action on 11.1?
 

Crivens

Moderator
Staff member
Moderator

Thanks: 485
Messages: 1,406

#2
Okay, here as promised the data:
Machine is running
Code:
FreeBSD Wanderer 11.1-RELEASE-p10 FreeBSD 11.1-RELEASE-p10 #26 r333924
This is loader.conf
Code:
kern.geom.label.gptid.enable="0"
zfs_load="YES"
acpi_video_load="YES"
kern.vty="vt"

#hw.pci.enable_io_modes="0"
hint.p4tcc.0.disabled=1
hint.apic.0.clock=0
hint.atrtc.0.clock=0

#acpi Override
hw.acpi.osname="Linux"
hw.usb.timings.extra_power_up_time="700"
vm.pmap.pti=0
Whats in /etc/sysctrl.conf
Code:
hw.acpi.video.lcd0.brightness=7
compat.linux.osrelease=2.6.18
kern.module_path=/boot/kernel;/boot/modules;/usr/local/modules

#hw.usb.no_suspend_wait=1
#hw.pci.do_power_suspend=0
#hw.pci.do_power_resume=0
hw.acpi.reset_video=1

vfs.usermount=1
And what is set in /etc/rc.conf
Code:
keymap="german.iso.acc.kbd"
ifconfig_re0="DHCP"
sshd_enable="YES"
moused_enable="YES"
powerd_enable="YES"

# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="AUTO"
zfs_enable="YES"

battmond_enable="YES"

inetd_enable="YES"
linux_enable="YES"

anacron_enable="YES"
background_dhclient="YES"
clear_tmp_enable="YES"
cron_enable="NO"
cupsd_enable="YES"
lpd_enable="YES"

firewall_enable="YES"
firewall_type="workstation"
# ssh and syncthing
firewall_myservices="22 22000/tcp 21027/udp"
firewall_allowservices="A B C"

fusefs_enable="YES"

powerd_flags="-a adaptive -b adaptive -n adaptive"

devfs_system_ruleset="system"

economy_cx_lowest="Cmax"
performance_cx_lowest="Cmax"

#wlan
wlans_iwn0="wlan0"
ifconfig_wlan0="WPA SYNCDHCP"

keymap=de.noacc.kbd

tmpmfs="YES"
tmpsize="1024m"

wpa_supplicant="YES"

# List of kernel modules to load
kld_list="fuse iwn4965fw if_iwn"
What I see in sysctrl is this: sysctrl -a |grep cx
Code:
hw.acpi.cpu.cx_lowest: C8
dev.cpu.1.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc/bma
dev.cpu.1.cx_usage_counters: 228378 0 0
dev.cpu.1.cx_usage: 100.00% 0.00% 0.00% last 284us
dev.cpu.1.cx_lowest: C8
dev.cpu.1.cx_supported: C1/1/1 C2/2/1 C3/3/162
dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc C3/mwait/hwc/bma
dev.cpu.0.cx_usage_counters: 666229 0 0
dev.cpu.0.cx_usage: 100.00% 0.00% 0.00% last 2us
dev.cpu.0.cx_lowest: C8
dev.cpu.0.cx_supported: C1/1/1 C2/2/1 C3/3/162
Anyone having an idea what's going on?
 

Crivens

Moderator
Staff member
Moderator

Thanks: 485
Messages: 1,406

#4
The problem is not the waking from C state but the not-using. This is from a laptop core2duo about 10 years of age. It can sit idle for minutes and not use any C state, only about close to 30 watts of power :(

The old T60 core1solo is the same...

Edit: that is close to 160% of the previous power intake.
 
Last edited:

Crivens

Moderator
Staff member
Moderator

Thanks: 485
Messages: 1,406

#5
I am bisecting my way trough the memstick images, booting them into live media and checking the sysctrl settings. With 10.4 it works, with 11.0 it does not. Investigation continues.
 

shepper

Aspiring Daemon

Thanks: 228
Messages: 678

#6
I was thinking in terms of newer code having to accomodate the loading/implemention/utilization of firmware. Perhaps it is not ready/disabled or needs more testing/debugging.
 

Crivens

Moderator
Staff member
Moderator

Thanks: 485
Messages: 1,406

#7
It is not about sleep states of the system (a.k.a. S3, S4, ...) but power saving in the CPU, and in older ones that is. The acpi code of 10.4 did the right thing, and somewhat after that there came a regression. Maybe not only I should check this again, who in the forum has the same old hardware and the same effect? Am I the only one (looking)?
 

Crivens

Moderator
Staff member
Moderator

Thanks: 485
Messages: 1,406

#8
The old code sadly does not build, so I need to dig deeper. Maybe until I find Jimmy Hoffa or the S3 which worked on 10.4 but not now. I call this a pretty heavy regression.
 

PMc

Member

Thanks: 22
Messages: 70

#9
Whats going on: for some reason it doesn't switch to C2 (or further). That might happen if the board does not know these states (obviousely not the case) or if hw.acpi.cpu.cx_lowest=C1 is set (obviousely not the case).

The C2/C3 states should work independent of powerd and without any laptop power saving modes. They exist on genuine desktop boards as well, and there it should be enough to put this into /etc/sysctl.conf:
hw.acpi.cpu.cx_lowest=C3

Sadly my vintage machine has now a workstation/server board that does not know any C states. It did work well on a pentium-2 (but that was retired with Rel 9 or 10).

That C8 in your output looks strange (but might work nevertheless). What does happen if You set it manually to hw.acpi.cpu.cx_lowest=C3 (or C1 or C2)?
 

Crivens

Moderator
Staff member
Moderator

Thanks: 485
Messages: 1,406

#10
I think the code tries to enumerate the states and gets something wrong. The list of C states comes from the acpi defs in ROM, so it does not need to match the found states. Now when the code only detects C1 and keeps that as maximum, you can overwrite that with anything - it will not matter but lead people into thinking all is well. So whoever uses a laptop, please check this. It only takes 10 seconds or so.
 

Maxnix

Well-Known Member

Thanks: 161
Messages: 283

#11
Seem the same behaviour with my Celeron 530.
Code:
$ uname -rm
11.1-RELEASE-p10 amd64
$ sysctl -a | fgrep cx
has_pipe_cxsr: no
hw.acpi.cpu.cx_lowest: C8
dev.cpu.0.cx_method: C1/mwait/hwc C2/mwait/hwc/bma
dev.cpu.0.cx_usage_counters: 1969022 0
dev.cpu.0.cx_usage: 100.00% 0.00% last 1578us
dev.cpu.0.cx_lowest: C8
dev.cpu.0.cx_supported: C1/1/1 C2/2/17
/etc/rc.conf
Code:
#--- General settings -------------------------------------------------
cron_flags="-m ''"
devfs_system_ruleset="system"
dumpdev="AUTO"
economy_cx_lowest="Cmax"
gptboot_enable="NO"
kern_securelevel_enable="YES"
kern_securelevel="1"
kld_list="dtraceall.ko i915kms.ko vboxdrv.ko"
openntpd_enable="YES"
openntpd_flags="-sv"
performance_cx_lowest="Cmax"
savecore_enable="NO"
sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"
syslogd_flags="-ss"
update_motd="NO"
virecover_enable="NO"
vnstat_enable="YES"
xdm_enable="YES"
zfs_enable="YES"

#--- Network settings -------------------------------------------------
cloned_interfaces="lo1"
icmp_log_redirect="YES"
ifconfig_lo1="inet 10.0.0.0/29"
ifconfig_ue0="SYNCDHCP group egress"
#ifconfig_wlan0="WPA SYNCDHCP group egress"
ip6addrctl_enable="NO"
log_in_vain="1"
pf_enable="YES"
wlans_ath0="wlan0"
/etc/sysctl.conf
Code:
#--- Hardware --------------------------
dev.cpu.0.freq=216

hw.snd.vpc_autoreset=0

#--- Kernel ----------------------------
kern.coredump=0
kern.ipc.shm_use_phys=1
kern.maxprocperuid=150
kern.randompid=376
kern.vt.enable_bell=0

#--- Network ---------------------------
net.inet.icmp.drop_redirect=1
net.inet.ip.check_interface=1
net.inet.ip.process_options=0
net.inet.ip.random_id=1
net.inet.ip.redirect=0
net.inet.tcp.blackhole=2
net.inet.tcp.delayed_ack=0
net.inet.tcp.drop_synfin=1
net.inet.tcp.icmp_may_rst=0
net.inet.tcp.rfc1323=0
net.inet.tcp.sack.enable=0
net.inet.udp.blackhole=1
net.inet6.icmp6.rediraccept=0
net.inet6.ip6.redirect=0

#net.inet.sctp.blackhole=2

#--- Security --------------------------
security.bsd.hardlink_check_gid=1
security.bsd.hardlink_check_uid=1
security.bsd.see_other_uids=0
security.bsd.see_other_gids=0
security.bsd.stack_guard_page=1
security.bsd.unprivileged_proc_debug=0
security.bsd.unprivileged_read_msgbuf=0
security.jail.allow_raw_sockets=0
security.jail.chflags_allowed=0
security.jail.set_hostname_allowed=0

#--- VFS -------------------------------
vfs.usermount=1
/boot/loader.conf
Code:
autoboot_delay="2"

hint.acpi_throttle.0.disabled="0"
hint.p4tcc.0.disabled="0"

hw.pci.do_power_nodriver="3"
hw.psm.tap_enabled=1

vfs.root.mountfrom="zfs:zroot/ROOT/default"
vfs.zfs.arc_max="700M"
vfs.zfs.arc_min="300M"
vfs.zfs.resilver_delay=0
vfs.zfs.resilver_min_time_ms=5000
vfs.zfs.scrub_delay=0
vfs.zfs.top_maxinflight=128

zfs_load="YES"
Setting hw.acpi.cpu.cx_lowest to C2 makes no difference...
 

Crivens

Moderator
Staff member
Moderator

Thanks: 485
Messages: 1,406

#12
Well, that makes two. Any more?
 

Maxnix

Well-Known Member

Thanks: 161
Messages: 283

#13
I don't know if this can be useful, but booting an old 10.2-RELEASE (i386 however, while actually using AMD64) 3 C states are detected, instead of 2, and they are all used.
 

Crivens

Moderator
Staff member
Moderator

Thanks: 485
Messages: 1,406

#14
Just checking -current after I saw commit r314211. Continuing with fingers crossed.
 

Crivens

Moderator
Staff member
Moderator

Thanks: 485
Messages: 1,406

#15
Now I have cx_max being C8. Otherwise no change. :(
 

Crivens

Moderator
Staff member
Moderator

Thanks: 485
Messages: 1,406

#17
That is loaded and working. Sad thing is the laptop now draws (about) two times the power it used to. Suspend is borked also (used to work with 10.4). So I guess I will roll back to 10.4 and stay there. Since I not only bought one of these little road warriors but a trunk full, I am a little disapointed.
 
Top