Open dinvlad opened 1 month ago
OK, looks like after changing min
and max
values from milli-degrees to degrees again, this time it's working - although the PWM values it sets in log messages don't seem to correspond to "desired PWM" 🤔
DEBUG Setting Fan PWM of 'mobo' to 85 ...
DEBUG Evaluating curve 'disk_0'. Sensor 'disk_0' temp '23°'. Desired PWM: 19
DEBUG Evaluating curve 'disk_4'. Sensor 'disk_4' temp '22°'. Desired PWM: 12
DEBUG Evaluating curve 'nvme_0'. Sensor 'nvme_0' temp '33°'. Desired PWM: 65
DEBUG Evaluating curve 'nvme_1'. Sensor 'nvme_1' temp '34°'. Desired PWM: 70
DEBUG Setting Fan PWM of 'cpu' to 59 ...
DEBUG Evaluating curve 'disk_0'. Sensor 'disk_0' temp '23°'. Desired PWM: 19
DEBUG Evaluating curve 'cpu'. Sensor 'cpu_package' temp '28°'. Desired PWM: 32
DEBUG Evaluating curve 'disk_4'. Sensor 'disk_4' temp '22°'. Desired PWM: 12
DEBUG Evaluating curve 'nvme_0'. Sensor 'nvme_0' temp '33°'. Desired PWM: 65
DEBUG Evaluating curve 'nvme_1'. Sensor 'nvme_1' temp '34°'. Desired PWM: 70
DEBUG Evaluating curve 'disk_0'. Sensor 'disk_0' temp '23°'. Desired PWM: 19
I did check the actual RPM values currently set, and they do seem to roughly correspond to where on the graph they would be, at that temperature.
So I think the remaining issue is initialization..
OK, and now I was able to skip initialization as well, by adding this to every fan:
pwmMap:
0: 0
255: 255
I think the docs could be a little more clear on all of this, but perhaps I just didn't read them carefully enough.
Actually, I spoke too soon. While the desired values reported in the log now with this pwmMap
seem to be the same as before, it sets PWM to 0 now (which is also reflected in all 0s reported by detect
):
DEBUG Evaluating curve 'disk_0'. Sensor 'disk_0' temp '23°'. Desired PWM: 19
DEBUG Evaluating curve 'nvme_0'. Sensor 'nvme_0' temp '31°'. Desired PWM: 56
DEBUG Evaluating curve 'nvme_1'. Sensor 'nvme_1' temp '33°'. Desired PWM: 67
DEBUG Setting Fan PWM of 'bay_0' to 0 ...
DEBUG Evaluating curve 'disk_4'. Sensor 'disk_4' temp '22°'. Desired PWM: 12
DEBUG Setting Fan PWM of 'mobo' to 0 ...
DEBUG Evaluating curve 'cpu'. Sensor 'cpu_package' temp '30°'. Desired PWM: 44
DEBUG Evaluating curve 'disk_0'. Sensor 'disk_0' temp '23°'. Desired PWM: 19
DEBUG Setting Fan PWM of 'bay_1' to 0 ...
DEBUG Evaluating curve 'nvme_0'. Sensor 'nvme_0' temp '31°'. Desired PWM: 55
DEBUG Evaluating curve 'nvme_1'. Sensor 'nvme_1' temp '33°'. Desired PWM: 66
DEBUG Setting Fan PWM of 'cpu' to 0 ...
DEBUG Evaluating curve 'disk_4'. Sensor 'disk_4' temp '22°'. Desired PWM: 12
DEBUG Evaluating curve 'cpu'. Sensor 'cpu_package' temp '30°'. Desired PWM: 40
DEBUG Evaluating curve 'disk_0'. Sensor 'disk_0' temp '23°'. Desired PWM: 19
DEBUG Evaluating curve 'nvme_0'. Sensor 'nvme_0' temp '31°'. Desired PWM: 57
DEBUG Evaluating curve 'nvme_1'. Sensor 'nvme_1' temp '33°'. Desired PWM: 66
DEBUG Evaluating curve 'disk_4'. Sensor 'disk_4' temp '22°'. Desired PWM: 12
I think the docs could be a little more clear on all of this, but perhaps I just didn't read them carefully enough.
Without a doubt, it's hard for me to explain all of this as I know too much about it (if you know what I mean).
There are definitely some misunderstandings here, and a lot to unpack, I will get back to you after work 🤞
Hi @dinvlad , thx for your interest! Looks like you have a real spicy system to test fan2go on at your hands :smile:
I'm having trouble setting up my fan curves. I have set minPwm, startPwm and maxPwm for each fan, but fans are still getting initialized on every run, and the curve values don't appear to follow what I wanted.
The fan curve
output does not change based on these parameters. The fan curve simply prints out a (rudimentary) graph of the PWM -> RPM measurement that fan2go took during the initialization of a fan. The Min/Start/Max are simply an indication of what the algorithm thinks these values should be based on the graph, unless you override them yourself in the config.
Fans should not be initialized again on each run.
They are not, at least not entirely. If you set overrides for the PWM "limits", the long initialization should be skipped entirely.
What is not skipped however, and is executed at each startup of fan2go is the calculation of the pwmMap
(again, except if you set it yourself in the config). The pwmMap
is used to make fan2go work with fans that do not operate in the expected 0..255 range, but f.ex. an 0..100 range, or even an extremely limited set like [0, 125, 255]
. The only way for fan2go to determine this by itself is through trial and error, by setting every possible value in 0..255 and checking i fit succeeded. Since this can change due to external factors like driver updates (for a fan controller), this check is currently done on each startup and should only take about a second. Its certainly not ideal, but its what we got right now.
By specifying this:
pwmMap:
0: 0
255: 255
you are essentially telling fan2go, that this particular fan definition can only use the PWM values 0
and 255
and nothing in between, which is probably not what you intended to do.
The "expected" pwmMap, would look like this (abbreviated for readability):
pwmMap:
0: 0
1: 1
2: 2
....
254: 254
255: 255
There is nothing wrong with specifying this in the config to skip the pwmMap initialization, except its a bit ugly.
Fans' PWM should be set according to linear curves (or an average of them) between min and max temp readings, and the corresponding minPwm and maxPwm values.
I agree, that is precisely what should happen and that is what is (hopefully) implemented. If you see anything different, feel free to investigate and report, or even fix it :+1:
I think the docs could be a little more clear on all of this, but perhaps I just didn't read them carefully enough.
Again about this: If you have suggestions on how to change the README to better reflect this, please open a PR and let me know!
Thanks for clarification @markusressel , that makes sense.
this check is currently done on each startup and should only take about a second
Sadly, in my case it takes much, much longer than a second - I just measured and it was almost 11 minutes (!)
3.02user 5.76system 10:46.38elapsed
I've now specified pwmMap
with all values between [0..255] at the top-level of fan2go.yaml
, and used Yaml anchors to refer to it in fans. This seems to have addressed the issue of slow startup for now. However, I wonder if we should add a simple boolean flag to skip this feature entirely - sadly because it's not intuitive for newcomers how to turn it off with pwmMap
, and that it can take this long, despite the intent being a quick succession.
The reason this is done is because fan2go tries to automatically detect the best mode of operation. If we disable this feature by default, we might as well remove the entire logic, document the config and call it a day. This feature was added by request from fan2go users, I have never needed it myself. Some big brand "gaming" fan controllers just seem to work in weird and unexpected ways because... reasons :smile:
I am not too keen on going that route yet, can we possibly figure out why it takes so long on your system? All fan2go does is this:
// check every pwm value
pwmMap := map[int]int{}
for i := fans.MaxPwmValue; i >= fans.MinPwmValue; i-- {
_ = fan.SetPwm(i)
time.Sleep(pwmSetGetDelay)
pwm, err := fan.GetPwm()
if err != nil {
ui.Warning("Error reading PWM value of fan %s: %v", fan.GetId(), err)
}
pwmMap[i] = pwm
}
f.pwmMap = pwmMap
SetPwm
and GetPwm
simply write/read an integer to/from a file.
If this is slow on your system, there has to be a reason for it. Maybe we can account for that reason somehow?
PS: Nice trick using the anchors, I didn't even know viper supports this :smile:
Thanks @markusressel - I did notice a delay even when running fan2go detect
. I think it's probably inherent in the fan controller I'm using - Aquacomputer Quadro, connected to the PC over USB.
Looking at their code and associated issue (which mentions fan2go btw), it sounds like the controller is "slow" enough that they had to introduce a ~200ms delay between reads and writes:
https://github.com/aleksamagicka/aquacomputer_d5next-hwmon/issues/82#issuecomment-1637173240
256 200ms 2 (read + write) * 4 fans is ~410s or ~7 mins, close to 11 mins I'm seeing (there's also likely a USB communication delay, to further account for the difference).
So given that, would it be reasonable to introduce a config param to opt-out of PWM mapping (i.e. effectively assuming 0, 1, ... 255 -> 0, 1, ... 255 map)? Obviously, it would come with a disclaimer that fan control could be less accurate then.
GitHubLinux hwmon driver for select Aquacomputer devices. Partly mainlined. - aleksamagicka/aquacomputer_d5next-hwmon
GitHubLinux hwmon driver for select Aquacomputer devices. Partly mainlined. - aleksamagicka/aquacomputer_d5next-hwmon
I am wondering if it makes sense to detect these devices and use specific defaults for them. Do the fans have a specific platform name that's unique to this controller? Maybe we can come up with a system (f.ex. additional config files) to specify overrides for specific platforms so other people can benefit from the findings that were made in issues like this one 🤔 I would have to look into it, but I would guess that there are even more specific IDs for the controller exposed somewhere, if the platform isn't specific enough.
These are just generic PWM fans (along with Noctua for the CPU), so I don't think we can detect the fans per se. But we can probably detect the controller (Quadro, in this case). I think potentially relying just on controller name (as reported by fan2go detect
, for example) would be sufficient in this case.
Describe the bug I'm having trouble setting up my fan curves. I have set
minPwm
,startPwm
andmaxPwm
for each fan, but fans are still getting initialized on every run, and the curve values don't appear to follow what I wanted.To Reproduce Steps to reproduce the behavior:
sudo /nix/store/84601dyyp25hqbq9a49kplnj76ljh1ji-fan2go-0.9.0/bin/fan2go -c fan2go.yaml -v
(see the config below)Setting Fan PWM of ...
, thenSaving pwm map to fan...
, and finallyMeasuring RPM of ...
Evaluating curve
withDesired PWM: 0
, despite temperature readings from sensors being noticeable above theirmin
values.Expected behavior
min
andmax
temp readings, and the correspondingminPwm
andmaxPwm
values.Screenshots My config:
Here's what the log said after the (very long) initialization (which happens on each run):
And here's what
fan2go detect
showed around that same time:And here are also the fan curves:
Desktop (please complete the following information):
uname -a
:Linux homelab 6.11.3 #1-NixOS SMP PREEMPT_DYNAMIC Thu Oct 10 10:04:18 UTC 2024 x86_64 GNU/Linux
sensors -v
:sensors version 3.6.0 with libsensors version 3.6.0
fan2go version
:dev
(NixOS "unstable" version tag0.9.0
)Additional context I've tried various settings, setting the
steps:
or sensor readings in degrees rather than milli-degrees. But nothing seems to matter - either I get fans set to 255, or 0.. And initialization takes a while each time.