Skip to contentSkip to conversation

lost alarms with it87

lm-sensors Hector Lahoz 2 participants 3 messages Sep 19, 2008 – Sep 21, 2008

lore
Share & tools
lore
#0 lore raw

Hi
Ok, we won't use interrupts. Now, I'd like to have some kind of signal that warns about CPU going above max temperature. For example, through sensord. But the problem is that some seconds after the alarm is triggered the ALARM message of sensors does not appear any more. Shouldn't the alarm bit remain set until it is read? And if it's only read by show_* functions (i.e. it87_update_device() ), why does it go away?
The result is that the alarm is lost. Am I doing any false assumption or is my chip not following the specification?

I've done a simple experiment to demonstrate this: First I ran sensors every 5 seconds and then every 1 second:

# while [ 1 ]; do sensors | grep ^CPU; sleep 5; done
CPU Temp:    +28.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +29.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +30.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +31.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +31.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +31.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +32.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +32.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +32.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +33.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +33.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +33.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +34.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +34.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +34.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +35.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
# while [ 1 ]; do sensors | grep ^CPU; sleep 1; done

(for clarity I've compressed the output by placing a multiplier at the end meaning the number of identical lines)

CPU Temp:    +28.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +28.0°C  (low  = +29.0°C, high = +33.0°C)  sensor = thermal diode
CPU Temp:    +29.0°C  (low  = +29.0°C, high = +33.0°C)  sensor thermal diode   *6
CPU Temp:    +30.0°C  (low  = +29.0°C, high = +33.0°C)  sensor thermal diode   *8
CPU Temp:    +31.0°C  (low  = +29.0°C, high = +33.0°C)  sensor thermal diode   *10
CPU Temp:    +32.0°C  (low  = +29.0°C, high = +33.0°C)  sensor thermal diode   *12
CPU Temp:    +33.0°C  (low  = +29.0°C, high = +33.0°C)  ALARM  sensor
= thermal diode
CPU Temp:    +33.0°C  (low  = +29.0°C, high = +33.0°C)  ALARM  sensor
= thermal diode
CPU Temp:    +33.0°C  (low  = +29.0°C, high = +33.0°C)  sensor thermal diode   *10
CPU Temp:    +34.0°C  (low  = +29.0°C, high = +33.0°C)  sensor thermal diode   *3

As you can see, I took care to reach the hysteresis temperature (29 deg)

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw
Quoted 7 lines · Hector Lahoz

Ok, we won't use interrupts. Now, I'd like to have some kind of signal that warns about CPU going above max temperature. For example, through sensord. But the problem is that some seconds after the alarm is triggered the ALARM message of sensors does not appear any more. Shouldn't the alarm bit remain set until it is read? And if it's only read by show_* functions (i.e. it87_update_device() ), why does it go away?

It might depend on how the device is programmed. For example, with the LM63 in it's default alarm mode (which the driver neither checks nor sets), alarms work like this:

When an alarm condition occurs the bit in the alarm register is set. It remains set until the register is read. It whatever condition caused the alarm goes away, it still says set.

When the alarm register is read, it is cleared (and the alert# IRQ pin is disabled). It doesn't matter if the condition still exists or not, the register is always cleared.

When the chip does its next temp conversion, which it does automatically 16 times per second by default, it will again set the alarm bit in the register if the condition still exists. However, the alert# pin will remain disabled. It needs to be turned back on manually, which the driver doesn't do.

If something besides the lm63 driver (like i2cdump or ACPI) reads the alarm register before the driver does then the driver might not see the alarm.

The LM63 can be put into alarm comparator mode. In this mode the alarm bit remains set after the register is read. If the condition no longer exists after a temp conversion, the bit is cleared, even if the register hasn't been read yet. In this mode it's not possible to not see an alarm if it exists when the driver checks, but it's also not possible to see an alarm for a condition that no longer exists.

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#2 lore raw
In reply to Hector Lahoz
Quoted 32 lines · Trent Piepho
Quoted 8 lines · Hector Lahoz

Ok, we won't use interrupts. Now, I'd like to have some kind of signal that warns about CPU going above max temperature. For example, through sensord. But the problem is that some seconds after the alarm is triggered the ALARM message of sensors does not appear any more. Shouldn't the alarm bit remain set until it is read? And if it's only read by show_* functions (i.e. it87_update_device() ), why does it go away?

It might depend on how the device is programmed. For example, with the LM63 in it's default alarm mode (which the driver neither checks nor sets), alarms
work like this:

When an alarm condition occurs the bit in the alarm register is set. It remains set until the register is read. It whatever condition caused the alarm goes away, it still says set.

When the alarm register is read, it is cleared (and the alert# IRQ pin is disabled). It doesn't matter if the condition still exists or not, the register is always cleared.

When the chip does its next temp conversion, which it does automatically 16 times per second by default, it will again set the alarm bit in the register if the condition still exists. However, the alert# pin will remain disabled. It needs to be turned back on manually, which the driver doesn't do.

If something besides the lm63 driver (like i2cdump or ACPI) reads the alarm register before the driver does then the driver might not see the alarm.

Quoted 8 lines

The LM63 can be put into alarm comparator mode. In this mode the alarm bit remains set after the register is read. If the condition no longer exists after a temp conversion, the bit is cleared, even if the register hasn't been
read yet. In this mode it's not possible to not see an alarm if it exists when the driver checks, but it's also not possible to see an alarm for a condition that no longer exists.

The it87 behaves in a similar way.
I think hysteresis doesn' make any sense if not using interrupts, so I tried setting low temp to 127 deg. Celsius (comparator mode) and now it works fine.
I don't understand yet why the bit is cleared. Either the chip doesn't follow the datasheet or there is another process/subsystem reading the chip register. But it works now, that is what matters. Thanks

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors