Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Sep 1997 08:09:39 +0200
From:      j@uriah.heep.sax.de (J Wunsch)
To:        hackers@FreeBSD.ORG
Subject:   Re: Do *you* have problems with floppies?
Message-ID:  <19970913080939.WU46166@uriah.heep.sax.de>
In-Reply-To: <Pine.SV4.3.95.970912220547.4487A-100000@kestrel.ukc.ac.uk>; from K.J.Koster on Sep 12, 1997 22:33:27 %2B0100
References:  <199709122056.NAA24445@usr08.primenet.com> <Pine.SV4.3.95.970912220547.4487A-100000@kestrel.ukc.ac.uk>

next in thread | previous in thread | raw e-mail | index | archive | help
As K.J.Koster wrote:

> I agree with you that busy-looping on a device is not the correct way to
> go about I/O, and I understand why FreeBSD does not busy-loop.

You probably don't understand very much about FDCs then, sorry.

Look into the docs for the NE765, look into the code.  *Then* start to
discuss.  Don't discuss things you don't understand.

There are a lot of busy loops in the FreeBSD fdc driver, and you can
send a lovely ``thanks!'' letter to some stupid IBM engineer for
dropping the READY line from the floppy bus, apparently for the sake
of being able to use this twist-some-wires-for-drive-A hack.  So now
the FDC always assumes the drive is ready (its READY pin hardwired to
+ 5 V), and your only chance to detect that there's actually no floppy
responding at all is busy-loop in a count-limited loop.  Whatever
operating system you're using.  (FreeBSD 1 had a lot of problems with
this, which were manifest in a lousy recovery behaviour when you tried
to access a floppy drive with no medium inserted.)

Actual data transfer is done using motherboard DMA.  Again, this is
the same for all operating systems, since it's a hardware decision.
(Well, you could in theory use PIO mode as well, but nobody in his
right mind does on a PC, not even the BIOS.  I did it in my CP/M BIOS,
since i didn't get the i8080-biased DMA working with my Z80 DMAC.  It
doesn't make any difference regarding transfer error handling
however.)

> I have cheap hardware, and for that I am happy to pay the performance 
> penalty, as I do every day. I'm quite happy to pay the performance penalty
> for a busy-looping floppy driver, if that means I can write floppies
> without having to worry whether I can read the disk later or not.

Both is entirely unrelated.  If your cheap hardware is crap, no driver
of the world can do much about it.  The only decision of the driver is
the strategy how to retry erroneous transmissions.  Things that are
wrong on the floppy cannot be fixed by any driver.  Again, go and read
the FDC documentation before making too much assumptions.  These
beasts are horribly stupid, and all you get is either a success or a
failure.  There's nothing you could `tune' in this case.  FIFOs can
fix `DMA overrun' conditions, but that would be transparent to the
user.

(We are retrying DMA overruns forever, since the AHA154x controllers
tend to hog the bus for too long, causing this error frequently.  They
aren't even logged at all.  The AHA154x is the only known bus hog that
was causing excessive DMA overruns in the fdc driver.  DMA overruns
never mean data loss since they can be retried without harm.  Only
performance drops drastically in this case.)

What can be affected by the driver is transfer speed.  But that's
another matter.  The FreeBSD driver is reasonably good at sequential
transfers (better than all other Unixes, and at least as good as the
average BIOS driver), but probably lousy at random seek IO.

> FreeBSD has special options for people with broken keyboard resets,
> broken APM and broken PCMCIA cards. Why not add another one for unfifo'd
> floppy controllers?

The driver currently only knows unfifo'd floppy controllers.  I've
been using one myself for years.

> PS. I just realized I have written my demo code for my job applications
>     using mtools... Oops :) You guys are giving me a headache.

What do you wanna say with this?  Whether you stack tar, cpio, dump, a
filesystem, or mtools over the floppy driver doesn't matter.  If the
driver is buggy, it's still all going through the driver.  If it
isn't, the application doesn't matter.  (Ok, the msdosfs code is known
to get lousy performance on floppies, but that's the only difference.)

-- 
cheers, J"org

joerg_wunsch@uriah.heep.sax.de -- http://www.sax.de/~joerg/ -- NIC: JW11-RIPE
Never trust an operating system you don't have sources for. ;-)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19970913080939.WU46166>