Solved laptop cpu fan & temp

ksiu

Member

Reaction score: 9
Messages: 67

Hi,
Thinkpad t440p user here. My t440p's CPU fan in auto mode does not turn on until 60 deg C. Even when it is on, the fan speed is low.
So, when watching a youtube video for half an hour, for example, the CPU temperature gets into the upper 50s. And at that temperature, the palm rest starts to get warm. After an hour of youtube and organizing my photos on Shotwell, the palm rest is uncomfortably warm. Anything higher than 50 deg C, the palm rest will start to warm. I really hate a warm palm rest.

So, when I work with my photo app or watch youtube, I manually override the fan...
Code:
dev.acpi_ibm.0.fan=0
dev.acpi_ibm.0.fan_level=1
This resulted in 2688 of fan speed. I leave the fan running. And CPU temp drop to icy 44 deg and stay there, while managing my photos. No more warm palms! After finish watching, I turn the fan back to auto mode.

So, does y'all's your laptop CPU fan also wait until the CPU get over 55 deg C before turning on the fan?

Manually turning on and off the fan is kind of tedious. Is there no way to adjust the auto mode setting in the fan?
 

Snurg

Daemon

Reaction score: 577
Messages: 1,349

Maybe check once a minute and turn on/off the fan when CPU temp crosses some thresholds?
What about a script looping in the background, checking temp etc, and sleeping inbetween?
 

Mjölnir

Daemon

Reaction score: 1,482
Messages: 2,114

ksiu , T450s user here. Please post the output of the commands uname -aU, sysrc kld_list, kldstat|fgrep acpi and sysrc {economy,performance}_cx_lowest.
FYI my sysrc powerd_flags: -a adp -n adp -i 75 -r 96 -m 500 -p 125 -N
Maybe I'd like to see your loader.conf(5) to check that you have enabled the usual energy-saving settings, e.g. for the GPU & hw.pci.do_power_nodriver="3". If it's longer than 20+/- lines, you can put it in a spoiler like this: [SPOILER=loader.conf]
...lines from loader.conf here ...
[/SPOILER] or post as attachment. OTT,
  • You should install sysutils/devcpu-data & fire it off from loader.conf(5) or rc.conf(5): sysrc microcode_update_enable="YES".
  • I regularly have to clean my desk from dust & dirt, espc. where I place the laptop. Else it sucks in the dirt into the venting nozzles, and cooling suffers.
  • Cooling suffers also when you place the laptop on your lap (sigh!). Always watch for good airflow.
  • Your laptop is several years old, maybe a thorough cleaning of the inside, espc. heat exchanger, venting channels & fan blades is to be scheduled. You can do that yourself if you don't have five thumbs on each hand, else invest ~20? $ to pay the friendly service staff. Never suck or blow (e.g. vacuum cleaner) a strong airflow on the fan! It will produce electrical current & can burn out.
  • After ~8 years, the thermal paste between CPU and it's heat exchanger starts to wear out & it's thermal conductivity decreases, thus cooling suffers. If your laptop is older than 8 years and you have thermal issues frequently, that paste has to be renewed. Costs ~12€$.
 
OP
K

ksiu

Member

Reaction score: 9
Messages: 67

I have already applied the power savings from Vermaden's article. Anyway, here's my system info...

Code:
$ uname -aU
FreeBSD t440p.localhost 12.2-RELEASE-p4 FreeBSD 12.2-RELEASE-p4 GENERIC  amd64
1202000

$ sysrc kld_list
kld_list: /boot/modules/i915kms.ko acpi_ibm

$ kldstat |fgrep acpi
7    1 0xffffffff828eb000     31c8 acpi_ibm.ko


 
OP
K

ksiu

Member

Reaction score: 9
Messages: 67

