sensord and missing alarms
Hello,
Some sensor chipsets assert an alarm always while a condition is true (lm78) while others only assert alarm when that condition is crossed (winbond). I want to add a separate software "latch" for transient alarms that can only be cleared by software, so that it is impossible for sensord to miss an alarm.
Has this been done before, are there any arguments for or against it?
Signature · 1 line
Ryan Underwood, <nemesis at icequake.net>
Hi Ryan,
Quoted 5 lines · Ryan Underwood
Some sensor chipsets assert an alarm always while a condition is true (lm78) while others only assert alarm when that condition is crossed (winbond). I want to add a separate software "latch" for transient alarms that can only be cleared by software, so that it is impossible for sensord to miss an alarm.
Actually, most chips, including the LM78, assert the alarm flag as long as the condition is true *and* the flag wasn't read, so the condition might no longer be true when you read the flag.
As far as I know, most Winbond chips behave the exact same way. We used to pick the wrong registers for some of them until recently, which may cause the behavior you describe above, but this should be fixed now. As far as I know, only the old W83781D doesn't support this.
Quoted 1 line
Has this been done before, are there any arguments for or against it?
No, this wasn't done. The rule so far is that drivers should report the alarm bits exactly as read from the hardware. I can't really tell what I think about the idea until you tell us exactly which chip you are working with, which exact problem you encountered, and how (where) you intend to fix it (driver, libsensors, application...)
My first impression is that, if you are really interested in the past states of the sensors, then you better continuously log all the values (some applications do that, drawing nice graphs.) A single alarm bit isn't going to tell you much.
Signature · 1 line
Jean Delvare
Quoted 4 lines · Jean Delvare
Actually, most chips, including the LM78, assert the alarm flag as long as the condition is true *and* the flag wasn't read, so the condition might no longer be true when you read the flag.
Right, that's the problem behavior. I need a monitoring application to be able to pick up any alarm event that happened, even one that may no longer be true, so that it can make its own decision whether to act on it or not. Since multiple apps independently can read the sensors, then somebody running gkrellm at the desktop will cause the alarm to be cleared and then the monitor program will miss the alarm and never act on it, even if the event that caused the alarm is still a problem.
Quoted 5 lines
No, this wasn't done. The rule so far is that drivers should report the alarm bits exactly as read from the hardware. I can't really tell what I think about the idea until you tell us exactly which chip you are working with, which exact problem you encountered, and how (where) you intend to fix it (driver, libsensors, application...)
W83871D and LM78.
Quoted 4 lines
My first impression is that, if you are really interested in the past states of the sensors, then you better continuously log all the values (some applications do that, drawing nice graphs.) A single alarm bit isn't going to tell you much.
We aren't that interested in past states of the sensors as we are in the alarms, but the possibility of missing alarms in the monitor due to some other app polling the sensors just won't work.
Does that make any sense?
I guess something besides an alarm latch that would work, is some way through the libsensors API to quickly tell if any voltage, temperature, or fan sensor has a current out of range condition (even if the alarm is not asserted).
Signature · 1 line
Ryan Underwood, <nemesis at icequake.net>
Hi Ryan,
Quoted 5 lines · Ryan Underwood
Quoted 3 lines · Jean Delvare
Actually, most chips, including the LM78, assert the alarm flag as long as the condition is true *and* the flag wasn't read, so the condition might no longer be true when you read the flag.
Quoted 7 lines
Right, that's the problem behavior. I need a monitoring application to be able to pick up any alarm event that happened, even one that may no longer be true, so that it can make its own decision whether to act on it or not. Since multiple apps independently can read the sensors, then somebody running gkrellm at the desktop will cause the alarm to be cleared and then the monitor program will miss the alarm and never act on it, even if the event that caused the alarm is still a problem.
Correct.
Quoted 13 lines
Quoted 5 lines
No, this wasn't done. The rule so far is that drivers should report the alarm bits exactly as read from the hardware. I can't really tell what I think about the idea until you tell us exactly which chip you are working with, which exact problem you encountered, and how (where) you intend to fix it (driver, libsensors, application...)
W83871D and LM78.
Quoted 4 lines
My first impression is that, if you are really interested in the past states of the sensors, then you better continuously log all the values (some applications do that, drawing nice graphs.) A single alarm bit isn't going to tell you much.
Quoted 5 lines
We aren't that interested in past states of the sensors as we are in the alarms, but the possibility of missing alarms in the monitor due to some other app polling the sensors just won't work.
Does that make any sense?
Not really, sorry. How can you be that interested in possible alarms that happened in the past, but you don't care about what value triggered it? Most chips (including the LM78 and the W83781D) have only one alarm bit for each channel, so you get the same alarm bit set for over-voltage and under-voltage, for example. And an alarm triggering because temperature is 1 degree C too high is quite different from the same alarm flag triggering because temperature reached 110 degrees C and your system is on fire.
Quoted 4 lines
I guess something besides an alarm latch that would work, is some way through the libsensors API to quickly tell if any voltage, temperature, or fan sensor has a current out of range condition (even if the alarm is not asserted).
This is a completely different need, and one which is already covered by the drivers. If there is an out-of-range condition, then the alarm _is_ asserted. That's the other way around which may not be true for most chips.
As for the alarm latch, where and how would you implement that? You'd need one latch for every application interested in past states. And if we go that way, why wouldn't we also latch min and max values for every channel? The simple truth is that, if you are interested in past states, then your user-space application gets to repeatedly poll the sensor values, including alarm flags, and store whatever values you want for future use.
Signature · 1 line
Jean Delvare
Quoted 4 lines · Jean Delvare
Not really, sorry. How can you be that interested in possible alarms that happened in the past, but you don't care about what value triggered it?
We want to catch the alarm so we can then check if the condition that triggered it is still true, and if so, take action according to the magnitude of the condition.
Quoted 6 lines
Most chips (including the LM78 and the W83781D) have only one alarm bit for each channel, so you get the same alarm bit set for over-voltage and under-voltage, for example. And an alarm triggering because temperature is 1 degree C too high is quite different from the same alarm flag triggering because temperature reached 110 degrees C and your system is on fire.
Yes, but it draws attention to what componene needs attention.
Quoted 4 lines
This is a completely different need, and one which is already covered by the drivers. If there is an out-of-range condition, then the alarm _is_ asserted. That's the other way around which may not be true for most chips.
It's asserted, but is cleared on read with some chips. Then the condition remains out of range, but the alarm is cleared.
Quoted 4 lines
channel? The simple truth is that, if you are interested in past states, then your user-space application gets to repeatedly poll the sensor values, including alarm flags, and store whatever values you want for future use.
So in general, the alarms are useless and the application should simply check the current value against the ranges always?
Signature · 1 line
Ryan Underwood, <nemesis at icequake.net>
Ryan,
Quoted 9 lines · Ryan Underwood
Quoted 4 lines · Jean Delvare
Not really, sorry. How can you be that interested in possible alarms that happened in the past, but you don't care about what value triggered it?
We want to catch the alarm so we can then check if the condition that triggered it is still true, and if so, take action according to the magnitude of the condition.
For the vast majority of chips, if the condition is still true, then the alarm is reasserted immediately after it has been cleared by a read.
Quoted 7 lines
Quoted 4 lines
This is a completely different need, and one which is already covered by the drivers. If there is an out-of-range condition, then the alarm _is_ asserted. That's the other way around which may not be true for most chips.
It's asserted, but is cleared on read with some chips. Then the condition remains out of range, but the alarm is cleared.
Most chips don't work that way. Of all (relatively popular) chips I know of, only the W83781D chip does behave the way you describe, and only for voltages and fans, not for temperatures, if I remember correctly. It is due to the fact that this chip doesn't have real-time alarm registers, so we are (ab)using the interrupt registers instead. In fact we shouldn't have exported these alarm values at all for this chip, as they don't match our own standard.
Quoted 2 lines
So in general, the alarms are useless and the application should simply check the current value against the ranges always?
In general, alarm flags work as intended and applications can use them. Only the W83781D causes trouble, and it's just bad luck that this is the chip you are using. So for the W83781D, yes, comparing the readings with the limit values is better.
Signature · 1 line
Jean Delvare
Quoted 8 lines · Jean Delvare
Quoted 3 lines
So in general, the alarms are useless and the application should simply check the current value against the ranges always?
In general, alarm flags work as intended and applications can use them. Only the W83781D causes trouble, and it's just bad luck that this is the chip you are using. So for the W83781D, yes, comparing the readings with the limit values is better.
What luck. Should it be considered a bug that W83781D has alarm behavior inconsistent with the rest of the sensors?
Signature · 1 line
Ryan Underwood, <nemesis at icequake.net>
Quoted 8 lines · Ryan Underwood
Quoted 4 lines · Jean Delvare
In general, alarm flags work as intended and applications can use them. Only the W83781D causes trouble, and it's just bad luck that this is the chip you are using. So for the W83781D, yes, comparing the readings with the limit values is better.
What luck. Should it be considered a bug that W83781D has alarm behavior inconsistent with the rest of the sensors?
I'd say so, yes.
Signature · 1 line
Jean Delvare