Skip to contentSkip to conversation

Reverting the probe order

lm-sensors Jean Delvare 2 participants 3 messages May 4, 2008 – May 5, 2008

lore
Share & tools
lore
#0 lore raw

Hi all,

It just occurred to me today that the order in which we probe for sensor chips in sensors-detect doesn't make sense. We start with the less reliable and more risky probe (SMBus) to end with the less risky and more reliable (Super-I/O, CPU and PCI devices). It is done that way for historical reasons I guess, but in the light of recent reports [1], I think we should reconsider our strategy.

[1] http://lists.lm-sensors.org/pipermail/lm-sensors/2008-May/023020.html

I think we should probe in the following order:

1* CPU and PCI chips. No probing is required, so it's 100% safe.

2* Super-I/O probing. The I/O ports accessed (0x2e, 0x2f and 0x4e, 0x4f) are relatively standard, so it's relatively safe.

3* ISA probing. We don't probe too many port, and half of the probes are read-only, so it's still relatively safe, although probably less safe than Super-I/O probes.

4* I2C/SMBus probing. As everybody knows, that's the most risky part, because the semantics of I2C transactions vary from one chip to the next, and while we only do read transactions from an SMBus perspective, some chips may handle them as writes.

The advantage with reverting the probe order that way, is that we could skip the most risky parts as soon as we have found what we were looking for. In particular:

* I think we can skip ISA probing by default if we found a Super-I/O with sensors. I can't remember a machine that had both a Super-I/O chip with sensors, and an ISA hardware monitoring chip. In fact, we could probably skip ISA probing even when we find a Super-I/O chip with no sensors. The ISA chips (LM78, W83781D) are only found on old systems which didn't have Super-I/O chips as far as I know.

* We could skip I2C probing by default if we have found a Super-I/O chip with sensors. In most cases, the Super-I/O sensors will be what the user must use, so why take the risk of probing the SMBus? The Sapphire AM2RD790 motherboard is a good example of this. It uses an ITE IT8716F for hardware monitoring, and probing the SMBus causes havoc. The strategy I suggest would prevent users from getting into trouble needlessly.

I know that on some boards, the Super-I/O sensors are activated but unused, or they are used but a dedicated sensor chip is used in addition, so the proposed strategy isn't perfect, but I still think it would be a better (safer) default. We could then refine it depending on the motherboard manufacturer for example.

Comments?

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#1 lore raw
Quoted 2 lines · Jean Delvare

It just occurred to me today that the order in which we probe for sensor chips in sensors-detect doesn't make sense. [...] Comments?

I agree that changing the order to do the "safer" probes first is a good idea. However, I think that if some probes are skipped based on the results of earlier probes (like your example of skipping the ISA probe if a SuperIO chip with monitoring is found), there ought to be some way to force these probes to be done. The reason is that as soon as you code something like that into sensors-detect, Advanced Intel Devices will come out with the new Athlete Sexium XQ y8 Core Octo processor and a reference motherboard design that breaks the new version of sensors- detect.

One of the goals of sensors-detect seems to be that you don't need to configure it much (no command-line options); you just run it and it figures things out. Adding a --force-unsafe-probing option might be considered to be a bad idea. One option might be to have two scripts - say sensors-detect and sensors-detect-this-might-explode-your-hardware - but then you have duplicate code and have to make the same changes in two places. Maybe the script can look at $0 (the Perl equivalent of C's argv[0]) to decide what to do.

The "dangerous" version or mode of the script should probably also print out a liberal amount of warnings; Achim isn't that angry about his CPU dying, but a less technically advanced user might not be so forgiving. If the script prompts with "This probe might turn your CPU into a $300 paperweight, are you sure? yes-I-want-to-melt-my-CPU/N >" then you can avoid the "but nobody TOLD me" complaints.

Matt Roberds

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

#2 lore raw
In reply to Jean Delvare

Hi Matt,

Quoted 4 lines · Matt Roberds
Quoted 2 lines · Jean Delvare

It just occurred to me today that the order in which we probe for sensor chips in sensors-detect doesn't make sense. [...] Comments?

Quoted 9 lines

I agree that changing the order to do the "safer" probes first is a good idea. However, I think that if some probes are skipped based on the results of earlier probes (like your example of skipping the ISA probe if a SuperIO chip with monitoring is found), there ought to be some way to force these probes to be done. The reason is that as soon as you code something like that into sensors-detect, Advanced Intel Devices will come out with the new Athlete Sexium XQ y8 Core Octo processor and a reference motherboard design that breaks the new version of sensors- detect.

Of course. Maybe I haven't been clear enough in my original post, but all I meant to change was the default answer. The users must always have the possibility to force a probe if they know they need it.

Quoted 8 lines

One of the goals of sensors-detect seems to be that you don't need to configure it much (no command-line options); you just run it and it figures things out. Adding a --force-unsafe-probing option might be considered to be a bad idea. One option might be to have two scripts - say sensors-detect and sensors-detect-this-might-explode-your-hardware - but then you have duplicate code and have to make the same changes in two places. Maybe the script can look at $0 (the Perl equivalent of C's argv[0]) to decide what to do.

The lack of command line options to sensors-detect is for historical reasons, mostly. That and the fact that nobody took the time to design and propose a command line interface. The trick with command line interfaces is that it's easier to add flags or parameters than to remove or change them. Once people - or external scripts - are used to a command line syntax, you get a lot of complaints if you change it. So, when we add a command line interface to sensors-detect - and I think we should - we need to put some thinking into it first.

Quoted 6 lines

The "dangerous" version or mode of the script should probably also print out a liberal amount of warnings; Achim isn't that angry about his CPU dying, but a less technically advanced user might not be so forgiving. If the script prompts with "This probe might turn your CPU into a $300 paperweight, are you sure? yes-I-want-to-melt-my-CPU/N >" then you can avoid the "but nobody TOLD me" complaints.

I agree. As I gain experience with the different ways hardware manufacturers can use the most unexpected chips in PC mainboards, I realize that the first goal of sensors-detect must be changed from "detect as many possible sensor chips as possible" from "detect sensors on as many boards as possible without breaking any". At least for the default behavior. As you wrote before, we will probably want a command line option to revert to the previous behavior for people who really want that.

Thanks,

Signature · 6 lines
Jean Delvare

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