# How do you turn on DMA with hdparm?[SOLVED]

## cayenne

I've been searching the forums, and so far, most of my findings show how to turn it off devices....

Can someone help me with what flags to use to turn it on? From the man pages, looks like -d, but, I'm not sure, and don't want to mess up my harddrive.

For example how would you turn it on /dev/hda  it appears to be off when I do hdparm /dev/hda.

/dev/hda:

 multcount    =  0 (off)

 IO_support   =  0 (default 16-bit)

 unmaskirq    =  0 (off)

 using_dma    =  0 (off)

 keepsettings =  0 (off)

 readonly     =  0 (off)

 readahead    = 256 (on)

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

Is the command hdparm -d /dev/hda   ?

Thanks in advance.

cayenne

----------

## yabbadabbadont

hdparm -d 1 /dev/hda

Or configure it in /etc/conf.d/hdparm

----------

## cayenne

 *yabbadabbadont wrote:*   

> hdparm -d 1 /dev/hda
> 
> Or configure it in /etc/conf.d/hdparm

 

Thank you, I knew it was something like that...but, it failed. with:

hdparm -d 1 /dev/hda

/dev/hda:

 setting using_dma to 1 (on)

 HDIO_SET_DMA failed: Operation not permitted

 using_dma    =  0 (off)

Any ideas? I know these drives on the previous build had DMA turned on.....just aren't on now, and doesn't seem to want to turn on...

Thanks again for the quick reply!

C

----------

## yabbadabbadont

What is the output when you "grep -i dma /usr/src/linux/.config"?

Here is mine as an example:

```
/home/bubba $ grep -i dma /usr/src/linux/.config

CONFIG_GENERIC_ISA_DMA=y

CONFIG_ISA_DMA_API=y

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_IDEDMA=y

# CONFIG_IDEDMA_IVB is not set

CONFIG_IDEDMA_AUTO=y

# CONFIG_SCSI_PDC_ADMA is not set

```

EDIT: I assume you were either logged in as root or used su before you ran that command...

----------

## cayenne

 *yabbadabbadont wrote:*   

> What is the output when you "grep -i dma /usr/src/linux/.config"?
> 
> Here is mine as an example:
> 
> ```
> ...

 

Here is what I get:

```

grep -i dma /usr/src/linux/.config

CONFIG_GENERIC_ISA_DMA=y

CONFIG_ISA_DMA_API=y

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_IDEDMA=y

# CONFIG_IDEDMA_IVB is not set

CONFIG_IDEDMA_AUTO=y

# CONFIG_IEEE1394_SBP2_PHYS_DMA is not set

# DMA Engine support

# CONFIG_DMA_ENGINE is not set

# DMA Clients

# DMA Devices

```

From reading a bit, I ran this:

```
hdparm -I /dev/hda

/dev/hda:

ATA device, with non-removable media

        Model Number:       MAXTOR 6L040L2

        Serial Number:      662126644264

        Firmware Revision:  A93.0300

Standards:

        Used: ATA/ATAPI-5 T13 1321D revision 1

        Supported: 5 4 3 2 & some of 6

Configuration:

        Logical         max     current

        cylinders       16383   16383

        heads           16      16

        sectors/track   63      63

        --

        CHS current addressable sectors:   16514064

        LBA    user addressable sectors:   78177792

        device size with M = 1024*1024:       38172 MBytes

        device size with M = 1000*1000:       40027 MBytes (40 GB)

Capabilities:

        LBA, IORDY(can be disabled)

        bytes avail on r/w long: 4      Queue depth: 1

        Standby timer values: spec'd by Vendor, no device specific minimum

        R/W multiple sector transfer: Max = 16  Current = 0

        Recommended acoustic management value: 128, current value: 254

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

             Cycle time: min=120ns recommended=120ns

        PIO: pio0 pio1 pio2 pio3 pio4

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

Commands/features:

        Enabled Supported:

           *    READ BUFFER cmd

           *    WRITE BUFFER cmd

           *    Host Protected Area feature set

           *    Look-ahead

           *    Write cache

           *    Power Management feature set

                Security Mode feature set

           *    SMART feature set

           *    Mandatory FLUSH CACHE command

           *    Device Configuration Overlay feature set

           *    Automatic Acoustic Management feature set

                SET MAX security extension

           *    DOWNLOAD MICROCODE cmd

           *    SMART self-test

           *    SMART error logging

Security:

        Master password revision code = 65534

                supported

        not     enabled

        not     locked

        not     frozen

        not     expired: security count

        not     supported: enhanced erase

        20min for SECURITY ERASE UNIT.

HW reset results:

        CBLID- above Vih

        Device num = 0 determined by the jumper

Checksum: correct