Code:
$ cat /boot/loader.conf
security.bsd.allow_destructive_dtrace=0
efi_max_resolution="960x540"
kern.vt.fb.default_mode="960x540"
hw.pci.do_power_nodriver=3
# AHCI POWER MANAGEMENT FOR EVERY USED CHANNEL (ahcich 0-7)
hint.ahcich.0.pm_level=5
hint.ahcich.1.pm_level=5
hint.ahcich.2.pm_level=5
hint.ahcich.3.pm_level=5
hint.ahcich.4.pm_level=5
hint.ahcich.5.pm_level=5
hint.ahcich.6.pm_level=5
hint.ahcich.7.pm_level=5

$ cat /etc/rc.conf
clear_tmp_enable="YES"
syslogd_flags="-ss"
sendmail_enable="NONE"
hostname="t440p.localhost"
keymap="jp.kbd"
ifconfig_em0="DHCP"
sshd_enable="YES"
ntpdate_enable="YES"
ntpd_enable="YES"
# Set dumpdev to "AUTO" to enable crash dumps, "NO" to disable
dumpdev="NO"
##########################
dbus_enable="YES"
kld_list="/boot/modules/i915kms.ko acpi_ibm"
# wlans_iwm0="wlan0"
# ifconfig_wlan0="WPA SYNCDHCP"
update_motd="NO"
#########################
powerd_enable=YES
powerd_flags="-n adaptive -a adaptive -b adaptive -m 800 -M 1600"
performance_cx_lowest=C1
economy_cx_lowest=Cmax
 
OP
K

ksiu

Member

Reaction score: 9
Messages: 67

* I have already removed and inspected the cpu fan/heatsink/heat tube. They were in very clean condition. And I also replaced the thermal paste with Grizzly Kryonaut. This made very little difference in cpu temp.
* I always use my laptop on a table.
* I will try the microcode next, Thanks!
* Someone recommended that I try a new SSD drive. Right now, I am using Kingston A400. I was told Kingston SSD runs hotter than other brands. I opened up the back cover and felt the SSD for heat. It was warm, but no where as hot as the cpu heat sink.
* Vermaden's power saving article was a good improvement. But the palm rest still get warm after moderate/heavy cpu load.

  • You should...
 
OP
K

ksiu

Member

Reaction score: 9
Messages: 67

Btw, I have been replying for this thread and browsing this forum, for about 30 minutes.

The cpu temp is now 50 deg C. The palm rest is slightly warm...but still comfortable.

But if I fire up Youtube now, for example, and watch a 760p video, then after about 10 minutes the palm rest will get warm. And the cpu temp will be about 55 deg C.


IMO, the issue is the fan comes on too late. It needs to come ON sooner, to keep the cpu temp below 50 deg C.
 

Mjölnir

Daemon

Reaction score: 1,482
Messages: 2,114

palm rest = where your hands are when you type? Well, when under load (e.g. watching a video) it gets warm. But it should not get uncomfortably hot for your hands. Modern GPU decode many video encodings in hardware, i.e. that poses much less load on the CPU. I can watch a video and the fan stays still, RPM=0. Let's see what we can achieve.
IMHO you can
  • enable sysrc performance_cx_lowest=Cmax, which will
    1. enable CPU C2 state (significant power saving => cooler CPU), e.g. one core busy (C0), other core lazy (C2)
    2. enable the so-called turbo mode (CPU freq. boost for a short time, as long temp. & cooling allow)
      This is espc. useful when a single thread needs CPU, and the 2nd core is lazy (thus cool). Then the boost frequency can be sustained longer, since only one core produces heat.
  • sysrc powerd_flags-=" -b adaptive -m 800 -M 1600" (note the leading space)
  • sysrc powerd_flags-="-b adaptive -m 800 -M 1600"
    Why restrict? Let it flow & "-b adaptive" is default anyway.
  • sysrc kld_list+=" coretemp" (note the leading space)
