From mboxrd@z Thu Jan 1 00:00:00 1970 From: Matthew Wilcox Date: Wed, 28 Jan 2004 18:20:03 +0000 Subject: Re: [RFC/PATCH, 2/4] readX_check() performance evaluation Message-Id: <20040128182003.GL11844@parcelfarce.linux.theplanet.co.uk> List-Id: References: <00a301c3e541$c13a6350$2987110a@lsd.css.fujitsu.com> In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Linus Torvalds Cc: Hironobu Ishii , linux-kernel , linux-ia64 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