I'm using a laptop with bad cooling system, so my CPU sometimes hits very high temperature, and linux kernel is able to throttle cpu clock to cool it as I can see in dmesg:
[22612.245243] CPU3: Core temperature above threshold, cpu clock throttled (total events = 617268)
...
[22612.257307] CPU3: Core temperature/speed normal
etc
Lately, I installed FreeBSD to play with it and I noticed that it uses CPU at full speed all the time, even when I set powerd
to -a hiadaptive -b adaptive -i 85 -r 60 -p 100
, so after some usage CPU temp goes above normal and FreeBSD just restarts instead of throttling.
I also tried to use C-states but it doesn't helped.
How can I configure it to get linux behavior?
Best Answer
I had a similar problem in that my firewall (an old laptop) would shut down due to CPU overheat. I used the following steps to solve the problem, valid for the pfSense firewall:
1) Download FreeBSD cpu-speed.sh file from GitHub by dreamcat4
2) Create file cpu-speed.sh, and paste contents from source linked in previous step, through pfSense management interface, using Diagnostics >> Edit File
3) Enable execution of file cpu-speed.sh in fSense management interface, using Diagnostics >> Command Prompt and the command
$ chmod +x /[path_to_file]/cpu-speed.sh
4) Check available CPU frequencies by running
$ sysctl dev.cpu.0.freq_levels
in Command Prompt4) Run file cpu-speed.sh [valid_CPU_frq] using command
$ cd /[path_to_file] && ./cpu-speed.sh [valid_CPU_frq]
5) Check current (new) CPU frequency using command
$ sysctl dev.cpu.0.freq
6) Done.
I chose the min acceptable CPU core frequency for my CPU, and was able to permanently reduce the CPU core temp of my CPU from +90 C to < 60 C.
EDIT: To avoid dead links in the future, please find the code by dreamcat4 (as linked above) for file cpu-speed.sh below: