Subject: Re: CF/IDE performance problem...
To: Matthew Orgass <darkstar@city-net.com>
From: Manuel Bouyer <bouyer@antioche.eu.org>
List: tech-kern
Date: 11/19/2005 18:43:45
On Fri, Nov 18, 2005 at 11:52:29PM -0500, Matthew Orgass wrote:
> 
>   I just purchased a Rosewill 512MB Compact Flash card and an IDE to CF
> adaptor.  Performance was horrible (<800KB/s bonnie++ read (with small
> data size)), and I noticed this in dmesg:
> 
> wd1: drive supports 1-sector PIO transfers, LBA addressing
> wd1: 488 MB, 993 cyl, 16 head, 63 sec, 512 bytes/sect x 1000944 sectors
> wd1: 32-bit data port
> wd1(viaide0:1:0): using PIO mode 0

Does't it report something like:
wd1: drive supports PIO mode 4

It not, then that's probably the cause of the problem: it doesn't report
its capabilities, and the driver assumes it's too old to do anything else
but PIO mode 0. You should be able to workaround this by forcing the
modes in the kernel config using flags (see wd(4) for details on the
flags).

>  [...]
>   I also tried a microdrive in the CF to IDE adaptor and it reported:
> 
> wd1 at atabus1 drive 0: <IBM-DSCM-11000>
> wd1: drive supports 16-sector PIO transfers, LBA addressing
> wd1: 1027 MB, 2088 cyl, 16 head, 63 sec, 512 bytes/sect x 2104704 sectors
> wd1: 32-bit data port
> wd1: drive supports PIO mode 3, DMA mode 1
> wd1(viaide0:1:0): using PIO mode 3, DMA mode 1 (using DMA data transfers)
> viaide0:1:0: lost interrupt
> 	type: ata tc_bcount: 512 tc_skip: 0
> viaide0:1:0: bus-master DMA error: missing interrupt, status=0x21
> wd1: transfer error, downgrading to PIO mode 3
> wd1(viaide0:1:0): using PIO mode 3
> wd1d: DMA error reading fsbn 0 (wd1 bn 0; cn 0 tn 0 sn 0), retrying
> wd1: soft error (corrected)

That's another problem: The controller supports DMA, the drive supports
DMA, but there's something between the controller and the drive which
doesn't support DMA. The driver has no way to know this. Fortunably it's
smart enouth to downgrade to PIO when DMA fails.

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--