```

See anything that stands out here?

Thanx,

cayenne    :Rolling Eyes: 

----------

## yabbadabbadont

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

It is already using udma6 mode.  Is this a SATA drive?

----------

## cayenne

 *yabbadabbadont wrote:*   

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

 

I certainly don't think so...just regular IDE drives.

I noticed on boot..that is complained that DMA wasn't on...and that fsck could be slow due to that...

That is what got me to looking into this....

I just ran a test on another drive and it shows:

```
hdparm -I /dev/hdb

/dev/hdb:

ATA device, with non-removable media

        Model Number:       WDC WD1000BB-00CAA1

        Serial Number:      WD-WMA8C3469845

        Firmware Revision:  17.07W17

Standards:

        Supported: 5 4 3 2

        Likely used: 6

Configuration:

        Logical         max     current

        cylinders       16383   16383

        heads           16      16

        sectors/track   63      63

        --

        CHS current addressable sectors:   16514064

        LBA    user addressable sectors:  195371568

        device size with M = 1024*1024:       95396 MBytes

        device size with M = 1000*1000:      100030 MBytes (100 GB)

Capabilities:

        LBA, IORDY(can be disabled)

        bytes avail on r/w long: 40     Queue depth: 1

        Standby timer values: spec'd by Standard, with device specific minimum

        R/W multiple sector transfer: Max = 16  Current = 0

        Recommended acoustic management value: 128, current value: 254

        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=120ns  IORDY flow control=120ns

Commands/features:

        Enabled Supported:

           *    READ BUFFER cmd

           *    WRITE BUFFER cmd

           *    Host Protected Area feature set

           *    Look-ahead

           *    Write cache

           *    Power Management feature set

                Security Mode feature set

           *    SMART feature set

           *    Device Configuration Overlay feature set

                Automatic Acoustic Management feature set

                SET MAX security extension

           *    DOWNLOAD MICROCODE cmd

           *    SMART self-test

           *    SMART error logging

Security:

                supported

        not     enabled

        not     locked

        not     frozen

        not     expired: security count

        not     supported: enhanced erase

HW reset results:

        CBLID- above Vih

        Device num = 1 determined by the jumper

Checksum: correct

```

Different drive...it shows udma5 for some reason. Not sure what's going on here.

cayenne      :Shocked: 

----------

## yabbadabbadont

Different drives support different modes.  Since both of them show that ultra-DMA is enabled, I wouldn't worry about it too much.  Are you using a fairly new motherboard or ide controller?  It could just be that the kernel drivers don't fully support it yet.

----------

## cayenne

 *yabbadabbadont wrote:*   

> Different drives support different modes.  Since both of them show that ultra-DMA is enabled, I wouldn't worry about it too much.  Are you using a fairly new motherboard or ide controller?  It could just be that the kernel drivers don't fully support it yet.

 

No...this is a rebuild of a box I'd had up and running about 2 years ago....

It does seem slower now than used to be....and from what I can remember, I had to set it to turn DMA on back then....but, should be supported and a straightforward.

Isn't there something on hdparm to test out the speeds? Maybe I could do that and post the results to see if it is acting normally?

----------

## cayenne

Does this look right?

```
hdparm -t /dev/hda

/dev/hda:

 Timing buffered disk reads:   10 MB in  3.05 seconds =   3.28 MB/sec

```

----------

## yabbadabbadont

 *cayenne wrote:*   

>  *yabbadabbadont wrote:*   Different drives support different modes.  Since both of them show that ultra-DMA is enabled, I wouldn't worry about it too much.  Are you using a fairly new motherboard or ide controller?  It could just be that the kernel drivers don't fully support it yet. 
> 
> No...this is a rebuild of a box I'd had up and running about 2 years ago....
> 
> It does seem slower now than used to be....and from what I can remember, I had to set it to turn DMA on back then....but, should be supported and a straightforward.
> ...

 

Strange.  You might try installing some of the other kernels that are in portage to see if one of them might help.  As for the hdparm speed test, I don't know.  Read through the man page and see if it says anything about it.

----------

## yabbadabbadont

 *cayenne wrote:*   

> Does this look right?
> 
> ```
> hdparm -t /dev/hda
> 
> ...

 

No, that looks pretty slow to me.  I can't test it on my system at the moment as I'm rebuilding firefox.  (thunderbird took about an hour...   :Rolling Eyes: )

----------

## yabbadabbadont

Ok, even while compiling I get this:

```
/home/bubba # hdparm -t /dev/hda

/dev/hda:

 Timing buffered disk reads:  116 MB in  3.01 seconds =  38.55 MB/sec

```

Drive info:

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

Edit: That is the slower of my two drives too.

----------

## i92guboj

 *cayenne wrote:*   

