# DMA Enabled? Slow HDD access? ARGH!!

## Xylene

I have Via PM133 chipset with a Pentium III 1GHz. This the problem, HDD reading seems very slow. I ran hdparm from a chrooted enviornment to see if the live cd gave me faster HDD access, and it did.

It was something like:

```
[root:xyleron /home/xylene] $ hdparm -tT /dev/hda

/dev/hda:

 Timing cached reads:   xx MB in  x.xx seconds = 150.xx MB/sec

 Timing buffered disk reads:   xx MB in  x.xx seconds =   [b]25[/b].xx

MB/sec
```

but when I boot into Gentoo normally it's more like:

```

[root:xyleron /home/xylene] $ hdparm -tT /dev/hda

/dev/hda:

 Timing cached reads:   304 MB in  2.01 seconds = 150.89 MB/sec

 Timing buffered disk reads:   28 MB in  3.15 seconds =   [b]8.88[/b] MB/sec

```

I have this in /etc/conf.d/hdparm

```

hda_args="-d1 -X66"

disc1_args="-d1 -X66"

cdrom0_args="-d1

```

```

[root:xyleron /home/xylene] $ lspci

0000:00:00.0 Host bridge: VIA Technologies, Inc. VT8605 [ProSavage PM133] (rev 01)

0000:00:01.0 PCI bridge: VIA Technologies, Inc. VT8605 [PM133 AGP]

0000:00:07.0 ISA bridge: VIA Technologies, Inc. VT82C686 [Apollo Super South] (rev 40)

0000:00:07.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)

0000:00:07.2 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 16)

0000:00:07.4 Host bridge: VIA Technologies, Inc. VT82C686 [Apollo Super ACPI] (rev 40)

0000:00:07.5 Multimedia audio controller: VIA Technologies, Inc. VT82C686 AC97 Audio Controller (rev 50)

0000:00:0a.0 Ethernet controller: Lite-On Communications Inc LNE100TX (rev 20)

0000:00:0c.0 VGA compatible controller: 3Dfx Interactive, Inc. Voodoo 3 (rev 01)

0000:01:00.0 VGA compatible controller: S3 Inc. ProSavage PM133 (rev 02)

[root:xyleron /home/xylene] $ 

```

I have this in my kernel config:

```

CONFIG_BLK_DEV_VIA82CXXX=y

# CONFIG_IDE_ARM is not set

CONFIG_BLK_DEV_IDEDMA=y

# CONFIG_IDEDMA_IVB is not set

CONFIG_IDEDMA_AUTO=y

```

Anyone have any idea how I could speed this up, to atleast what it was from the Live CD?Last edited by Xylene on Tue Mar 01, 2005 9:12 pm; edited 1 time in total

----------

## hds

hmm, what is "-X66"  :Shocked: 

did you try the simple way like: "all_args="-d1" already?

from my kernel 2.4 config:

```

CONFIG_BLK_DEV_IDEPCI=y

CONFIG_BLK_DEV_GENERIC=y

CONFIG_IDEPCI_SHARE_IRQ=y

CONFIG_BLK_DEV_IDEDMA_PCI=y

[...]

CONFIG_IDEDMA_PCI_AUTO=y

CONFIG_BLK_DEV_IDEDMA=y

CONFIG_BLK_DEV_VIA82CXXX=y

CONFIG_IDEDMA_AUTO=y

```

----------

## Xylene

 *hds wrote:*   

> hmm, what is "-X66" 
> 
> did you try the simple way like: "all_args="-d1" already?
> 
> from my kernel 2.4 config:
> ...

 

I saw the -X66 in the example in /etc/conf.d/hdparm so I figured I'd just see what happens. I get the same performance with "all_args=-"-d1"".

----------

## Sith_Happens

Here are the flags from my /etc/conf.d/hdparm file:

```
hda_args="-d1c1u1 -X udma6"

hdb_args="-d1c1u1 -X udma6"
```

My drives and controller can handle udma6 though.  -X66 will set your pio mode to umda 2 (2 + 64).  Run hdparm -I on your drives to check what pio modes they support.

----------

## Xylene

```
        DMA: mdma0 mdma1 mdma2 udma0 udma1 *udma2 udma3 udma4 udma5 

             Cycle time: min=120ns recommended=120ns

        PIO: pio0 pio1 pio2 pio3 pio4 

             Cycle time: no flow control=240ns  IORDY flow control=120ns

```

