i2c-matroxfb
Hi Malcolm,
You once wrote to us about a sensors detection problem, and the log shows you had a supported Matrox video card at that time. Do you still have it? I'm interested in a problem I have with a similar card, and I thought maybe you could help.
The problem I encountered is that scanning the I2C bus of my Matrox Mystique is very, very slow. As slow as lasting 30 minutes where scaning other devices last a few seconds only. The problem shows when sensors-detect is run, or when i2c-detect is run on the bus as well.
Do you remember if you had the problem too? What kind of Matrox card do you have, and what kind of computer is it used in?
Thanks.
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Skipped content of type multipart/alternative-------------- next part -------------- A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20030711/fd66c0f3/attachment.bin
Hi all, I'm back...
Quoted 5 lines · Jean Delvare
The problem I encountered is that scanning the I2C bus of my Matrox Mystique is very, very slow. As slow as lasting 30 minutes where scaning other devices last a few seconds only. The problem shows when sensors-detect is run, or when i2c-detect is run on the bus as well.
I saw it mentioned (maybe on LKML) that this driver has an overly long I2C bus timeout - something like 30 seconds or so. That's silly.
I have an ancient Millenium II to test with, if anyone needs.
Regards,
Signature · 2 lines
Mark M. Hoffman [email protected]
Hi Mark, how went your trip in France?
Quoted 10 lines
Quoted 5 lines
The problem I encountered is that scanning the I2C bus of my Matrox Mystique is very, very slow. As slow as lasting 30 minutes where scaning other devices last a few seconds only. The problem shows when sensors-detect is run, or when i2c-detect is run on the bus as well.
I saw it mentioned (maybe on LKML) that this driver has an overly long I2C bus timeout - something like 30 seconds or so. That's silly.
I have an ancient Millenium II to test with, if anyone needs.
I have been operating some tests WRT this topic, and here are some random thoughts about it.
First, the timeout isn't 30 seconds. It is set to "100" in a unit I believe is hundreds of seconds, so it is one second. This is bad because it doesn't use HZ as it should. It is more than other drivers I have see which use HZ/2 (that is, 50) for timeout. But that's only double, nothing to yield after.
I tried to run i2cdump on my Matrox Mystique, first with timeout0, second with timeoutP. It took 8s for each address scanned in the first case, 4s for each address scanned in the second case. This shows that the timeout is the value that makes it slow, but this also raise another problem. I would have expected the average scan time to be exactly the timeout value. And it is eight times higher.I checked the i2cdump code and it only calls i2c_smbus_read_byte_data() once for each address.
I searched the web for a solution and found that loading the i2c-algo-bit module (which i2c-matroxfb is using) with bit_test=1 solves the problem.
I will lead the same kind of experiments on the rivatv module, since it does the same as i2c-matroxfb. If the conclusions are different, it means that there is something to fix in the i2c-matroxfb driver. If the conclusions are the same, it means that we could consider doing the bit_test=1 for i2c-algo-bit the default. I don't know if it can have side effects. Well, I see at least one, which is that the test is made at the time the client module is loaded. So if the user loads the module at a time he/she has no compliant monitor, and changes that afterwards, he/she will still have his/her I2C bus disabled. I doubt it is a major issue, this isn't the kind of thing that is likely to happen very often.
Another easier possibility is to add some code to sensors-detect to load i2c-algo-bit with bit_test=1 right before we load i2c-matroxfb, but it will fail if the i2c-algo-bit is already loaded for some reason. We could at least tell the user that scanning the i2c-matroxfb bus can be slow, so he/she can skip it is he/she wants.
Comments welcome.
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Quoted 9 lines
I tried to run i2cdump on my Matrox Mystique, first with timeout0, second with timeoutP. It took 8s for each address scanned in the first case, 4s for each address scanned in the second case. This shows that the timeout is the value that makes it slow, but this also raise another problem. I would have expected the average scan time to be exactly the timeout value. And it is eight times higher.I checked the i2cdump code and it only calls
i2c_smbus_read_byte_data()once for each address.
Hm. I meant i2cdetect of course. So the function that is called is i2c_smbus_write_quick(), not i2c_smbus_read_byte_data(). BTW there is also an ioctl() call, which I am not familiar with. Could it also cause the slowdown too?
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/
Quoted 12 lines
I will lead the same kind of experiments on the rivatv module, since it does the same as i2c-matroxfb. If the conclusions are different, it means that there is something to fix in the i2c-matroxfb driver. If the conclusions are the same, it means that we could consider doing the bit_test=1 for i2c-algo-bit the default. I don't know if it can have side effects. Well, I see at least one, which is that the test is made at the time the client module is loaded. So if the user loads the module at a time he/she has no compliant monitor, and changes that afterwards, he/she will still have his/her I2C bus disabled. I doubt it is a major issue, this isn't the kind of thing that is likely to happen very often.
OK, I did the test and the result is similar. The complete i2cdetect shows an average 0.8s for each address scanned. And they set their timeout to 10. So it is 10 times faster than the i2c-matroxfb, with a 10 times lower timeout. Bingo! That's still not what I would have expected. The time per address is eight times higher than the timeout value. Why that? Is the unit different from what I think it is? Or does the timeout occur eight times for each address? *That* would be stupid and probably worth fixing.
So what now? Maybe we could set a the same timeout value of 10 (or HZ/10) in the i2c-matroxfb module? It sill will be slow...
Signature · 2 lines
Jean Delvare http://www.ensicaen.ismra.fr/~delvare/