Re: [RFC/PATCH, 2/4] readX_check() performance evaluation

From: Matthew Wilcox
Date: Wed Jan 28 2004 - 13:23:20 EST


On Tue, Jan 27, 2004 at 06:55:17PM -0800, Linus Torvalds wrote:
> Quite frankly, I'd much rather have something more like this:
>
> clear_pcix_errors(dev);
> ..
> x = readX_check(dev, offset); /* Maybe several ones, maybe in a loop */
> ..
> error = read_pcix_errors(dev);
> if (error)
> take_pcix_offline(dev);
>
> in other words, I'd rather _not_ see the "readX_check()" code itself have
> the retry logic and error value handling.
>
> Why? Because on a number of architectures it is entirely possible that the
> error comes as a _asynchronous_ machine exception or similar. So I'd much
> rather have the interfaces be designed for that. Also, it's likely to
> perform a lot better, and result in much clearer code this way (ie you can
> try to set up the whole command before reading the error just once).

Well, read() is a bad example for that -- errors are always going
to come back straight away for a read. write() is a better example.
I'd really like to hear from someone who's done this kind of thing before.
Are there any actions worth taking when an error occurs *other* than
taking the card offline and notifying the user?

If there are, Linus' interface is probably the best one. If not, we could
simply have readX_check() / writeX_check() call dev->driver->unregister()
if they notice an error has occurred and then the driver doesn't even
need to call read_pcix_errors().

--
"Next the statesmen will invent cheap lies, putting the blame upon
the nation that is attacked, and every man will be glad of those
conscience-soothing falsities, and will diligently study them, and refuse
to examine any refutations of them; and thus he will by and by convince
himself that the war is just, and will thank God for the better sleep
he enjoys after this process of grotesque self-deception." -- Mark Twain
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/