Little background: I have a lemp10 and I think it's sweet. It is awfully loud though and I don't mean the speakers. It has a preference to be silent as long as possible and then airing everything all at once. This isn't considered good in a relationship and I want to have a good relationship with this laptop.
I don't have a silver bullet, but I thought to post some of my musing and my collect some ideas. From what I can tell, fan control happens in a few steps. I'm going to throw around the term "PWM" and the important thing here is that I'm talking fan control, and 0 means off, 100 means window-shattering, and in between means in between. (And I always am referring to the PWM duty cycle here) These steps occur once per second:
-
Read the CPU temperature.
-
Translate the temperature read into a desired PWM.
-
Feed that PWM into the fan control module, which uses a algorithm with history to give a proper PWM to apply to the fans.
I think all of steps can be improved upon, however they all have merit as well. (For example the algorithm which is in place is good at reacting quickly when the CPU temperature had been rising, but is now falling. The algorithm is slow at reacting to quick temperature rises (though it is tune-able).)
Input temperatures and requested PWMs
The way this translation works is that there are a number of set points. One such set point states "At 70 degrees C the fan PWM shall be 40%". There is interpolation between the set points, though not before or after. So if you manage to sit at exactly 69 C, your fan will never turn on.
(Left is degrees Celsius, right is PWM duty cycle as a %; I have not learned how to label my axes yet.. x axis is seconds)
If you have used a lemp10, you probably already knew what this curve was going to look like. In red, we see the actual temperature as reported by the processor. In blue, the PWM that we're requesting given the table above. In yellow, the reaction by the PWM algorithm. The good: The actual PWM doesn't actually ever hit the requested of 100% PWM, saving us decibels. The bad is that most of the time the fan is on, it probably shouldn't be. At least not to the extent that it is. There is a 9-second delay here for both the turn-on and the turn-off time for the default algorithm. The default algorithm utilizes the previous 9 seconds worth of data, so it's not a shock. You can see the algorithm jumped straight to 40% PWM like was requested (albeit 9 seconds after it was requested).
Is this broken? Is there a problem to fix?
Maybe. It depends of course on what you're looking for. Your laptop is (probably) not going to melt. That PWM curve will hit 100% with the right input data. The default algorithm is actually fantastic at some data sets, perhaps just not the one above. For me personally, I would want to score an algorithm on a few factors:
-
Slow changes in increases of PWM. 0-40% in one second? Sorry could you repeat that? I missed what you said because the call didn't compensate fast enough.
-
Lower total area beneath the actual PWM curve.
-
Low hysteresis. (This is when the fan speed toggles back and fourth between two PWMs in response to temperature doing the same in response to fan speed doing the same in response to..)
So, what are the options? All data below is produced in Python uses models (i.e. copies) of the C code referenced. The input data is fixed, non-reactionary to show how the system would behave.
-
Change the fan setpoints. For example. If we add a setpoint at 60 for 20% PWM duty, our step up is both sooner, and less violent. The PWM does linger at the end though.
2) Reduce the lag in the algorithm (the road to hell...)
The intentions were goodOkay I admit it. THIS is what the fan sounds like to me. Yes we react sooner but we also exaggerate our accumulated response. Here the data buffer was decreased from 10 seconds to 5 seconds.
3) Use a modified window average algorithm instead
Modified window average where new values are weightedNone of the graphs above show the actual temperature curve in response to the algorithm. In reality, the curve of the temperature will react, so I am really just analyzing how the algorithms react in response to the input. My gut-feel is that the red curve would react downwards to the last graph the most promptly, resulting in a lower overall green graph.
For another option, as far as I can tell, the 1-second interval for reading the temperature data and modifying the output PWM is arbitrary. There is code runs in a tight loop in a microcontroller. Its loop is responsible for reading the AC power state, battery state, lid position, and keyboard state. These activities occur as fast as the microcontroller can spin. Once per second, it additionally queries the temperature from the processor and possibly sets the fan PWM. However looking at the raw temperature data, it's highly variable. I captured a fans-not-on-yet sequence of 60C, 62C, 91C, 75C, 65C. I haven't been able to rationalize this yet.
------
My next steps: I want to come up with some repeatable use cases. I don't have the ability to do debugging here, but what I can do is apply different algorithms and parameters, and measure the processor temperature and fan PWM (which should correlate to the PWM reasonably-well). I would love suggestions for repeatable use cases, or different algorithms to attempt. The modeling code is rudimentary but I'm happy to share with anyone who is interested. I think some people might be interested in the battery implications of fan curves. SO far I've been super happy with my lemp10's battery. I don't know what fan is in the system. If anyone happens to know what the fan is, please reply below and I'll check it out.
Thanks
A week ago i posted about loud fan noise. Here is how i was finally able to address it.
The cause of the noise
There are three factors that are cooperating to create a loud fan:
-
The fans are just loud at high RPM (they do cool well but whine like a tiny jet engine at 5000 rpm)
-
Intel turbo (frequency boost) can quickly double the wattage used when the system starts to load
-
The fan curve
We can only fix 3), by changing the firmware and flashing.
The problem with the built-in fan curves
Inexplicably, the built-in curves have a 5 second delay for gazelle. This means, if your chip goes turbo, it will take 5 seconds before the fan will react. By that time, the temperature will have already spiked to 80-90 C. https://github.com/system76/ec/blob/2a8befc195cd821232d2934593d29337e4eddb3e/src/board/system76/gaze17-3060/board.mk
There is also a 20 second cooldown, which means the fan continues to spin for 20 seconds, even when the chip has already cooled down.
Helpful tools:
-
psensor a graphical hardware temperature monitor for Linux.
-
i7z a small open source utility that reports Intel Core i7, i5, i3 CPU information.
-
hardinfo a system profiler and benchmark graphical tool for Linux systems
How to flash firmware:
This article explains how to do it.
https://devimalplanet.com/guide-how-to-adjust-the-fan-curve-on-system76-laptops
But i recommend adding points so the fan starts spinning at 10% immediately when the temp rises above idle. So heatup=0. And cooldown maybe 5.
Mine doesn't go to 100% until the temp is 5% away from the throttling temp of the processor (Look up your particular processor to find it)
This keeps the fan below 50% in most circumstances because it can start spinning immediately, rather than twiddling its thumbs while the cpu has time to get piping hot.
Note: i may be mischaracterizing the heatup/cooldown, because it may be a rampup/rampdown rather than instant rpm. Nevertheless i get a much quieter fan if i start it spinning at a lower temp.
I just got a thelio and the CPU fan is rather loud even on idle. I poked around in the BIOS and found that I could tweak the fan to be very quiet at lower temps (<50c). However as soon as the system boots these settings appear ignored. I understand the thelio io chip is supposed to control these things. Is there any way to tweak it.
Ever wanted to cool down your laptop quickly?
ever wanted to quickly change your fan speed?
Yes, this is not so easy with System76 laptops... but this post has a nice quick tip for you all.
While looking into a custom fan curve for my Lemur Pro, I was talking with u/Hyperair who was very kind to walk me through the process of flashing a custom firmware build to my laptop.
During the process he told me a super amazing keyboard shortcut to turn the fans up full for however long you want, and quickly turn them back to normal.
Fn+ 1
Try it and see!
An easy way to boost performance temporarily when doing something heavy, or to give your legs or wrists a break from the heat.
Just press "Fn + 1" to quickly toggle between default and 100% fans.
You can thank me by clicking the like button
v ( ^ _ < )