# Auto control CPU freq based on Temperature in order not to shut down ?



## Kubator (Mar 1, 2020)

Hello FreeBSD forum,
I am running FreeBSD 12.1 on old lenovo laptop T510, Intel Core i5 M 520, 8 GB RAM, 1 TB SSD - ZFS.

And facing an issue with CPU overheat and automatic shutdown during big load (e.g. ffmpeg processing video - CRITICAL temperature reached shutting down ....). What I noticed that system boosts frequency to max and keeps there no matter what. I know that `powerd` can utilize frequency control based on load, is it possible to control also based on temperature? Or do I have to automate myself measuring via `sysctl dev.cpu.0.temperature` and controlling via `sysctl dev.cpu.0.freq`? Or please could You navigate me to other better solution?

I noticed that Windows 10 has some dummy control that basically lowers CPU freq by half in this (high load - high temperature) situation and then thottle up again and again (like PWM modulation). I would expect some linear control instead.

Cooling system is clean and thermal grease replaced.

Thank You.


----------



## trev (Mar 1, 2020)

My solution for a 2011 Mac mini was to use `powerd` to disable the Intel i7 turbo mode altogether with "-M 2700" for 2.7GHz" which is its base frequency - turbo mode is 2701.


----------



## Minbari (Mar 2, 2020)

I don't have overheating problems on my Thinkpad T430 (CPU i7 3712QM-35 Watts) but since I'm using ports sometimes the temperatures are getting higher, like 85-90 C on cores and 95-100 C on threads. To lower temps a bit I've limited the cpu to the base freqvencies (2100 MHz) and I'm boosting fan speed with the help of acpi_ibm. More precisely I have a script which is controlling the fan speed.


----------



## George (Mar 2, 2020)

The fan is supposed to cool down the cpu. If you are lucky, you can google some scripts that control fan speed (fan control). 
A script that throttles down the cpu based on the cpu temperature, you'd have to write it on your on. `powerd` does not care about temperatures.


----------