What should I set it at?

----------

## Sith_Happens

Assuming that you have 80 pin cable and an IDE controller capable of handling udma5, try -X udma5 or -X69.

----------

## hds

 *Sith_Happens wrote:*   

> Assuming that you have 80 pin cable and an IDE controller capable of handling udma5, try -X udma5 or -X69.

 

doode! he is using an "Pentium III 1GHz".

----------

## Sith_Happens

If he can't handle udma5, then he can try udma4 or 3.  Both are better than udma2 he's using now.

----------

## hds

 *Sith_Happens wrote:*   

> If he can't handle udma5, then he can try udma4 or 3.  Both are better than udma2 he's using now.

 

 :Shocked: 

he is not able to use UDMA at all. sit down, and get your facts straight!

what he likes is PIO, and "-d1" should do that for him. now his somehow fails, and it is on us and him to discover why. if he is lucky, he might get UDMA33, though..Last edited by hds on Tue Mar 01, 2005 7:59 pm; edited 2 times in total

----------

## Xylene

I shut off hdparm from setting DMA at boot and made sure my BIOS had DMA enabled (which it didn't, but it's odd that I got fast performance on the HDD when chrooting into my setup from the live cd). I set to udma5 and it's still the same.

Here are my current settings:

```

#

# ATA/ATAPI/MFM/RLL support

#

CONFIG_IDE=y

CONFIG_BLK_DEV_IDE=y

#

# Please see Documentation/ide.txt for help/info on IDE drives

#

# CONFIG_BLK_DEV_IDE_SATA is not set

# CONFIG_BLK_DEV_HD_IDE is not set

CONFIG_BLK_DEV_IDEDISK=y

CONFIG_IDEDISK_MULTI_MODE=y

CONFIG_BLK_DEV_IDECD=y

# CONFIG_BLK_DEV_IDETAPE is not set

# CONFIG_BLK_DEV_IDEFLOPPY is not set

# CONFIG_BLK_DEV_IDESCSI is not set

# CONFIG_IDE_TASK_IOCTL is not set

#

# IDE chipset support/bugfixes

#

# CONFIG_IDE_GENERIC is not set

# CONFIG_BLK_DEV_CMD640 is not set

CONFIG_BLK_DEV_IDEPCI=y

CONFIG_IDEPCI_SHARE_IRQ=y

# CONFIG_BLK_DEV_OFFBOARD is not set

# CONFIG_BLK_DEV_GENERIC is not set

# CONFIG_BLK_DEV_OPTI621 is not set

# CONFIG_BLK_DEV_RZ1000 is not set

CONFIG_BLK_DEV_IDEDMA_PCI=y

# CONFIG_BLK_DEV_IDEDMA_FORCED is not set

CONFIG_IDEDMA_PCI_AUTO=y

# CONFIG_IDEDMA_ONLYDISK is not set

# CONFIG_BLK_DEV_AEC62XX is not set

# CONFIG_BLK_DEV_ALI15X3 is not set

# CONFIG_BLK_DEV_AMD74XX is not set

# CONFIG_BLK_DEV_ATIIXP is not set

# CONFIG_BLK_DEV_CMD64X is not set

# CONFIG_BLK_DEV_TRIFLEX is not set

# CONFIG_BLK_DEV_CY82C693 is not set

# CONFIG_BLK_DEV_CS5520 is not set

# CONFIG_BLK_DEV_CS5530 is not set

# CONFIG_BLK_DEV_HPT34X is not set

# CONFIG_BLK_DEV_HPT366 is not set

# CONFIG_BLK_DEV_SC1200 is not set

# CONFIG_BLK_DEV_PIIX is not set

# CONFIG_BLK_DEV_IT8212 is not set

# CONFIG_BLK_DEV_NS87415 is not set

# CONFIG_BLK_DEV_PDC202XX_OLD is not set

# CONFIG_BLK_DEV_PDC202XX_NEW is not set

# CONFIG_BLK_DEV_SVWKS is not set

# CONFIG_BLK_DEV_SIIMAGE is not set

# CONFIG_BLK_DEV_SIS5513 is not set

# CONFIG_BLK_DEV_SLC90E66 is not set

# CONFIG_BLK_DEV_TRM290 is not set

CONFIG_BLK_DEV_VIA82CXXX=y

# CONFIG_IDE_ARM is not set

CONFIG_BLK_DEV_IDEDMA=y

# CONFIG_IDEDMA_IVB is not set

CONFIG_IDEDMA_AUTO=y

# CONFIG_BLK_DEV_HD is not set

```

