unbounded looping on hardware bits considered harmful

Bruce Perens (bruce@pixar.com)
Wed, 11 Dec 96 18:00 PST


I'd like to suggest that code that can wait forever for a hardware bit to
change is a bad idea, _especially_ if it is likely to be called during
autoprobing of a device driver. For example:

while (!(tmp = NCR5380_read(STATUS_REG)) & SR_REQ);

This example is in the generic NCR5380 driver, but such code is all
over the Linux kernel. This or something nearby is called during
auto-probing. In my test case the autoprobe routine got a
false-positive, no NCR5380 is present, and the kernel hangs forever.
One could argue that the auto-probing routine is incorrect and we
should never get this far, however it would be nice if the failure of
a single hardware device did not bring down the entire kernel.


Bruce Perens

Bruce Perens K6BP   Bruce@Pixar.com
Finger bruce@master.Debian.org for PGP public key.
PGP fingerprint = 88 6A 15 D0 65 D4 A3 A6  1F 89 6A 76 95 24 87 B3