>  *yabbadabbadont wrote:*   hdparm -d 1 /dev/hda
> 
> Or configure it in /etc/conf.d/hdparm 
> 
> Thank you, I knew it was something like that...but, it failed. with:
> ...

 

That usually means that your chipset support is not compiled into your kernel. And the generic driver cannot use that dma mode. Please, could you let us know your chipset model and manufacturer? If you are not sure post the output of lspci (emerge lspci if needed).

By default, if your ide driver support dma, it is turned on. So, it could have been after a kernel update that you lost the support -if you ever had it-.

----------

## cayenne

 *6thpink wrote:*   

> 
> 
> That usually means that your chipset support is not compiled into your kernel. And the generic driver cannot use that dma mode. Please, could you let us know your chipset model and manufacturer? If you are not sure post the output of lspci (emerge lspci if needed).
> 
> By default, if your ide driver support dma, it is turned on. So, it could have been after a kernel update that you lost the support -if you ever had it-.

 

Thank you....from lspci, I think I have an nvidia chipset:

```
lspci

00:00.0 Host bridge: nVidia Corporation nForce2 AGP (different version?) (rev c1)

00:00.1 RAM memory: nVidia Corporation nForce2 Memory Controller 0 (rev c1)

00:00.2 RAM memory: nVidia Corporation nForce2 Memory Controller 4 (rev c1)

00:00.3 RAM memory: nVidia Corporation nForce2 Memory Controller 3 (rev c1)

00:00.4 RAM memory: nVidia Corporation nForce2 Memory Controller 2 (rev c1)

00:00.5 RAM memory: nVidia Corporation nForce2 Memory Controller 5 (rev c1)

00:01.0 ISA bridge: nVidia Corporation nForce2 ISA Bridge (rev a4)

00:01.1 SMBus: nVidia Corporation nForce2 SMBus (MCP) (rev a2)

00:02.0 USB Controller: nVidia Corporation nForce2 USB Controller (rev a4)

00:02.1 USB Controller: nVidia Corporation nForce2 USB Controller (rev a4)

00:02.2 USB Controller: nVidia Corporation nForce2 USB Controller (rev a4)

00:04.0 Ethernet controller: nVidia Corporation nForce2 Ethernet Controller (rev a1)

00:08.0 PCI bridge: nVidia Corporation nForce2 External PCI Bridge (rev a3)

00:09.0 IDE interface: nVidia Corporation nForce2 IDE (rev a2)

00:1e.0 PCI bridge: nVidia Corporation nForce2 AGP (rev c1)

01:06.0 Network controller: Intersil Corporation Prism 2.5 Wavelan chipset (rev 01)

01:08.0 Multimedia video controller: Internext Compression Inc iTVC16 (CX23416) MPEG-2 Encoder (rev 01)

01:0a.0 Multimedia audio controller: Creative Labs SB Audigy (rev 04)

01:0a.1 Input device controller: Creative Labs SB Audigy Game Port (rev 04)

01:0a.2 FireWire (IEEE 1394): Creative Labs SB Audigy FireWire Port (rev 04)

02:00.0 VGA compatible controller: nVidia Corporation NV43 [GeForce 6600/GeForce 6600 GT] (rev a2)

```

I looked in the kernel config (make menuconfig), and it does appear I have generic IDE set...I do not see a nvidia geforce ide chipset.....??

I'm using vanilla_sources  2.6.18

Any suggestions? I was trying to use a kernel to try to get my pchdtv card to work eventually....I've used gentoo_sources in the past, but, the version of them didn't appear high enough for this card I got recently.

Thanks,

cayenne

----------

## Dan

Its in there... Drivers ---- ATA/ATAPI/MFM/RLL support ------ PCI IDE Chipset support ----- AMD and nVidia IDE support

build it into the kernel

also build in 

Generic PCI bus-master DMA support

Use PCI DMA by default when avaliableLast edited by Dan on Thu Nov 09, 2006 3:30 pm; edited 1 time in total

----------

## i92guboj

The good news is that the nFoce chips are well supported by vanilla kernels -and as such, should be supported also by any other patched kernels, unless they explicitly rip that driver out, which is not likely-. This is the driver that you need (as you see, the name is not that obvious as it could be):

```

Device Drivers  ---> 

  ATA/ATAPI/MFM/RLL support  --->

    [*]     PCI IDE chipset support

    [*]       Generic PCI bus-master DMA support

    [*]         Use PCI DMA by default when available

    <*>         AMD and nVidia IDE support

```

mount /boot && make && make install modules_install && reboot

And you should be ready to go. Let us know if it works  :Smile: 

Luck and regards.

----------

## Dan

 *6thpink wrote:*   

> 
> 
> mount /boot && make && make install modules_install && reboot
> 
> .

 

I always have done 

```
make && make modules modules_install install
```

do they accomplish the same? Was yours a typo?