Then @runtime kldload coretemp service power_profile 0x01 (if on AC power) and service powerd restart
Please post the output of the command pciconf -lv | fgrep -B 3 display and since it's Intel GPU, you can add this to your /boot/loader.conf
Code:
compat.linuxkpi.enable_rc6="7"  # ENABLE POWER SAVING RENDER C-STATE 6
compat.linuxkpi.enable_dc="2"   # ENABLE POWER SAVING DISPLAY C-STATES
compat.linuxkpi.enable_fbc="1"  # ENABLE FRAME BUFFER COMPRESSION FOR POWER SAVINGS
compat.linuxkpi.i915_fastboot="1" # SKIP UNNECESSARY MODE SETS AT BOOT TIME
compat.linuxkpi.i915_nuclear_pageflip="1"
compat.linuxkpi.semaphores="1"  # USE SEMAPHORES FOR INTER RING SYNC
This should enable some power efficiency for the GPU. These settings apply after the next reboot. Until then, the other knobs above should already give an improvement.
I'm searching for myself on USB power management, so I can't give any hints for that. Should you stumble upon, chime in here @forum and drop a note.
 

Mjölnir

Daemon

Reaction score: 1,482
Messages: 2,114

I forgot: if you machine has an em(4) network adapter like mine you can
  • echo 'hw.em.smart_pwr_down="1" # (0) smart power down on newer em(4) adapters' >>/boot/loader.conf
  • sysrc create_args_em0+=" polling" see polling(7)
sysrc create_args_wlan0+=" powersave"
 

Mjölnir

Daemon

Reaction score: 1,482
Messages: 2,114

On infos found in blogs, private websites etc.
  • vermaden is a highly respected wizzard, but 1. he can make flaws 2. infos can be outdated.
  • Always check the FreeBSD wiki. The infos there are checked by at least one other person, and we try to keep it up-to-date.
 
OP
K

ksiu

Member

Reaction score: 9
Messages: 67

palm rest = where your hands are when you type?
  • sysrc powerd_flags-=" -b adaptive -m 800 -M 1600" (note the leading space)
    Why restrict? Let it flow & "-b adaptive" is default anyway.
By palm rest, I mean the area to the right/left of the touchpad, below the Ctrl/Win/Alt keys.
The hottest area near the keyboard is to the left of the Tab and CapsLock.
Left palm rest can get uncomfortably warm.
Right palm rest can get a tiny bit warm, but never get uncomfortable.

Looks like my powerd option is messed up after applying your changes. It become "-n -a".
Should I into rc.conf and delete "-n -a"?
Code:
root@t440p:/home/ksiu # service powerd restart
powerd not running?
Starting powerd.
powerd: bad option: -n -a
/etc/rc.d/powerd: WARNING: failed to start powerd
 
OP
K

ksiu

Member

Reaction score: 9
Messages: 67

Please post the output of the command pciconf -lv | fgrep -B 3 display
ok...I assumed I need to remove the "-n -a" in powerd option in rc.conf...and after successfully restarting powerd, here is output...

Code:
 $ pciconf -lv | fgrep -B 3 display
vgapci0@pci0:0:2:0:    class=0x030000 card=0x220e17aa chip=0x04168086 rev=0x06 hdr=0x00
    vendor     = 'Intel Corporation'
    device     = '4th Gen Core Processor Integrated Graphics Controller'
    class      = display
 

Mjölnir

Daemon

Reaction score: 1,482
Messages: 2,114

I'm sorry. That sysrc(5) is not fool proof. It removed all occurences of adaptive. Well, that's according to it's documentation, but it's not what I wanted...
I wanted to remove that "-b adaptive -m 800 -M 1600" and keep: sysrc powerd_flags="-n adaptive -a adaptive"
sysrc powerd_flags-="-b adaptive -m 800 -M 1600" (note: no leading space) would have done what I wanted :)
 

Mjölnir

Daemon

Reaction score: 1,482
Messages: 2,114

ping ksiu Issue solved? If yes, only the OP (you) can set the thread to solved: on the very 1st post (upper right corner), click "..." -> "edit thread" -> "prefix: solved"
 

vermaden

Son of Beastie

Reaction score: 1,570
Messages: 2,995

