powerd to use sysctl to import temps to drop freq to avoid heat crash

Ian Smith smithi at nimnet.asn.au
Mon Jan 2 06:27:33 UTC 2012


On Mon, 2 Jan 2012 04:13:38 +0100, Julian H. Stacey wrote:
 > Hi mobile at freebsd.org, CC a few others.

Hi Julian.  Trimmed some, added ume@, feel free ..

 > I propose to hack src/usr.sbin/powerd/powerd.c
 > 	To import temperatures via sysctl, & if too high, to forcibly
 > 	reduce CPU frequency, even if CPU load is high,
 > because my new HP Pavillion notebook keeps over heating & crashing.

As ume@ points out, passive cooling _should_ be handling this, and in 
any case - even if you get a forced shutdown at CRT temp. - it shouldn't 
be 'crashing'.  Please elaborate on 'crashing'?  and at what sort of 
temperature this occurs?

 > dmesg & sysctl etc diagnostics at
 > 	http://berklix.com/~jhs/hardware/hp/pavilion/dm3-1155ea/
 > CPU: AMD Athlon(tm) Neo X2 Dual Core Processor L335 (1595.96-MHz K8-class CPU)
 >   Origin = "AuthenticAMD"  Id = 0x60fb2  Family = f  Model = 6b  Stepping = 2

Almost too much info :) esp. with sysctl -a including the verbose dmesg, 
but I noticed a couple of things on a quick skim.  If you run powerd -v, 
what sort of freqs does it usually run at, when more or less idle?  Are 
you using default powerd settings?  When running on battery can you 
monitor power use with acpiconf -i0 to see the actual effect on power 
usage of running at various lower freqs?

 I see dev.powernow.0.freq_settings: 1592/100000 796/35457 ie just two 
speeds, with dmesg showing:
 acpi_throttle0: <ACPI CPU Throttling> on cpu0
 acpi_throttle0: P_CNT from P_BLK 0x410
 powernow0: <PowerNow! K8> on cpu0
 powernow1: <PowerNow! K8> on cpu1

If you disabled acpi_throttle0 in loader, you won't get all those N/8 
rates from throttling.  I'm not sure, esp on AMD hardware, whether those 
rates actually provide any cooling benefit or not.  I guess you've read 
mav@'s power tuning guide for hints on reducing power (thus, heat)?

I also notice only C1 states, but using machdep.idle: amdc1e so I wonder 
if you're getting benefit from that?  Are there BIOS settings re that?

 > Is this re-inventing the wheel ?  
 > Anyone else out there working on or know of similar code ?

A few people have been down this road, you'd need to search the acpi@ 
archives from a few years ago.  Nate Lawson was then firmly opposed to 
the idea, but you'll find some code there, in various older PRs too, 
though it seems none of those are still 'open'.

 > mgdiff 8.2-RELEASE/src/usr.sbin/powerd/powerd.c \
 > 	/pub/FreeBSD/branches/-current/src/usr.sbin/powerd/powerd.c
 > does not show a lot of difference.
 >
 > >From 
 > http://www.freebsd.org/cgi/cvsweb.cgi/src/usr.sbin/powerd/powerd.c
 >    I added a few people to CC particularly mav@ has an interesting comment
 > 	Wed Jun 16 15:09:45 2010 UTC (
 > 	Freq sysctls are quite heavy due to set of malloc()/free()
 > 	calls. Avoid reading current frequency on every period.
 > 	Instead do it only after changing and periodically from
 > 	time to time if somebody else change it.
 > 
 > 	Also dynamically decrease sampling frequency up to 4 times
 > 	on inactivity,
 > 
 >    Gary J: there's a comment at Fri Jan 9 22:10:07 2009  re. more then 2 CPUs
 > 
 >    I added Clive who may have some URL to CPU temps.
 > 
 > To
 > 	 /boot/loader.conf  
 > I just added
 > 	 acpi_hp_load="YES" 
 > (after reboot) does not produce /dev/hpcmi

I don't see any mention of active cooling (ie, fan/s) in your sysctls, 
including acpi_hp.  Here I'm running a custom script to control CPU fan 
via acpi_ibm (the auto fan didn't cut in till over 65C, then pumped it 
down to ~45C), but it seems you may not have access to fan control?

You could try setting hw.acpi.thermal.user_override=1 and then set 
hw.acpi.thermal.tz0._PSV to something lower than 90C, perhaps much lower 
to see if it helps, especially if 'crashing' occurs closer to 90C than 
not, however:

 > Running 80% idle (just a fsck_ufs) I see:
 > 	hw.acpi.thermal.tz0.temperature: 67.0C
 > 	dev.acpi_hp.0.hdd_temperature: 4

67C isn't really hot on a dual core laptop with 100W rating at 1592MHz.
Still, if you had it drop back immediately on idle to 796MHz, you'd be 
saving about 60W, which may help considerable.

I expect you've done the usual check/clean airways, thermal grease etc?

Just a few quick notes, I've no time for deep diving lately .. HTH.

cheers, Ian


More information about the freebsd-mobile mailing list