were you just not rebuilding the modules because he didnt add any modules to rebuild?

----------

## i92guboj

It is not needed. Plain make just makes all. You can still do "make modules" if you just want to make the modules but not the kernel itself. It is necesary to do modules_install to install them, though. 

You can still do it in a 2.4 fashion. If you do make bzImage then you WILL need to make modules as well, since the first step will only compile the kernel.

Anyway, to put modules in the command line does not harm either.

In this case, as you say, just "make && make install" should suffice. But anyway I always do it that way. Sometimes I change module settings to try this or that new feature and sometimes outdate remaining modules can drive you crazy, so, it is safe to always install the modules, since it takes a couple of seconds anyway (they are not rebuild unless it is really necessary, they are just copied to /lib/modules/$(uname -r)

----------

## cayenne

 *6thpink wrote:*   

> The good news is that the nFoce chips are well supported by vanilla kernels -and as such, should be supported also by any other patched kernels, unless they explicitly rip that driver out, which is not likely-. This is the driver that you need (as you see, the name is not that obvious as it could be):
> 
> ```
> 
> Device Drivers  ---> 
> ...

 

Geez!!

I was looking throught he menu options....and was going to swear that there was no nvidia one...looked one more time closely....and there it was.

Only think I can think of is while scanning the list...I saw the AMD, and didn't read that line any further...was looking for a line beginning with nvidia.

I'll try that one, and let you know how it goes.

By the way, when I compile, and move this to boot...do I have to rerun grub if I keep it the same name of the kernel I already have there?

tia,

c

----------

## Dan

nano -w /boot/grub/grub.conf and make sure it matches the kernel you want thats linked to /usr/src/linux

----------

## i92guboj

Assuming your current kernel is also 2.6.18.1 and the filename is the same (you used also make install to install it or you do it manually but you copy the new one over the old one) then you do not need to do a thing.

Grub reads the path to the kernel in boot time and can handle file paths, unlike lilo (lilo DO need to be reinstalled each time that a new kernel is installed or an old one is modified). So, just compiling and installing the kernel in the correct location should do. Anyway, as suggested above, double check grub.conf and make sure it is correct, and always keep a spare kernel and its matching menu entry in grub.conf, so, in case that someone goes really bad, you can boot and will not need to depend on a livecd or something like that.

Luck!

----------

## cayenne

Ok....once again, the gentoo 'gang' is great..problem solved.

Like I mentioned earlier...while scanning all the kernel options, having AMD and nvidia on the same line messed me up..as they once I read AMD, I quit reading that line and went to the next one....

I compiled that in, and hdparm /dev/hdx   now shows each drive has DMA turned on and running.

Yeah, when I do the kernel thing...I just usually do the command shown in the install docs:

make && make modules_install

I've not seen some of the options ya'll had put forth, and will need to look into it...like make install or just plain make modules....I've always done the above and moved the bzImage file to the /boot directory and changed the name to what kernel # it was....

Again, thanks!!

cayenne     :Mr. Green:   :Mr. Green:   :Mr. Green: 

----------

## i92guboj

 *cayenne wrote:*   

> 
> 
> Yeah, when I do the kernel thing...I just usually do the command shown in the install docs:
> 
> make && make modules_install
> ...

 

I dont look in the hand book since I first installed gentoo. that was around 2005.0, I think  :Razz: 

So, I can't comment on what they say. But "make install" is basically the same that you manually do when you copy the bz file to your boot directory. Additionally, make install also copies System.map and .config of the kernel you just compiled into boot. The kernel is moved to /boot/vmlinuz-<version>,  System.map and config are also saved in that same dir, with a version number attached to them. Even more, make install also creates symlinks to those three files in /boot, cale just vmlinuz, System.map and config. For those who still like to use that vmlinuz link to point to their kernel without even wanting to bother to know what is that or this kernel.

If the gentoo docs do say that you need to manually copy the kernel image, I wonder what the reason might be. I mean... if you copy the bzImage to /boot manually, why not install also the modules manually instead of using make modules_install?  :Razz:  Well, the command would be a bit longer and then you would need to run depmod, but besides that I see no difference between the two things. So I just use the kernel way for both things.

----------

## yabbadabbadont

Maybe it is because the modules are installed under /lib, which must be mounted on a running system, and the kernel goes to /boot, which may not be?  Does the "make install" of the kernel sources mount /boot if it isn't already?

----------

## i92guboj

 *yabbadabbadont wrote:*   

> Maybe it is because the modules are installed under /lib, which must be mounted on a running system, and the kernel goes to /boot, which may not be?  Does the "make install" of the kernel sources mount /boot if it isn't already?

 

I remember seeing such functionality somewhere. Maybe in gentoo-sources? Dont know. In the plain vanilla kernel it does not, at least, not now.

----------