So, when I work with my photo app or watch youtube, I manually override the fan...
Code:
dev.acpi_ibm.0.fan=0
dev.acpi_ibm.0.fan_level=1
This resulted in 2688 of fan speed. I leave the fan running. And CPU temp drop to icy 44 deg and stay there, while managing my photos. No more warm palms! After finish watching, I turn the fan back to auto mode.
I was not satisfied with the 'default' behavior of fan on my ThinkPad W520/X220/T420s so I created a little script to use exact fan speed on desired temperatures.

It may help you to achieve what you want:



So, does y'all's your laptop CPU fan also wait until the CPU get over 55 deg C before turning on the fan?

That sometimes depends on BIOS settings - for example passive/silent option used in BIOS can force such behavior.
 
OP
K

ksiu

Member

Reaction score: 9
Messages: 67

[CMD]ping[/CMD] ksiu Issue solved? If yes, only the OP (you) can set the thread to solved: on the very 1st post (upper right corner), click "..." -> "edit thread" -> "prefix: solved"
Sorry, I had to grab some lunch. Just got back. I am still testing. Something is not working right. My startx doesn't work now. Won't go into X environment. I am stuck in console mode...

Ok...
I found out that something in this block of code is causing problem with startx. If I take out this block, then my startx works again.

/boot/loader.conf
Code:
compat.linuxkpi.enable_rc6="7"  # ENABLE POWER SAVING RENDER C-STATE 6
compat.linuxkpi.enable_dc="2"   # ENABLE POWER SAVING DISPLAY C-STATES
compat.linuxkpi.enable_fbc="1"  # ENABLE FRAME BUFFER COMPRESSION FOR POWER SAVINGS
compat.linuxkpi.i915_fastboot="1" # SKIP UNNECESSARY MODE SETS AT BOOT TIME
compat.linuxkpi.i915_nuclear_pageflip="1"
compat.linuxkpi.semaphores="1"  # USE SEMAPHORES FOR INTER RING SYNC
 

Mjölnir

Daemon

Reaction score: 1,482
Messages: 2,114

Hm. I'd suggest to comment out one-by-one from the last one upwards, reboot, if it's not that, re-enable and previous, etc... If that does not work, comment out the last two, if that is not enough, disable the last three, if not last four. Else all.
 
OP
K

ksiu

Member

Reaction score: 9
Messages: 67

I was not satisfied with the 'default' behavior of fan on my ThinkPad W520/X220/T420s so I created a little script to use exact fan speed on desired temperatures.

It may help you to achieve what you want:



Is it equivalent to use rc.d instead of crontab (as you suggested in the file)?

For example, if I do rc.d and put in infinite loop with sleep statement...


$ cat /usr/local/etc/rc.d/kksfan

#!/bin/sh

# PROVIDE: kksfan
. /etc/rc.subr
name="kksfan"

start_cmd="${name}_start"
stop_cmd=":"

kksfan_start()
{
while true; do
/usr/local/bin/acpi-thinkpad-fan.sh
sleep 5;
done
}

load_rc_config $name
run_rc_command "$1"


Thanks!
 

Mjölnir

Daemon

Reaction score: 1,482
Messages: 2,114

I see you set this to solved - great! I'm curious
  • if you succeeded by commenting out one of the offending compat.linuxkpi.* lines - if yes, which one?
  • or if you had to uncomment them all.
  • If the the other changes you made had a notable impact, i.e. the fan starts less often.
 
OP
K

ksiu

Member

Reaction score: 9
Messages: 67

Okay...as per suggested, by process of elimination, the startx problem is caused by the i915_fastboot.
The block of code below works...but if I uncomment the i915_fastboot line, then startx won't work.

Code:
compat.linuxkpi.enable_rc6="7"  # ENABLE POWER SAVING RENDER C-STATE 6
compat.linuxkpi.enable_dc="2"   # ENABLE POWER SAVING DISPLAY C-STATES
compat.linuxkpi.enable_fbc="1"  # ENABLE FRAME BUFFER COMPRESSION FOR POWER SAVINGS
#compat.linuxkpi.i915_fastboot="1" # SKIP UNNECESSARY MODE SETS AT BOOT TIME
compat.linuxkpi.i915_nuclear_pageflip="1"
compat.linuxkpi.semaphores="1"  # USE SEMAPHORES FOR INTER RING SYNC
hw.em.smart_pwr_down="1" # (0) smart power down on newer em(4) adapters


