Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to Turn on DMA?

31 views
Skip to first unread message

rl...@ncnospam.rr.com

unread,
Jun 28, 2006, 1:52:25 PM6/28/06
to

I recently bought a new HP Presario desktop to replace my
Internet hub, reformatted the hard drive, installed
Slackware 10.2 and discovered to my sorrow that the BIOS
leaves DMA turned off after it loads the boot block of an
operating system. HP cannot help me unless I go back to
the original non-vanilla Windows-XP.

Does a Linux program exist that can be used to turn on IDE
DMA during boot?

Would very much appreciate any help. This machine, model
SR1803WM, is slow as (thin) molasses during heavy disk
operations.

--Robert Smith
rl...@nc.rr.com

Loki Harfagr

unread,
Jun 28, 2006, 2:26:55 PM6/28/06
to


Have a look on this thread :
http://groups.google.com/group/alt.os.linux.slackware/browse_frm/thread/9067720f8e3b8c49/cb33679d412cf574

In short :

the setting you want is :

hdparm -d 1 [othersettings] /dev/hda

to put in /etc/rc.d/rc.local.

But, please, beware the side effects of some special settings,
some disks get killed easy with some combinations, DMA is probably
safe as undeer Win32 it is triggered on, but don't try to go too
far on stuff like '-u' or '-A' !

Robert L. Smith, Jr.

unread,
Jun 28, 2006, 6:41:44 PM6/28/06
to
Loki Harfagr <lo...@DarkDesign.free.fr> POSTED ON Wed, 28
Jun 2006 20:26:55 +0200:

>...
>[T]he setting you want is :


>
>hdparm -d 1 [othersettings] /dev/hda
>
> to put in /etc/rc.d/rc.local.

>...

Ah, yes, "hdparm". What an interesting command! Thank you
very much for pointing it out.

Sigh. But the "-d 1" option doesn't work. It returns,
"HDIO_SET_DMA failed: Operation not permitted" and I still
have no DMA (using_dma = 0). Wonder why!

The best change seems to derive from "hdparm -c3". This
gives me about a 75% throughput improvement in buffered
disk read on both my hard drives, according to "hdparm -t".

So thank you again. But I still believe working DMA would
do even better.

--Robert Smith
rl...@nc.rr.com

alien

unread,
Jun 28, 2006, 7:34:53 PM6/28/06
to
Robert L. Smith, Jr. wrote:

> But the "-d 1" option doesn't work.

Have a look at your kernel config and ensure the IDEDMA stuff is enabled.

Damjan

unread,
Jun 28, 2006, 9:26:34 PM6/28/06
to
> Sigh. But the "-d 1" option doesn't work. It returns,
> "HDIO_SET_DMA failed: Operation not permitted" and I still
> have no DMA (using_dma = 0). Wonder why!

Some info about the disk would be nice here..
Is it a SATA or PATA disk?

--
damjan

Thomas Ronayne

unread,
Jun 28, 2006, 9:36:18 PM6/28/06
to
Are you sure you've got an IDE drive? One of the symptoms of really,
really slow disk I/O is that you've actually got a SATA running IDE
emulation (I had this same problem with a Dell Inspiron 6000). Maybe try
booting the sata.i kernel from the distribution disk (one) and see what
happens. If it boots, you might just want to rebuild using the test26.s
kernel (and then install all the packages in the 2.6 directory in
testing). The 2.6 kernel will perform much better with newish hardware
than the 2.4 kernel does. Might be worth a shot just to see.

dieymir

unread,
Jun 29, 2006, 8:24:10 AM6/29/06
to
Damjan wrote:

I have done a script to set hdparm options, maybe some of you find it
useful: (put both files, rc.hdparm and rc.hdparm.conf in /etc/rc.d)

--- rc.hdparm --------------------------------------------------------------
#!/bin/sh
# /etc/rc.d/rc.hdparm
# This script is used to optimice IDE hard disks devices.
#

############################
# READ DEVICES CONFIG FILE #
############################

# Get the configuration information from /etc/rc.d/rc.hdparm.conf:
. /etc/rc.d/rc.hdparm.conf

# Compose a list of devices from /etc/rc.d/rc.hdparm.conf (with a maximum
# of 4 devices, but you can easily enlarge the device limit)
MAXDEVS=4
i=0
disk[0]=a; disk[1]=b; disk[2]=c; disk[3]=d; disk[4]=e;
disk[5]=f; disk[6]=g; disk[7]=h; disk[8]=i; disk[9]=j;
disk[10]=k; disk[11]=l; disk[12]=m; disk[13]=n; disk[14]=o;
disk[15]=p; disk[16]=q; disk[17]=r; disk[18]=s; disk[19]=t;
disk[20]=u; disk[21]=v; disk[22]=w; disk[23]=x; disk[24]=y;
disk[25]=z;

while [ $i -lt $MAXDEVS ];
do
device[$i]=hd${disk[$i]}
i=$(($i+1))
done


