Regarding standardized auto-fan control
Hi all:
This latest round of discussion convinces me: I think that a standard interface (at the chip driver level) for automatic fan control just isn't feasible, for these reasons:
1a) No two of these chips are alike, and
1b) some of them are vastly different.
(And from the department of broken records...)
2) A hardware driver should do and perform exactly as it is told. I.e. we should not be afraid to expose an interface for each auto-fan capable chip which is suited to just that chip.
Quoted 2 lines · Jean Delvare
* Interface reflects the physical reality. It doesn't mean we lose chip-independancy, but scripts will be twice as big.
What scripts? Automatic fan control is, um, *automatic* ;-)
OK seriously... if a standard interface is desirable for these controls then let's present one in userspace via libsensors. I personally think that will be difficult, if not impossible... but then again not any harder than forcing it in the drivers themselves.
One side-benefit of doing it in libsensors, is that we may be able to implement a "virtual" auto control in userspace for chips that have only manual PWM control.
In the meantime, we can upgrade the drivers to make use of these features instead of searching for an interface that might never exist.
Of course, it is still important to carefully design the interface for each driver. I just don't think we can usefully nail them to a single design.
Regards,
Signature · 2 lines
Mark M. Hoffman [email protected]
Quoted 6 lines
This latest round of discussion convinces me: I think that a standard interface (at the chip driver level) for automatic fan control just isn't feasible, for these reasons:
1a) No two of these chips are alike, and
Quoted 7 lines
1b) some of them are vastly different.
(And from the department of broken records...)
2) A hardware driver should do and perform exactly as it is told. I.e. we should not be afraid to expose an interface for each auto-fan capable chip which is suited to just that chip.
That same motto again... Don't mean a thing to me. What you really mean, it seems, is more like "drivers should directly map to hardware implementation" but then any interface is pointless. The only question to be asked and answer is where we put the limit between what can reasonably be (and thus has to be) done, and what cannot (reasonably) be. As a trivial example, we decided that hysteresis temperatures would be absolute, while some chips express them as a relative value. I consider it a good think and I don't think anyone argues. Still it's one step to have a common interface to chips doing things differently in hardware. There are several other examples, such has critical limit being shared in the LM83 (reminds me I have to put some order in the driver) or a single hysteresis register for two channels on the ADM1032/LM90. These steps were taken and everybody seems to agree it was the right thing to do.
Now, I admit that the auto-fan control problematic is way more complex, or we wouldn't still be discussing it. But we would better not give it all up just before reading the datasheets reveals that the chips work differently.
The only thing that looks really different to me is that some chips associate trip points with fans (it87), while others associate them with temperature channels (adm1031). The rest is about the same: each fan can be associated to a number of temperature channels, and trip points define a PWM vs temperature curve.
Which chip do we know of that doesn't fit into either model?
Again, I agree that trip point definition and count differ between models. But in no way this can be seen as an unsolvable problem. I estimate that these interfaces are way too complex and that most people absolutely don't care. What people want is a computer which stays quiet when idle, but doesn't overheat when used. They definitely don't want to define a complex curve with half a dozen trip points.
So I would go with these two models, simplified as needed.
Quoted 4 lines
OK seriously... if a standard interface is desirable for these controls then let's present one in userspace via libsensors. I personally think that will be difficult, if not impossible... but then again not any harder than forcing it in the drivers themselves.
Doesn't make any sense to me. If a common interface is possible, then it belongs to the drivers.
I agree that we could have done about everything in userspace (using the i2c-dev driver), much like xmbmon does. But we did a different choice. Not sure it was the correct one but this is not going to change now.
Quoted 3 lines
One side-benefit of doing it in libsensors, is that we may be able to implement a "virtual" auto control in userspace for chips that have only manual PWM control.
Don't make sense to me either. libsensors is a library. The behavior you describe is that of a daemon.
Quoted 6 lines
In the meantime, we can upgrade the drivers to make use of these features instead of searching for an interface that might never exist.
Of course, it is still important to carefully design the interface for each driver. I just don't think we can usefully nail them to a single design.
I agree that we need to do something quickly now, since users really want that functionality to be implemented soon. And if there is no common interface, better different interfaces than nothing. But...
You seem to have forgotten that the new libsensors will not have ANY chip-specific code, EVER.
While lm_sensors was on off-kernel project, nobody really noticed how the kernel code and the user-space were dependant, because most people would install them off the same lm_sensors package each time. Now that the drivers belong to the kernel and lm_sensors will become a user-space only package, things are different. We just cannot continue to ask the user to upgrade libsensors on any new chip driver out there. I cannot think of any other project doing this, for a reason. This is ugly.
This is the reason why we have been working on a unified, extensible sysfs interface to the driver in 2.6. And this is the reason why I would like us to do the same for the auto-fan control, even if this means not supporting each chip to 100% of its capabilities (which we have never done so far anyway).
If such an interface is not going to exist in the kernel, it's not going to exist in the new libsensors either. The new libsensors will be a simple, chip-independant way to select channels, set limits and compute formulas in a generic way. It should be quite straightforward to write for someone having some knowledge of config file parsing (which I am not, unfortunately) and, more importantly, it should be almost in its definitive state at the moment it will be working.
If the new libsensors is not going to do that, then having a new libsensors at all will be pointless IMHO.
As a summary, it will take one example of a chip that does fit in neither the (channel selection + trip points on temp channels) nor the (channel selection + trip points on fan channels) model to make me agree that a common interface is not viable.
Signature · 2 lines
Jean Delvare http://khali.linux-fr.org/
Hi Jean:
There are two decisions to be made:
1) To expose chip-specific interfaces for auto-fan for each driver, or not.
2) To expose a common subset of features for all chips, or not.
Although IHMO #2 is going to prove very difficult, I won't argue against it. I think that the logic belongs in libsensors, and you disagree - ok, we can continue to discuss that.
But this doesn't prevent us from still implementing #1, which people (myself included) want right now. Let's at least agree about that. More in-line...
Quoted 14 lines · Jean Delvare
Quoted 6 lines
This latest round of discussion convinces me: I think that a standard interface (at the chip driver level) for automatic fan control just isn't feasible, for these reasons:
1a) No two of these chips are alike, and
Quoted 7 lines
1b) some of them are vastly different.
(And from the department of broken records...)
2) A hardware driver should do and perform exactly as it is told. I.e. we should not be afraid to expose an interface for each auto-fan capable chip which is suited to just that chip.
Quoted 6 lines
That same motto again... Don't mean a thing to me. What you really mean, it seems, is more like "drivers should directly map to hardware implementation" but then any interface is pointless. The only question to be asked and answer is where we put the limit between what can reasonably be (and thus has to be) done, and what cannot (reasonably) be.
You assume that a common subset of all auto-fan functionality is sufficient for everyone. Why? There are features of LM93 and w83627thf which do not fit any model that I have seen suggested. Here's just one of many examples:
The LM93 can ramp up the pwm in response to what is essentially a pwm *input* signal (called #PROCHOT), overriding its own auto fan control algorithm. This feature has parameters of its own, of course.
In fact, the two pwm outputs can each be bound to any (or all) of four temperature zones, two #PROCHOT inputs, and two #VRDHOT inputs. It will use the largest result of any method to which it is bound.
Quoted 2 lines
As a trivial example, we decided that hysteresis temperatures would be absolute, while some chips express them as a relative value. I
Yes of course, with no loss of functionality.
Quoted 7 lines
consider it a good think and I don't think anyone argues. Still it's one step to have a common interface to chips doing things differently in hardware. There are several other examples, such has critical limit being shared in the LM83 (reminds me I have to put some order in the driver) or a single hysteresis register for two channels on the ADM1032/LM90. These steps were taken and everybody seems to agree it was the right thing to do.
Again, if I understand correctly, you didn't sacrifice any feature of the H/W in order to normalize that interface. The hardware was simply less capable than the API. And importantly, it was a *strict subset*.
In contrast, the auto-fan capable chips would have *reduced* functionality if *only* a common interface is allowed.
Quoted 4 lines
Now, I admit that the auto-fan control problematic is way more complex, or we wouldn't still be discussing it. But we would better not give it all up just before reading the datasheets reveals that the chips work differently.
OK, as I mentioned, I won't give up on the possibility of a useful common interface.
Quoted 7 lines
The only thing that looks really different to me is that some chips associate trip points with fans (it87), while others associate them with temperature channels (adm1031). The rest is about the same: each fan can be associated to a number of temperature channels, and trip points define a PWM vs temperature curve.
Which chip do we know of that doesn't fit into either model?
The LM93 example above among others, plus chips that have yet to be designed. If anything, I expect future chips to be even more complicated (maybe even including PID controllers) as thermal management of newer processors demands it.
Quoted 8 lines
Again, I agree that trip point definition and count differ between models. But in no way this can be seen as an unsolvable problem. I estimate that these interfaces are way too complex and that most people absolutely don't care. What people want is a computer which stays quiet when idle, but doesn't overheat when used. They definitely don't want to define a complex curve with half a dozen trip points.
So I would go with these two models, simplified as needed.
Some chips have more complexity than most want. That is no reason to deny the extra functionality to those who do want it.
You wouldn't think that terminal drivers could be so different either, yet there are nearly countless IOCTLs for those as well.
Quoted 7 lines
Quoted 4 lines
OK seriously... if a standard interface is desirable for these controls then let's present one in userspace via libsensors. I personally think that will be difficult, if not impossible... but then again not any harder than forcing it in the drivers themselves.
Doesn't make any sense to me. If a common interface is possible, then it belongs to the drivers.
I disagree, but I'll save that discussion for later.
Quoted 10 lines
I agree that we could have done about everything in userspace (using the i2c-dev driver), much like xmbmon does. But we did a different choice. Not sure it was the correct one but this is not going to change now.
Quoted 3 lines
One side-benefit of doing it in libsensors, is that we may be able to implement a "virtual" auto control in userspace for chips that have only manual PWM control.
Don't make sense to me either. libsensors is a library. The behavior you describe is that of a daemon.
You're right about that. Nevermind.
Quoted 7 lines
Quoted 6 lines
In the meantime, we can upgrade the drivers to make use of these features instead of searching for an interface that might never exist.
Of course, it is still important to carefully design the interface for each driver. I just don't think we can usefully nail them to a single design.
Quoted 6 lines
I agree that we need to do something quickly now, since users really want that functionality to be implemented soon. And if there is no common interface, better different interfaces than nothing. But...
You seem to have forgotten that the new libsensors will not have ANY chip-specific code, EVER.
(Assuming we expose a common interface from the drivers) we can make sure that chip-specific features will never have sysfs file name collisions with the common interface files. A simple filename prefix by convention would do it. The theoretical new libsensors can ignore anything else, just like the existing one does today.
Quoted 22 lines
While
lm_sensorswas on off-kernel project, nobody really noticed how the kernel code and the user-space were dependant, because most people would install them off the samelm_sensorspackage each time. Now that the drivers belong to the kernel andlm_sensorswill become a user-space only package, things are different. We just cannot continue to ask the user to upgrade libsensors on any new chip driver out there. I cannot think of any other project doing this, for a reason. This is ugly.This is the reason why we have been working on a unified, extensible sysfs interface to the driver in 2.6. And this is the reason why I would like us to do the same for the auto-fan control, even if this means not supporting each chip to 100% of its capabilities (which we have never done so far anyway).
If such an interface is not going to exist in the kernel, it's not going to exist in the new libsensors either. The new libsensors will be a simple, chip-independant way to select channels, set limits and compute formulas in a generic way. It should be quite straightforward to write for someone having some knowledge of config file parsing (which I am not, unfortunately) and, more importantly, it should be almost in its definitive state at the moment it will be working.
Quoted 7 lines
If the new libsensors is not going to do that, then having a new libsensors at all will be pointless IMHO.
As a summary, it will take one example of a chip that does fit in neither the (channel selection + trip points on temp channels) nor the (channel selection + trip points on fan channels) model to make me agree that a common interface is not viable.
You have your example, but I concede that a useful common interface might still be designed.
I do still claim that any such common interface is *insufficient*.
Regards,
Signature · 2 lines
Mark M. Hoffman [email protected]
Quoted 5 lines
There are two decisions to be made:
1) To expose chip-specific interfaces for auto-fan for each driver, or not.
Quoted 8 lines
2) To expose a common subset of features for all chips, or not.
Although IHMO #2 is going to prove very difficult, I won't argue against it. I think that the logic belongs in libsensors, and you disagree - ok, we can continue to discuss that.
But this doesn't prevent us from still implementing #1, which people (myself included) want right now. Let's at least agree about that. More in-line...
Correct.
Quoted 11 lines
You assume that a common subset of all auto-fan functionality is sufficient for everyone. Why? There are features of LM93 and w83627thf which do not fit any model that I have seen suggested. Here's just one of many examples:
The LM93 can ramp up the pwm in response to what is essentially a pwm *input* signal (called #PROCHOT), overriding its own auto fan control algorithm. This feature has parameters of its own, of course.
In fact, the two pwm outputs can each be bound to any (or all) of four temperature zones, two #PROCHOT inputs, and two #VRDHOT inputs. It will use the largest result of any method to which it is bound.
OK, that's interesting, and can convince me that a common interface will not be sufficent.
One thing I'm keeping in mind and more or less assuming is that most configuration stuff is hardware dependent and should have already be done by the BIOS. This is the reason why I don't want to expose the whole chip features to userspace. One example of that are chips which have some pins which can be used for different purposes (say voltage or temperature). The function is defined at the moment the chip is soldered on the motherboad. That's not a choice left to the user, although early drivers would make him/her think so. In this example, I believe it's better to provide a module parameter to workaround the BIOS brokeness than make just about every configuration bit if the chip changeable at run-time including things that are already decided and *must* match the hardware for proper operation.
In that sense, I would almost assume that the BIOS should have already defined which mode the auto-fan control should be in, and the user would really only have to tweak the temperature limits to fine-tune its system.
Sadly, I guess that many BIOSes out there won't do their work properly, which is why we need to do more that what should be needed. On the other hand, remember tham us developers may like to play with every parameter, especially on evaluation boards, but most users won't need to do so, and, more importantly, don't want to see the whole mess it is. This is why interfaces exist.
It's a pity that devices have become that complex with almost no common lines between various manufacturers. That might be bearable for closed-source (understand: redundant and unmaintained code) tools but it's a real pain for us open-source folks.
Quoted 5 lines
Yes of course, with no loss of functionality.
(...)
Again, if I understand correctly, you didn't sacrifice any feature of the H/W in order to normalize that interface. The hardware was simply less capable than the API. And importantly, it was a *strict subset*.
You got a point.
Quoted 2 lines
In contrast, the auto-fan capable chips would have *reduced* functionality if *only* a common interface is allowed.
True.
Quoted 2 lines
The LM93 example above among others, plus chips that have yet to be designed.
Not that we should not think of the future at all, but we definitely cannot expect to do everything right for all future chips, whatever we do (unless we don't design interfaces at all). Chip makers have weird ideas all the time, sometimes for purely commercial reasons, or just because they never wrote a driver.
Quoted 3 lines
If anything, I expect future chips to be even more complicated (maybe even including PID controllers) as thermal management of newer processors demands it.
And I would hope that such systems woulc be fully automatic. The CPU knows ahich temperature it can support, same for the other components. Keeping the noise to a minimum to fit within the hardware-specified range shouldn't require the user to set a dozen parameters he doesn't understand anything about (if nothing else, simply because the user will eventually not do the right thing and burn his/her hardware).
Quoted 5 lines
Some chips have more complexity than most want. That is no reason to deny the extra functionality to those who do want it.
You wouldn't think that terminal drivers could be so different either, yet there are nearly countless IOCTLs for those as well.
And in the end I believe that only 0.5% of the users really know that stuff and can make any benefit of it. So is it even worth implementing?
I am not designing (oh well, trying to...) this interface for my own use. I don't even have a supported chip myself yet, and if I had, I could just get the datasheet and program the chip myself for my own needs. The interface I aim at is for the common guy, and, more importantly, for applications to be able to expose this interface through a GUI to the user without having to know the internal of each chip.
Quoted 5 lines
(Assuming we expose a common interface from the drivers) we can make sure that chip-specific features will never have sysfs file name collisions with the common interface files. A simple filename prefix by convention would do it. The theoretical new libsensors can ignore anything else, just like the existing one does today.
s/can make sure/have to make really sure/
That's not an option, that's a requirement.
I agree that libsensors will simply ignore non-standard files so they can safely exist.
Quoted 4 lines
(...) I concede that a useful common interface
might still be designed.I do still claim that any such common interface is *insufficient*.
OK, so some chips (the ones you use ;)) would have two interfaces. It is going to be even more confusing in sysfs, but actually people are not supposed to read the values here directly so it's not really a problem. What may be OTOH is that the two interfaces will have to keep in sync, whatever parameters are set. That's a chip-specific problem anyway.
One compromise I am now thinking of is that the chip-specific interface for a given chip could be a complement to the common interface. You may not need to duplicate the whole thing if you only want to add additional features over the common interface.
I will rework my proposal for the common interface on Sunday (4th of July) and post it here. Hopefully we'll agree on it and I'll submit a patch for the documentation to Greg. This interface will be a recommendation, not a requirement. It will state that some names are reserved for the common interface, and that any chip driver using these names must use them in the way the documented, commom interface says. That's about it. Chips will be free to use other, non-reserved names for whatever extra feature they want. Sounds OK?
Thanks,
Jean Delvare
Quoted 20 lines · Mark M. Hoffman
Hi all:
This latest round of discussion convinces me: I think that a standard interface (at the chip driver level) for automatic fan control just isn't feasible, for these reasons:
1a) No two of these chips are alike, and
1b) some of them are vastly different.
(And from the department of broken records...)
2) A hardware driver should do and perform exactly as it is told. I.e. we should not be afraid to expose an interface for each auto-fan capable chip which is suited to just that chip.
Quoted 2 lines · Jean Delvare
* Interface reflects the physical reality. It doesn't mean we lose chip-independancy, but scripts will be twice as big.
Quoted 7 lines
What scripts? Automatic fan control is, um, *automatic* ;-)
OK seriously... if a standard interface is desirable for these controls then let's present one in userspace via libsensors. I personally think that will be difficult, if not impossible... but then again not any harder than forcing it in the drivers themselves.
Hi Mark,
A common design I have seen for something like this is to provide standard api for requesting some action, and then redispatching the request to a "driver" (not something in kernel space) that knows how to make the translation of the request into the specific implementation interface. Generally this "driver" is a DSO that is loaded on demand by the code using dlopen or one of its friends. Usually, there is a mechanism in the api to pass driver dependent request also. One example of this in perl would be the DBI libraries. DBI creates a high level api that users can use, and then ultimately redispatches the api calls to specific database drive (the DBD module). In the case of fans it would be a higher level fan control api, that redispatches to the appropriate user space fan control driver DSO. Conceivably which DSO's you would need to load could be completely controlled by what chip drivers are actually loaded.
This actually would be a model that could be more generally used so that you don't have this one monolithic chips.h and chips.c in libsensors. Each chip would have its on "userland/libsensors driver" that gets loaded on demand, allowing you to easily extend the supported chips in users space much like you can in kernel space. In spare cycles I am working on a perl prototype of this, more to kill boredom. When I am done I will gladly share it; the point being that it would in a high level language mark out the architecture I am talking about.
Quoted 7 lines
One side-benefit of doing it in libsensors, is that we may be able to implement a "virtual" auto control in userspace for chips that have only manual PWM control.
In the meantime, we can upgrade the drivers to make use of these features instead of searching for an interface that might never exist.
That sounds very reasonable IMHO.
Cheers...james