Hm. I'd suggest to comment out one-by-one from the last one upwards, reboot, if it's not that, re-enable and previous, etc... If that does not work, comment out the last two, if that is not enough, disable the last three, if not last four. Else all.
 

Mjölnir

Daemon

Reaction score: 1,482
Messages: 2,114

ksiu and can you notice a significant improvement concerning the temperature of the palm rest? Does the fan start less often or later? You can check the C-state thang: sysctl dev.cpu.{0,1,2,3}.cx_usage. FMLU enabling CPU C-states beyond C1 is the most promising from the changes I suggested. But maybe enabling better power saving for the GPU is close to that. I'm not an expert in these hardware topics, just doing what others tell me (through the wiki or here @forum).
 
OP
K

ksiu

Member

Reaction score: 9
Messages: 67

ksiu and can you notice a significant improvement concerning the temperature of the palm rest? Does the fan start less often or later? You can check the C-state thang: sysctl dev.cpu.{0,1,2,3}.cx_usage. FMLU enabling CPU C-states beyond C1 is the most promising from the changes I suggested. But maybe enabling better power saving for the GPU is close to that. I'm not an expert in these hardware topics, just doing what others tell me (through the wiki or here @forum).
Mjolnir,

your changes doesn't seem to have much effect on palm rest temperature. But they seem to help in reducing power usage.

The fan is still behaving like before...it waits until about 55 deg C to turn ON. The problem is that if the cpu temp is steady just below 55 deg C, then the fan never turns ON and 55 is hot enough to get the palm rest warm. For example, I had two apps running: a 1080p youtube video and a 1080p VLC video, and this gets the cpu working hard. Now the temp is getting above 60 deg C. Then, I see the fan comes ON at low speed, and it stays ON at low speed while the two apps are playing...and after a short while everything feel cool (both the bottom of the laptop and the palm rest are nice and cool). Now, the cpu temp is in the mid 50s, but the fan stays ON. So, the fan speed seems to be correlated with cpu temperature as well as cpu load.

Now at this point my Thinkpad is nice and cool with both apps running and fan on low speed. Next, I decided to turn off the VLC video app. So now only the youtube is running. The cpu temp drop a little, to about 54 deg C, and the fan turns OFF. Now, as the youtube video is playing (fan is OFF), the palm rest slowly starts to warm again.

So, I think I will have to implement Vermaden's acpi-thinkpad-fan.sh to get the fan to turn ON sooner.
Vermaden's script only take into account cpu temperature. I wonder if I should add some code to take into account cpu load also. There is this for cpu load:
$ sysctl vm.loadavg
vm.loadavg: { 0.39 0.45 0.43 }
 
OP
K

ksiu

Member

Reaction score: 9
Messages: 67

In my previous post, I posted my current cpu load. I find that usually high. My cpu is 4 logical cores.

I stopped playing the youtube video 30 minutes ago. Since then, I was only on this post typing my reply.
Does it really take an average load 0.4 just to edit text on this page? I mean, there's not much graphics here.

Top shows I have 2 firefox processes using 9% and 1%. And vlc is still running, eventhough I closed it 60 minutes ago.


$ top -b

last pid: 12902; load averages: 0.30, 0.33, 0.35 up 0+05:04:38 23:52:33
26 processes: 1 running, 25 sleeping
CPU: 4.2% user, 0.0% nice, 0.9% system, 0.3% interrupt, 94.6% idle
Mem: 743M Active, 1930M Inact, 37M Laundry, 491M Wired, 263M Buf, 477M Free
Swap: 3656M Total, 3656M Free