if [ -x /usr/sbin/hdparm ]; then
i=0
while [ $i -lt $MAXDEVS ];
do
HDFLAGS=
if [ ! "${MULTIPLE_IO[$i]}" == "" ]; then
HDFLAGS="-qm${MULTIPLE_IO[$i]}"
fi
if [ ! "${USE_DMA[$i]}" == "" ]; then
HDFLAGS="$HDFLAGS -qd${USE_DMA[$i]}"
fi
if [ ! "${EIDE_32BIT[$i]}" == "" ]; then
HDFLAGS="$HDFLAGS -qc${EIDE_32BIT[$i]}"
fi
if [ ! "${LOOKAHEAD[$i]}" == "" ]; then
HDFLAGS="$HDFLAGS -qA${LOOKAHEAD[$i]}"
fi
if [ ! "${READAHEAD[$i]}" == "" ]; then
HDFLAGS="$HDFLAGS -qa${READAHEAD[$i]}"
fi
if [ ! "${UNMASK_IRQ[$i]}" == "" ]; then
HDFLAGS="$HDFLAGS -qu${UNMASK_IRQ[$i]}"
fi
if [ ! "${EXTRA_PARAMS[$i]}" == "" ]; then
HDFLAGS="$HDFLAGS ${EXTRA_PARAMS[$i]}"
fi
if [ -e "/proc/ide/${device[$i]}/media" ]; then
hdmedia=`cat /proc/ide/${device[$i]}/media`
if [ "$hdmedia" = "disk" ]; then
if [ ! "$HDFLAGS" == "" ]; then
echo "Setting hard drive parameters for
${device[$i]}: /sbin/hdparm $HDFLAGS /dev/${device[$i]}"
/usr/sbin/hdparm $HDFLAGS /dev/${device[$i]}
fi
fi
fi
i=$(($i+1))
done
fi
----------------------------------------------------------------------------
And now the config file:

--- rc.hdparm.conf ---------------------------------------------------------
# /etc/rc.d/rc.hdparm.conf
#
# This file contains the configuration settings for IDE disk drives.
# If you don't have a device, leave the settings null ("").
#
# WARNING !!!
#
# The kernel will autodetect the correct settings for most drives.
# Overriding these settings with hdparm can cause data corruption and/or
# data loss.
# Leave this file as it is unless you know exactly what you're doing !!
#

#
=============================================================================

# Config information for hda:

# Set this to 1 to enable DMA. This might cause some
# data corruption on certain chipset / hard drive
# combinations. This is used with the "-d" option
USE_DMA[0]="1"

# Multiple sector I/O. a feature of most modern IDE hard drives,
# permitting the transfer of multiple sectors per I/O interrupt,
# rather than the usual one sector per interrupt. When this feature
# is enabled, it typically reduces operating system overhead for disk
# I/O by 30-50%. On many systems, it also provides increased data
# throughput of anywhere from 5% to 50%. Some drives, however (most
# notably the WD Caviar series), seem to run slower with multiple mode
# enabled. Under rare circumstances, such failures can result in
# massive filesystem corruption. USE WITH CAUTION AND BACKUP.
# This is the sector count for multiple sector I/O - the "-m" option
#
MULTIPLE_IO[0]="16"

# (E)IDE 32-bit I/O support (to interface card)
# A numeric parameter can
# be used to enable/disable 32-bit I/O support: Currently sup-
# ported values include 0 to disable 32-bit I/O support, 1 to
# enable 32-bit data transfers, and 3 to enable 32-bit data trans-
# fers with a special sync sequence required by many chipsets.
# The value 3 works with nearly all 32-bit IDE chipsets, but
# incurs slightly more overhead. Note that "32-bit" refers to
# data transfers across a PCI or VLB bus to the interface card
# only; all (E)IDE drives still have only a 16-bit connection over
# the ribbon cable from the interface card.
# This is the "-c" option
#
EIDE_32BIT[0]="1"

# Enable drive read-lookahead
# This is the "-A" option
#
LOOKAHEAD[0]=""

# Set sector count for filesystem read-ahead. This is used to
# improve performance in sequential reads of large files, by
# prefetching additional blocks in anticipation of them being
# needed by the running task.
# Many IDE drives also have a separate built-in read-ahead
# function, which alleviates the need for a filesystem read-ahead
# in many situations.
# This is the "-a" option
#
READAHEAD[0]=""

# Set interrupt-unmask flag for the drive. A setting of 1 allows
# the driver to unmask other interrupts during processing of
# a disk interrupt, which greatly improves Linux's responsiveness
# and eliminates "serial port overrun" errors. Use this feature
# with caution: some drive/controller combinations do not
# tolerate the increased I/O latencies possible when this feature
# is enabled, resulting in massive filesystem corruption.
# This is the "-u" option
#
UNMASK_IRQ[0]=""

# Add extra parameters here if wanted
# On reasonably new hardware, you may want to try -X66, -X67 or -X68
# Other flags you might want to experiment with are -u1, -a and -m
# See the hdparm manpage (man hdparm) for details and more options.
#
EXTRA_PARAMS[0]=""

# Config information for hdb:
USE_DMA[1]=""
MULTIPLE_IO[1]=""
EIDE_32BIT[1]=""
LOOKAHEAD[1]=""
READAHEAD[1]=""
UNMASK_IRQ[1]=""
EXTRA_PARAMS[1]=""