I set hdparm -X udma5 on my HDD and hdparm -i /dev/hda says it's enabled:

```
[root:xyleron /usr/src/linux-2.6.11-rc5-nitro0] $ hdparm -i /dev/hda

/dev/hda:

 Model=ST320413A, FwRev=3.32, SerialNo=7ED0Y1QN

 Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs RotSpdTol>.5% }

 RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=0

 BuffType=unknown, BuffSize=512kB, MaxMultSect=16, MultSect=16

 CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=39102336

 IORDY=on/off, tPIO={min:240,w/IORDY:120}, tDMA={min:120,rec:120}

 PIO modes:  pio0 pio1 pio2 pio3 pio4 

 DMA modes:  mdma0 mdma1 mdma2 

 UDMA modes: udma0 udma1 udma2 udma3 udma4 *udma5 

 AdvancedPM=no WriteCache=enabled

 Drive conforms to: device does not report version:  1 2 3 4

 * signifies the current active mode

```

So yeah, I am still not getting any difference.

----------

## hds

@Xylene:

if you boot your livecd, what does "hdparm -i /dev/hda" give?

please post!

----------

## Xylene

Ok, I'll try that. BTW, someone else seemed to have the same sort of issue as me. The live cd sets DMA correctly and HDD access is much faster, but when it's installed he can't get it right: https://forums.gentoo.org/viewtopic-t-252608-highlight-via82cxxx+dma.html

----------

## Sith_Happens

 *hds wrote:*   

> he is not able to use UDMA at all. sit down, and get your facts straight! 

  :Evil or Very Mad:  His drive said it was using udma2, I was showing him how to change from udma2 to a better udma mode.

Also post the output of hdparm  /dev/hda to show what settings are enabled with the live-cd. Here is the output of hdparm /dev/hda on my machine:

```
/dev/hda:

 multcount    = 16 (on)

 IO_support   =  1 (32-bit)

 unmaskirq    =  1 (on)

 using_dma    =  1 (on)

 keepsettings =  0 (off)

 readonly     =  0 (off)

 readahead    = 256 (on)

 geometry     = 65535/16/63, sectors = 80000000000, start = 0

```

----------

## Xylene

I'll do all that as soon as a new kernel is done compiling. I am switching back gentoo-dev-sources from nitro to see if it has any affect. I did boot the live cd for a minute and noticed "dmseg | grep ide" had strangely different outputs between the live cd my installed system. On the Live CD it mentioned VIA and such, and on my installed system it just spit out numbers and some other stuff. Everything else, such as hdparm -i /dev/hda seemed the same.

----------

## Sith_Happens

Try adding ide0=ata66 to the kernel options in your grub/lilo config file.

----------

## Xylene

 *Sith_Happens wrote:*   

> Try adding ide0=ata66 to the kernel options in your grub/lilo config file.

 

Add it to the top? I am using LILO.

----------

## Sith_Happens

I think you would add a line which reads like this under your kernel image:

```
append="ide0=ata66"
```

But I don't use LILO, so I could be wrong. Also add ide0=dma and see if that does anything.

----------

## Xylene

Ok, I didn't do the thing for LILO yet, but here is hdparm /dev/hda from the Live CD.

```
/dev/hda:

 multcount    = 16 (on)

 IO_support   =  1 (32-bit)

 unmaskirq    =  1 (on)

 using_dma    =  1 (on)

 keepsettings =  0 (off)

 readonly     =  0 (off)

 readahead    =  8 (on)

 geometry     = 2434/255/63, sectors = 20020396032, start = 0

```

and here it is from my installed system:

```
/dev/hda:

 multcount    = 16 (on)

 IO_support   =  1 (32-bit)

 unmaskirq    =  1 (on)

 using_dma    =  1 (on)

 keepsettings =  0 (off)

 readonly     =  0 (off)

 readahead    = 256 (on)

 geometry     = 38792/16/63, sectors = 20020396032, start = 0

```

The only difference seems to be the readahead.

and here is dmesg | grep IDE from the live cd

```

Uniform Multi-Platform E-IDE driver Revision: 7.00beta4-2.4

VP_IDE: IDE controller at PCI slot 00:07.1

VP_IDE: chipset revision 6

VP_IDE: not 100% native mode: will probe irqs later

VP_IDE: VIA vt82c686b (rev 40) IDE UDMA100 controller on pci00:07.1

```