PID USERNAME THR PRI NICE SIZE RES STATE C TIME WCPU COMMAND
96856 ksiu 25 23 0 2582M 347M select 3 8:18 9.08% firefox
85143 ksiu 56 20 0 2777M 452M select 2 3:28 1.07% firefox
72203 ksiu 3 20 0 95M 71M select 3 1:16 0.98% Xorg
65026 ksiu 29 20 0 372M 300M umtxn 1 1:23 0.29% vlc
86082 ksiu 24 20 0 2436M 194M select 2 0:05 0.00% firefox
96400 ksiu 21 20 0 2389M 149M select 2 0:03 0.00% firefox




The cpu load average fluctuates alot. Now, it is load averages: 0.65, 0.44, 0.38
 

Mjölnir

Daemon

Reaction score: 1,482
Messages: 2,114

No. The cooling affects the temperature. That's the only input you need, so please stick to that... think about it. If the CPU load imposes more work (physically equal to heat), the temperature goes up, so you don't have to complicate the logic when it already gets the temperature as input parameter. KISS.

Big fat warning: these auto-fan thingies are proven to work, they have safety margins, hysteresis, and all bells & whistles. Don't try to out-smart them wizzards & gurus.

Besides that, watching two 1080p HiRes videos @ the same time is considered adolescent behaviour by the yea free BeaSD & you're already it's disciple. You may want to agree that's not average laptop workload.

On that load: you're running the powerd(8) with the setting from above? Then your CPU runs @500 MHz when you just type in a post@forum. Consequently, that would equal 0.4/3 = 0.13 when the CPU would run@1500 MHz. Also look @C-states: sysctl dev.cpu.{0,1,2,3}.cx_usage. It shows C0 (run) - C1 (powersave) - C2 ("clock off").
Code:
alias freq      sysctl dev.cpu.{{0,1,2,3}.cx_usage,0.freq}
alias temp      sysctl dev.{acpi_ibm.0.fan_speed,cpu.{0,1,2,3}.temperature} hw.acpi.thermal.tz0.temperature
freq; temp<ENTER>
!fre<TAB>
 

Minbari

Aspiring Daemon

Reaction score: 295
Messages: 547

I don't know what cpu you have but for eg. T430 supports Ivy Bridge microarchitecture (35W-55W). So on my Lenovo T430 I have an i7 3612QM (4c/8t -35W) which run very "cold". What I did for this to get happen? Simple. I've placed the fan in manual mode, just like you did and then with a simple script I've achieved my goal:

.config/scripts/fanspeedthinkpad

Bash:
#!/bin/sh

TEMP0=$( sysctl -n dev.cpu.0.temperature | cut  -c 1-2 )

if [ ${TEMP0} -lt 60 ]; then
    sysctl dev.acpi_ibm.0.fan_level=0 0> /dev/null
      exit 0
 elif
    [ ${TEMP0} -gt 60 -a ${TEMP0} -lt 70 ]; then
    sysctl dev.acpi_ibm.0.fan_level=1 0> /dev/null
      exit 0
 elif
    [ ${TEMP0} -gt 70 -a ${TEMP0} -lt 80 ]; then
    sysctl dev.acpi_ibm.0.fan_level=2 0> /dev/null
      exit 0
 elif
    [ ${TEMP0} -gt 80 -a ${TEMP0} -lt 90 ]; then
    sysctl dev.acpi_ibm.0.fan_level=3 0> /dev/null
      exit 0
 elif
    [ ${TEMP0} -gt 90 ]; then
    sysctl dev.acpi_ibm.0.fan_level=3 0> /dev/null
      exit 0
fi

The next step was to run a cron job:
Bash:
#minute    hour    mday    month    wday    who        command
*   *   *   *   *   root /home/anbu/.config/scripts/fanspeedthinkpad

Now the fan has ~ 2600 rpm in browsing mode, which sometimes means two web browsers are opened with multiple tabs and when compiling ports the fan gets 3600 rpm (75C) or heavy compiling (llvm, gcc) 3800 rpm (85-90C).
2021-03-10-210920_3575x1080_scrot.png

The only modeling I did to the notebook was to replace the original fan with a Delta but not for thermal reasons but for noise. Delta are more quieter than the standard one. Also is good to use a low tdp cpu.
 
Top