From owner-freebsd-mobile@FreeBSD.ORG Tue Jan 3 03:33:35 2012 Return-Path: Delivered-To: mobile@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id D0AB1106566B; Tue, 3 Jan 2012 03:33:35 +0000 (UTC) (envelope-from jhs@berklix.com) Received: from tower.berklix.org (tower.berklix.org [83.236.223.114]) by mx1.freebsd.org (Postfix) with ESMTP id F00CE8FC15; Tue, 3 Jan 2012 03:33:34 +0000 (UTC) Received: from mart.js.berklix.net (p5DCBCC03.dip0.t-ipconnect.de [93.203.204.3]) (authenticated bits=0) by tower.berklix.org (8.14.2/8.14.2) with ESMTP id q033XPo5084227; Tue, 3 Jan 2012 03:33:26 GMT (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (fire.js.berklix.net [192.168.91.41]) by mart.js.berklix.net (8.14.3/8.14.3) with ESMTP id q033XKZ4098310; Tue, 3 Jan 2012 04:33:20 +0100 (CET) (envelope-from jhs@berklix.com) Received: from fire.js.berklix.net (localhost [127.0.0.1]) by fire.js.berklix.net (8.14.4/8.14.4) with ESMTP id q033WRLE064421; Tue, 3 Jan 2012 04:32:34 +0100 (CET) (envelope-from jhs@fire.js.berklix.net) Message-Id: <201201030332.q033WRLE064421@fire.js.berklix.net> To: mobile@freebsd.org From: "Julian H. Stacey" Organization: http://www.berklix.com BSD Unix Linux Consultancy, Munich Germany User-agent: EXMH on FreeBSD http://www.berklix.com/free/ X-URL: http://www.berklix.com In-reply-to: Your message "Mon, 02 Jan 2012 16:52:00 +1100." <20120102153310.A66248@sola.nimnet.asn.au> Date: Tue, 03 Jan 2012 04:32:26 +0100 Sender: jhs@berklix.com X-Mailman-Approved-At: Tue, 03 Jan 2012 04:56:46 +0000 Cc: Ian Smith , Alexander Motin , Gary Jennejohn , "Clive Ashbolt \(Work\)" , "Julian H. Stacey" , Boris Kochergin , Tino Engel , brucec@freebsd.org, Hajimu UMEMOTO Subject: Re: powerd to use sysctl to import temps to drop freq to avoid heat crash X-BeenThere: freebsd-mobile@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Mobile computing with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 Jan 2012 03:33:35 -0000 Hi, Thanks to all of Ian, Hajimu, Tino ! Hajimu UMEMOTO wrote > Yes, it is implemented already in the kernel, and it should be done by > the ACPI passive cooling. I guess "ACPI passive cooling" means ACPI is supposed to turn down CPU frequency ? & maybe turn off anything else possible (I need to read http://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface & URLs beyond (PS I added one to FreeBSD page). > It seems to me that your ACPI BIOS has it, and when the temperature of > your CPU become over 90.0C, it will effect. 90 sounds terribly hot, so I compared with my Toshiba Satelite hw.acpi.thermal.tz0._PSV: 107.9C hw.acpi.thermal.tz0._HOT: -1 hw.acpi.thermal.tz0._CRT: 108.9C The plastic under my new HP notebook is too hot to comfortably hold. with top 75% idle hw.acpi.thermal.tz0.temperature: 68.0C kern.acct_chkfreq: 15 kern.timecounter.tc.i8254.frequency: 1193182 kern.timecounter.tc.ACPI-safe.frequency: 3579545 kern.timecounter.tc.HPET.frequency: 14318180 kern.timecounter.tc.TSC.frequency: 1596012059 net.inet.sctp.sack_freq: 2 machdep.acpi_timer_freq: 3579545 machdep.tsc_freq: 1596012059 machdep.i8254_freq: 1193182 dev.cpu.0.freq: 696 dev.cpu.0.freq_levels: 1592/100000 1393/87500 1194/75000 995/62500 796/35457 696/31024 597/26592 497/22160 398/17728 298/13296 199/8864 99/4432 dev.acpi_throttle.0.freq_settings: 10000/-1 8750/-1 7500/-1 6250/-1 5000/-1 3750/-1 2500/-1 1250/-1 dev.powernow.0.freq_settings: 1592/100000 796/35457 dev.powernow.1.freq_settings: 1592/100000 796/35457 > However, I'm not sure why your notebook keeps over heating & crashing. OK, Thanks Ian Smith wrote: > On Mon, 2 Jan 2012 04:13:38 +0100, Julian H. Stacey wrote: > > Hi mobile@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 TCP failed, rdist & remote xterms & NFS fail, local mousepad fails. I didnt bother to try for a crash dump. I guessed damage was about to occur. > temperature this occurs? Low 80s I recall. Not sure, I thought that was so high damage would occur, so I just turned off & put an external fan under. I've reverted to default values & started a remote xterm with while (1) sysctl -a | grep temp ; date ; echo ; sleep 10 ; end Before with sysctl -a | grep temp I just got hw.acpi.thermal.tz0.temperature: 68.0C dev.acpi_hp.0.hdd_temperature: 4 after kldload amdtemp I get a lot more temperatures: dev.acpi_hp.0.hdd_temperature: 4 dev.amdtemp.0.%desc: AMD K8 Thermal Sensors dev.amdtemp.0.%driver: amdtemp dev.amdtemp.0.%parent: hostb4 dev.amdtemp.0.sensor0.core0: 51.0C dev.amdtemp.0.sensor0.core1: 49.0C dev.amdtemp.0.sensor1.core0: 58.0C dev.amdtemp.0.sensor1.core1: 56.0C dev.cpu.0.temperature: 57.0C dev.cpu.1.temperature: 57.0C hw.acpi.thermal.tz0.temperature: 66.0C > > 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. Sorry I haven't got to grips which of these should be on & off so now turned on all of debug.bootverbose: 1 debug.cpufreq.verbose: 1 debug.hwpstate_verbose: 1 dev.acpi_hp.0.verbose: 0 # set to "1" in loader.conf but ignored. hw.acpi.verbose: 1 > If you run powerd -v, > what sort of freqs does it usually run at, when more or less idle? When 75 to 90% idle (from top) sysctl -a | grep freq | grep -v "cpufreq" kern.acct_chkfreq: 15 kern.timecounter.tc.i8254.frequency: 1193182 kern.timecounter.tc.ACPI-safe.frequency: 3579545 kern.timecounter.tc.HPET.frequency: 14318180 kern.timecounter.tc.TSC.frequency: 1595998039 net.inet.sctp.sack_freq: 2 machdep.acpi_timer_freq: 3579545 machdep.tsc_freq: 1595998039 machdep.i8254_freq: 1193182 dev.cpu.0.freq: 497 dev.cpu.0.freq_levels: 1592/100000 1393/87500 1194/75000 995/62500 796/35457 696/31024 597/26592 497/22160 398/17728 298/13296 199/8864 99/4432 dev.acpi_throttle.0.freq_settings: 10000/-1 8750/-1 7500/-1 6250/-1 5000/-1 3750/-1 2500/-1 1250/-1 dev.powernow.0.freq_settings: 1592/100000 796/35457 dev.powernow.1.freq_settings: 1592/100000 796/35457 On an idle machine, (with a little patch from Gary J. to allow for multiple cores: /src/bsd/fixes/FreeBSD/src/gen/usr.sbin/powerd.c.REL=8.2-RELEASE.diff running powerd -v # Using defaults powerd: using sysctl for AC line status powerd: using devd for AC line status load 64%, current freq 199 MHz (10), wanted freq 339 MHz changing clock speed from 199 MHz to 398 MHz powerd: error setting CPU frequency 398: Invalid argument load 27%, current freq 398 MHz ( 8), wanted freq 339 MHz load 7%, current freq 398 MHz ( 8), wanted freq 328 MHz load 4%, current freq 398 MHz ( 8), wanted freq 317 MHz load 8%, current freq 398 MHz ( 8), wanted freq 307 MHz load 12%, current freq 398 MHz ( 8), wanted freq 297 MHz changing clock speed from 398 MHz to 298 MHz powerd: error setting CPU frequency 298: Invalid argument load 25%, current freq 298 MHz ( 9), wanted freq 297 MHz load 7%, current freq 298 MHz ( 9), wanted freq 287 MHz load 14%, current freq 298 MHz ( 9), wanted freq 278 MHz load 15%, current freq 298 MHz ( 9), wanted freq 269 MHz load 7%, current freq 298 MHz ( 9), wanted freq 260 MHz load 6%, current freq 298 MHz ( 9), wanted freq 251 MHz load 0%, current freq 298 MHz ( 9), wanted freq 243 MHz load 4%, current freq 298 MHz ( 9), wanted freq 235 MHz load 10%, current freq 298 MHz ( 9), wanted freq 227 MHz load 0%, current freq 298 MHz ( 9), wanted freq 219 MHz load 17%, current freq 298 MHz ( 9), wanted freq 212 MHz load 0%, current freq 298 MHz ( 9), wanted freq 205 MHz load 3%, current freq 298 MHz ( 9), wanted freq 198 MHz changing clock speed from 298 MHz to 199 MHz powerd: error setting CPU frequency 199: Invalid argument load 42%, current freq 199 MHz (10), wanted freq 221 MHz changing clock speed from 199 MHz to 298 MHz powerd: error setting CPU frequency 298: Invalid argument load 33%, current freq 298 MHz ( 9), wanted freq 221 MHz load 4%, current freq 298 MHz ( 9), wanted freq 214 MHz load 10%, current freq 298 MHz ( 9), wanted freq 207 MHz load 4%, current freq 298 MHz ( 9), wanted freq 200 MHz load 4%, current freq 298 MHz ( 9), wanted freq 193 MHz changing clock speed from 298 MHz to 199 MHz powerd: error setting CPU frequency 199: Invalid argument load 57%, current freq 199 MHz (10), wanted freq 293 MHz changing clock speed from 199 MHz to 298 MHz powerd: error setting CPU frequency 298: Invalid argument load 27%, current freq 298 MHz ( 9), wanted freq 293 MHz load 3%, current freq 298 MHz ( 9), wanted freq 283 MHz load 11%, current freq 298 MHz ( 9), wanted freq 274 MHz load 9%, current freq 298 MHz ( 9), wanted freq 265 MHz load 13%, current freq 298 MHz ( 9), wanted freq 256 MHz load 7%, current freq 298 MHz ( 9), wanted freq 248 MHz load 10%, current freq 298 MHz ( 9), wanted freq 240 MHz load 0%, current freq 298 MHz ( 9), wanted freq 232 MHz load 4%, current freq 298 MHz ( 9), wanted freq 224 MHz load 0%, current freq 298 MHz ( 9), wanted freq 217 MHz load 10%, current freq 298 MHz ( 9), wanted freq 210 MHz load 10%, current freq 298 MHz ( 9), wanted freq 203 MHz load 12%, current freq 298 MHz ( 9), wanted freq 196 MHz changing clock speed from 298 MHz to 199 MHz powerd: error setting CPU frequency 199: Invalid argument load 60%, current freq 199 MHz (10), wanted freq 313 MHz changing clock speed from 199 MHz to 398 MHz > Are > you using default powerd settings? I was when it crashed too often to be useful. accepting values from /etc/defaults/rc.conf but it crashed too much, so my rc.conf is now set to give: /usr/sbin/powerd -a adaptive -b minimum -n minimum > 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? Wow what a nice command ! Design capacity: 57276 mWh Last full capacity: 55544 mWh Technology: secondary (rechargeable) Design voltage: 11100 mV Capacity (warn): 5554 mWh Capacity (low): 0 mWh Low/warn granularity: 555 mWh Warn/full granularity: 555 mWh Model number: 5160 Serial number: Li4402A Type: Li OEM info: Hewlett-Packard State: high Remaining capacity: 100% Remaining time: unknown Present rate: unknown Present voltage: 12375 mV Yes I could do that. I dont see anything that's going to give me instantaneous consumption readings above though, & battery state prediction is generaly not accurate. However, I can do better, I can connect a power meter between wall supply & transformer (battery will be irrelevant if full, not charging) & see how much power is going in. & a temperature probe underneath. (OK, heat emitted by screen I don't care about, (just any heat in chassis, from inefficiency converting for screen), I'll see if I can turn off screen with keys or BIOS) But I guess another way is to hack the ACPI to turn the fan on at lower threshold. ? Maybe I'll have to tweak what I got from acpidump -dt http://berklix.com/~jhs/hardware/hp/pavilion/dm3-1155ea/jhs-hp-pPavilion-dm3-1155ea.asl per: http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/acpi-debug.html > I see dev.powernow.0.freq_settings: 1592/100000 796/35457 ie just two > speeds, with dmesg showing: > acpi_throttle0: on cpu0 > acpi_throttle0: P_CNT from P_BLK 0x410 > powernow0: on cpu0 > powernow1: on cpu1 powernow & throttling all new to me, I must web search. sysctl -d dev.powernow.0.freq_settings dev.powernow.0.freq_settings: CPU frequency driver settings > 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)? No I haven't. but thanks for tip I found http://people.freebsd.org/~mav/power.pdf In Russian (or some kind of Cyrillic) I only have E & German & French. I'll page through & look at syntax :-) http://people.freebsd.org/~mav/power.prd file power.prd: CDF V2 Document, Little Endian, Os 0, Version: 1.0, Code page: -535 viewed with OpenOffice. whhatever it is, not useful for this. > 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? I didnt know what C1 was. Found it: http://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface sysctl -a | grep machdep.idle machdep.idle: amdc1e machdep.idle_available: spin, amdc1e, hlt, acpi, sysctl -d machdep.idle machdep.idle: currently selected idle function sysctl -d machdep.idle_available machdep.idle_available: list of available idle functions Where are you seeing the C1 ? Wkipedia does make C1E sound more desirable. I went throught the screen BIOS a while back & found no power / temp / frequency options, was a rather limited BIOS. > > 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'. Thanks, will do. > > 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. Yes, been puzzling me that, There is one little fan slot, doesnt seem to blow hot right now, when under case too hot to hold. Yes I cant see revs/min > 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? I dont know how to control the fan. I'd like to see your script please, or at least commands you'r running. kldload acpi_ibm ; kldstat kernel sound.ko snd_hda.ko acpi_hp.ko acpi_wmi.ko linux.ko linux_adobe.ko radeon.ko drm.ko acpi_ibm.ko > 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: sysctl hw.acpi.thermal.tz0._PSV hw.acpi.thermal.tz0._PSV: 90.0C sysctl hw.acpi.thermal.user_override hw.acpi.thermal.user_override: 0 sysctl hw.acpi.thermal.user_override sysctl hw.acpi.thermal.tz0._PSV=60.0C sysctl -a | grep acpi.thermal hw.acpi.thermal.min_runtime: 0 hw.acpi.thermal.polling_rate: 10 hw.acpi.thermal.user_override: 1 hw.acpi.thermal.tz0.temperature: 69.0C hw.acpi.thermal.tz0.active: -1 hw.acpi.thermal.tz0.passive_cooling: 1 hw.acpi.thermal.tz0.thermal_flags: 1 hw.acpi.thermal.tz0._PSV: 60.0C hw.acpi.thermal.tz0._HOT: 95.0C hw.acpi.thermal.tz0._CRT: 100.0C hw.acpi.thermal.tz0._ACx: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 hw.acpi.thermal.tz0._TC1: 2 hw.acpi.thermal.tz0._TC2: 3 hw.acpi.thermal.tz0._TSP: 40 I think that's forced the frequency down, Xterm to machine is sluggish & powerd -v reports: changing clock speed from 99 MHz to 1592 MHz load 177%, current freq 99 MHz (11), wanted freq 3184 MHz changing clock speed from 99 MHz to 1592 MHz load 179%, current freq 99 MHz (11), wanted freq 3184 MHz changing clock speed from 99 MHz to 1592 MHz load 151%, current freq 99 MHz (11), wanted freq 3184 MHz sysctl hw.acpi.thermal.tz0._HOT=62.0C I dont hear or feel fan faster. ... just crashed. > > 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? New notebook, used about 2 hours by mother in a clean office, then by me ditto, however yes, might be manufacturing error & lack of grease. Not opened it yet. > Just a few quick notes, I've no time for deep diving lately .. HTH. > cheers, Ian Thanks Ian, you gave me a Lot of ideas to investigate :-) Tino Engel wrote: > I have put my laptop on a poer-set-box, so the ventilators are lying free. > That also help sometimes. Yes, Thanks, I've put mine on extra rubber feet, & sometimes a fan blowing under the back when on load. I'll try local shops eg http://www.conrad.de/ce/de/FastSearch.html;jsessionid=30CC9116DFD7E7BDC51220C2755735E0.ASTPCCP11?search=laptop+unter+kuhl+luft&initial=true&categorycode= English equivalent for globale readers: http://http://www.conrad.com/websale7/?Ctx=%257bver%252f7%252fver%257d%257bst%252f417%252fst%257d%257bcmd%252f0%252fcmd%257d%257bm%252fwebsale%252fm%257d%257bs%252fconrad%252dint%252fs%257d%257bl%252fint%252fl%257d%257bp1%252f9c24b341a5c38cea506a342ea52db4cb%252fp1%257d%257bmd5%252f3b4f37d756fcc437913494526895d6cf%252fmd5%257d&dummychar=%3F&dp2=ff_search&search_input=Notebook+cooling+pad Or lash up something out of Meccano with custom placement of fan outputs. which would be OK for in office, but I want to solve the problem so I can travel with this notebook (/ "laptop burner ;-)" even if I need to run at lower frequency or force fan faster somehow. If I failed to cover something, please let me know, If nothing else I have more reading to do, then perhaps to resort to acpi@ archives & list. Thanks Ian, Hajimu, Tino ! Cheers, Julian -- Julian Stacey, BSD Unix Linux C Sys Eng Consultants Munich http://berklix.com Reply below not above, cumulative like a play script, & indent with "> ". Format: Plain text. Not HTML, multipart/alternative, base64, quoted-printable.