linux-on-mac / mbpfan

A simple daemon to control fan speed on all MacBook/MacBook Pros (probably all Apple computers) for Linux Kernel 3 and newer
https://ineed.coffee/projects/mbpfan
GNU General Public License v3.0
895 stars 139 forks source link

Fans start and stop abruptly #235

Open dbolger opened 3 years ago

dbolger commented 3 years ago

I don't know if the program is supposed to do this, but are the fans supposed to start and stop? When using Discord, my fan speeds spin up to what sounds like the max almost immediately, and then die off to silence seconds later. Is this supposed to happen? I'm following the default configuration and I don't understand if it should be doing this so abruptly.

eiiot commented 3 years ago

Same issue here.

gaul commented 3 years ago

You can diagnose what mbpfan is doing by running with -v -f and looking at the logs.

dbolger commented 2 years ago

After running the command, I'm seeing large fluctuations in temperature values. The fan didn't spin up during any of these readouts.

mbpfan 2.2.0 starting up
Writing a new .pid file with value 2184 at: /var/run/mbpfan.pid
Successfully written a new .pid file with value 2184 at: /var/run/mbpfan.pid
Using new sensor path for kernel >= 3.15.0 or some CentOS versions with kernel 3.10.0 
Found hwmon path at /sys/devices/platform/coretemp.0/hwmon/hwmon2/temp
Found 3 sensors
Found 1 fans
Sleeping for 2 seconds to get first temp delta
Old Temp: 73 New Temp: 64 Fan: Right Speed: 1300 Max MHz: 2555
Sleeping for 1 seconds
Old Temp: 64 New Temp: 67 Fan: Right Speed: 1323 Max MHz: 2601
Sleeping for 1 seconds
Old Temp: 67 New Temp: 65 Fan: Right Speed: 1323 Max MHz: 2601
Sleeping for 1 seconds
Old Temp: 65 New Temp: 65 Fan: Right Speed: 1323 Max MHz: 2946
Sleeping for 1 seconds
Old Temp: 65 New Temp: 65 Fan: Right Speed: 1323 Max MHz: 2602
Sleeping for 1 seconds
Old Temp: 65 New Temp: 73 Fan: Right Speed: 1944 Max MHz: 3106
Sleeping for 1 seconds
Old Temp: 73 New Temp: 70 Fan: Right Speed: 1944 Max MHz: 2645
Sleeping for 1 seconds
Old Temp: 70 New Temp: 66 Fan: Right Speed: 1944 Max MHz: 2600
Sleeping for 1 seconds
Old Temp: 66 New Temp: 65 Fan: Right Speed: 1944 Max MHz: 2632
Sleeping for 1 seconds
Old Temp: 65 New Temp: 73 Fan: Right Speed: 1944 Max MHz: 3100
Sleeping for 1 seconds
Old Temp: 73 New Temp: 76 Fan: Right Speed: 2565 Max MHz: 3106
Sleeping for 1 seconds
dbolger commented 2 years ago

I should add, I'm on a Macbook Pro 11,1. When the fans do abruptly spin up for doing a very light task (loading a webpage), the right speed shoots above the Max MHz. Is that expected?

gaul commented 2 years ago

The fan speed does not directly relate to the CPU frequency (could be a smaller or bigger number, but when the MHz increases the fan does spin faster). Maybe it would be less confusing to emit the min and max fan speeds on startup? Or a percentage?

dbolger commented 2 years ago

I think a percentage would be more informative. I guess I just don't understand why such little tasks cause such a load on the computer. Do the numbers look like they are correct?

I ran this shell script, which causes the fans to go at what I think is full blast.

while true
    echo "hello"
end

and this was the output:

...
Old Temp: 93 New Temp: 92 Fan: Right Speed: 6199 Max MHz: 3099
Sleeping for 1 seconds
Old Temp: 92 New Temp: 96 Fan: Right Speed: 6199 Max MHz: 3099
Sleeping for 1 seconds
Old Temp: 96 New Temp: 92 Fan: Right Speed: 6199 Max MHz: 3099
Sleeping for 1 seconds
Old Temp: 92 New Temp: 94 Fan: Right Speed: 6199 Max MHz: 3099
Sleeping for 1 seconds
Old Temp: 94 New Temp: 92 Fan: Right Speed: 6199 Max MHz: 2934
Sleeping for 1 seconds
Old Temp: 92 New Temp: 98 Fan: Right Speed: 6199 Max MHz: 3080
Sleeping for 1 seconds
Old Temp: 98 New Temp: 98 Fan: Right Speed: 6199 Max MHz: 3099
Sleeping for 1 seconds
Old Temp: 98 New Temp: 93 Fan: Right Speed: 6199 Max MHz: 3099
Sleeping for 1 seconds
...

My concern is that before moving to Linux on my MacBook Pro, the fans wouldn't spin up really at all. So I'm not sure why they should be now, as I'd think running KDE w/ Firefox and a while true loop causes it to need to cooled down this much. Could my sensors be throwing incorrect values?

Output from lsmod | grep -e applesmc -e coretemp:

coretemp               20480  0
applesmc               28672  0
dbolger commented 2 years ago

Output of sudo dmidecode --type 1 | grep "Product Name:" and grep 'model name' /proc/cpuinfo:

Product Name: MacBookPro11,1
model name  : Intel(R) Core(TM) i5-4278U CPU @ 2.60GHz
christopher-beckham commented 1 year ago

I'm a bit late here @dbolger, but I recently just installed Linux Mint on my 11,1 (mid-2014, 13" retina model) and also had the same issues. The fan spins up / down quite erratically because I'm reaching those threshold temperatures (63/66/86) even for supposedly trivial workloads (like watching a 720p YouTube video). I'm no expert on this, but I'm just assuming this erratic behaviour is due to the algorithm controlling the fan; perhaps the (proprietary) algorithm that is used in macOS is more sophisticated and likes to ramp up / ramp down the temperatures in a smoother manner.

Personally, I've raised the threshold temperatures for low/med/high but I know this comes with risk. From what I've read online, it appears to be normal for Macbook CPUs to operate at temps close to 90-100C at intensive workloads. I know there are safeguards in place on macOS to prevent any damage from happening, but I don't know to what extent this is the case for Linux. So even though I've raised the threshold temperatures, I'm not advising anyone else to do so unless they know what they're doing or are happy with messing with the lifespan of their laptop.