and here from my installed system:

```
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2

VP_IDE: IDE controller at PCI slot 0000:00:07.1

VP_IDE: chipset revision 6

VP_IDE: not 100% native mode: will probe irqs later

VP_IDE: VIA vt82c686b (rev 40) IDE UDMA100 controller on pci0000:00:07.1

Probing IDE interface ide0...

Probing IDE interface ide1...

```

..which also looks nearly the same except the live cd didn't do the probing IDE interface.... part.

----------

## Xylene

BTW, after much googling I found a bunch of info about the 3.x driver being slow, and to get the 4.3 version. I did that, but it doesn't compile, I guess it's for the 2.4 kernel, which makes sense, becuase the live cd uses that, and maybe uses that driver.

----------

## Sith_Happens

Ah, a 2.4 kernel user.  You might want to consider migrating to the 2.6 kernel, for this and other reasons.

----------

## hds

 *Xylene wrote:*   

> 
> 
> ```
> /dev/hda:
> 
> ...

 

hmm, also the geometry is completly different  :Shocked: 

----------

## Xylene

 *hds wrote:*   

>  *Xylene wrote:*   
> 
> ```
> /dev/hda:
> 
> ...

 

Whoa, I didn't see that before. That's... uh.. wtf?!

 *Sith_Happens wrote:*   

> Ah, a 2.4 kernel user.  You might want to consider migrating to the 2.6 kernel, for this and other reasons.

 

I use 2.6. I was saying the driver I found seemed to be for 2.4.

----------

## hds

 *Xylene wrote:*   

>  *hds wrote:*   
> 
> hmm, also the geometry is completly different  
> 
> Whoa, I didn't see that before. That's... uh.. wtf?!
> ...

 

hmm, looks like one of those outputs uses LBA mode, and the other does not. strange, i thought this could be set via the BIOS only  :Shocked: 

anyway, i dont think it has to do with your speedproblem.

----------

## thecrazyperson_ws

My hdparm settings are as follows:

```
/etc/conf.d/hdparm

hdb_args="-d1c1u1m16"

```

-d1 turns on DMA

-c1 turns on 32bit IO

-u1 turns on the interrups-unmask flag, which allows the driver to unmask other interrupts during the processing of a disk interrupt, which greatly improves responsiveness

-m16 turns on multisector IO (aka IDE block mode) for 16 sectors at a time

```
Tidus ~ # hdparm -d1c1u1m16 /dev/hdb

/dev/hdb:

 setting 32-bit IO_support flag to 1

 setting multcount to 16

 setting unmaskirq to 1 (on)

 setting using_dma to 1 (on)

 multcount    = 16 (on)

 IO_support   =  1 (32-bit)

 unmaskirq    =  1 (on)

 using_dma    =  1 (on)

Tidus ~ # hdparm -tT /dev/hdb       

/dev/hdb:

 Timing cached reads:   232 MB in  2.00 seconds = 115.96 MB/sec

 Timing buffered disk reads:   42 MB in  3.05 seconds =  13.79 MB/sec

Tidus ~ # 

```

This is on an old pentium 3 450mhz using the built in intel PIIXN controller.  Those same settings with a more recent PCI controller (CMD-0649 made by Silicon Image) netted me about 45Mb a second on my 120G WD Caviar that is now in the file server.

According to 'hdparm -?', setting -X is dangerous.  It does allow you to set a mode that the chipset doesn't support, therefore causing errors at best or destroying a filesystem at worst.

----------

## Sith_Happens

 *Xylene wrote:*   

> I use 2.6. I was saying the driver I found seemed to be for 2.4.

 Sorry I misread your post  :Embarassed:   *Xylene wrote:*   

> I guess it's for the 2.4 kernel, which makes sense, becuase the live cd uses that

 I belive the new live-cd's default to the 2.6 kernel, don't they?

----------

## hds

 *Sith_Happens wrote:*   

> I belive the new live-cd's default to the 2.6 kernel, don't they?

 

dunno about 2005, but 2004.x defaults to 2.4, if i am not fully mistaken here.

and - yes, i am using 2.4 over here anyway  :Razz: 

and you might rethink yours comment:

```

Ah, a 2.4 kernel user. You might want to consider migrating to the 2.6 kernel, for this and other reasons.

```

 :Laughing: 

----------