# Config information for hdc:
USE_DMA[2]=""
MULTIPLE_IO[2]=""
EIDE_32BIT[2]=""
LOOKAHEAD[2]=""
READAHEAD[2]=""
UNMASK_IRQ[2]=""
EXTRA_PARAMS[2]=""

# Config information for hdd:
USE_DMA[3]=""
MULTIPLE_IO[3]=""
EIDE_32BIT[3]=""
LOOKAHEAD[3]=""
READAHEAD[3]=""
UNMASK_IRQ[3]=""
EXTRA_PARAMS[3]=""
-----------------------------------------------------------------------------
I call it from rc.S just bellow synchronizing UMSDOS file system and before
setup /etc/motd.
Improvements and other suggestions are welcomed.

Hope this helps.

Robert L. Smith, Jr.

unread,
Jun 29, 2006, 1:34:17 PM6/29/06
to
Thomas Ronayne <tr...@REMOVETHISameritech.net> POSTED ON
Thu, 29 Jun 2006 01:36:18 GMT:

>Are you sure you've got an IDE drive? One of the symptoms
>of really, really slow disk I/O is that you've actually

>got a SATA running IDE emulation ...

Thanks for all the comments and advice. Others have asked
about the drive. Here's what I see:


hdparm /dev/hda Results:
/dev/hda:
multcount = 16 (on)
IO_support = 3 (32-bit w/sync) [Since using -c3]
unmaskirq = 0 (off)
using_dma = 0 (off)
keepsettings = 0 (off)
readonly = 0 (off)
readahead = 8 (on)
geometry = 9733/255/63, sectors = 156368016, start = 0

hdparm -i /dev/hda Results:
/dev/hda:

Model=SAMSUNG SP0802N/R, FwRev=TK200-04, SerialNo=S0DJJ1NL301506
Config={ HardSect NotMFM HdSw>15uSec Fixed DTR>10Mbs }
RawCHS=16383/16/63, TrkSize=34902, SectSize=554, ECCbytes=4
BuffType=DualPortCache, BuffSize=2048kB, MaxMultSect=16, MultSect=16
CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=156368016
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 udma6
AdvancedPM=no WriteCache=enabled
Drive conforms to: (null):

* signifies the current active mode

hdparm -Tt /dev/hda Results:
/dev/hda:
Timing cached reads: 892 MB in 2.03 seconds = 439.41 MB/sec
Timing buffered disk reads: 6 MB in 3.38 seconds = 1.78 MB/sec
[above ~1.02 MB/sec before applying hdparm -c3 at boot]

dieymir

unread,
Jun 29, 2006, 4:49:05 PM6/29/06
to
Robert L. Smith, Jr. wrote:

> SAMSUNG SP0802N/R
According to Samsung that's a PATA HDD:
http://samsung.com/Products/HardDiskDrive/SpinPointPSeries/HardDiskDrive_SpinPointPSeries_SP0802N.asp

Maybe your IDE controller isn't recognized by the kernel that's why you get
such obscene low data transfer rates. Try this:
dmesg | grep IDE
and see if it outputs the name of your IDE controller, on my system I get
this:
"Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2
VP_IDE: IDE controller at PCI slot 0000:00:11.1
VP_IDE: chipset revision 6
VP_IDE: not 100% native mode: will probe irqs later
VP_IDE: VIA vt8235 (rev 00) IDE UDMA133 controller on pci0000:00:11.1
Probing IDE interface ide0...
Probing IDE interface ide1..."

To identify your actual controller try this:
lspci (as root)
On my system I get this:
"00:11.1 IDE interface: VIA Technologies, Inc.
VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)"

Seems that you are using a 2.4.x kernel, Why do you not try a 2.6.x kernel ?
They have support for more modern hardware.

Hope this helps.

Loki Harfagr

unread,
Jun 29, 2006, 3:00:09 PM6/29/06
to

This is very strange ! This kind of disk should give around 25MB/s !-)

Your HD seems to be a real IDE-PATA (133) and is configured to use
UltraDMA level 5, though you say that an :

# hdparm -d1 /dev/hda gives an error !?

Did you launch the command as root user ? (though I suppose so :-)
What is your chipset ? (VIA/Intel/?)
You'll find the chipset with 'dmesg' (dmesg |grep -i chip)

Then, you may try to include the chipset module as a kernel built-in
instead of a module, but this is a shot in the dark :-)

As a sample, if you've got a VIA chipset, check your kernel 'menuconfig'
to be something like :

[*] PCI IDE chipset support
[*] Generic PCI IDE Chipset Support
[*] Sharing PCI IDE interrupts support
[*] Generic PCI bus-master DMA support
[*] Use PCI DMA by default when available
<*> VIA82CXXX chipset support

root

unread,
Jun 30, 2006, 4:17:30 AM6/30/06
to

In my /etc/rc.d/rc.local I put:
for dev in hda hdb hdc hdd hde hdf hdg hdh
do
/usr/sbin/hdparm -c1 -d1 -u1 /dev/$dev >/dev/null 2>&1
done

To turn on dma for all my drives.

0 new messages