DMA Lab

Due: 4/26/05

 You are to obtain a copy of the Knoppix CD-ROM Linux distribution and experiment with it. Knoppix will boot on either a laptop or a desktop machine. It will provide a complete version of the Linux operating environment which includes the Linux OS, a graphical user environment, hundreds of applications and full support for networking and other equipment. Note that due to the newness of some equipment, it might be impossible for Knoppix to include drivers for it and you might not have full functionality of your software.

 This assignment deals with DMA. You will be experimenting with actually enabling and disabling DMA on your computer to see the effects of it on CPU usage.

 

This lab makes use of the hdparm command under linux. Commands in Linux are fairly straightforward. You type the name of the command followed by any options followed by the parameters of those options. For example, "hdparm /dev/hda" executes the hdparm command on the hard drive specified as /dev/hda. If you are taken the 2601 or 2611 classes then this should look familiar to you.

hdparm is a command that allows us to talk directly to the IDE hard drive driver in Linux and ask it to change settings in that driver. We will use this to instruct the driver to turn DMA on and off. We will then also use this command to execute benchmarking tests to evaluate the performance of moving data to the hard drive with various levels and types of DMA turned on and turned off. We are using Linux to do this instead of windows because:

1) The Windows driver doesn't provide a nice interface for doing this. Thus this way is more flexible.

2) This has the chance of screwing up and causing your machine to hang if an unsupported DMA mode is selected. By doing it on Linux running out of RAM, we can always reboot the machine to restore it to normal without hurting your Windows install on your machine. Thus its safer.

You will need to login to the Linux system as the super user. That account is named "root". If you are in Graphical Mode when the system boots up then you will need to start  a command line interpreter so that you can work properly. You can do this by clicking on the picture of the sea shell a the bottom of the screen.  That will open up a window with a command line interpreter running in it. While logged in as superuser, you will need to use the “hdparm” command. You can find detailed info on the command with the “man hdparm” command. “Man” is the online manual system for UNIX machines such as Linux.

First you should attempt to determine the default state of the DMA capabilities of the hardware in your laptop. you can do this by typing the command hdparm /dev/hda. this command will show you the default settings for the hard drive controller. An example of that output is:

/dev/hda:
             multcount = 16 (on)
            IO_support = 0 (default 16-bit)
            unmaskirq = 0 (off)
            using_dma = 1 (on)
            keepsettings = 0 (off)
            readonly = 0 (off)
            readahead = 256 (on)
            geometry = 30515/255/63, sectors = 251000193024, start = 0

Next we will do the command hdparm -i /dev/hda

/dev/hde:

        Model=Maxtor 6Y250P0, FwRev=YAR41BW0, SerialNo=Y637STSE
        Config={ Fixed }
        RawCHS=16383/16/63, TrkSize=0, SectSize=0, ECCbytes=57
        BuffType=DualPortCache, BuffSize=7936kB, MaxMultSect=16, MultSect=16
        CurCHS=16383/16/63, CurSects=16514064, LBA=yes, LBAsects=268435455
        IORDY=on/off, tPIO={min:120,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=yes: disabled (255) WriteCache=enabled
        Drive conforms to: (null): 

        * signifies the current active mode

The "-i" option tells hdparm to give all the info about the default settings of the hard drive specified. "/dev/hda" is the hard drive unit named "A". Linux names hard drives differently than windows. Windows names hard drives alphabetically starting at "A". A and B are traditionally floppy drives. C-Z are combinations of hard drives and CD-ROM drives.  Since most of you are using hard drives with only one hard disk in them the name of the disk should be "/dev/hda".  The command hdparm has many options. You will be using a few of them. You can get the entire list of commands by using the online manual built in to Linux. 

The “-t” option is used to enable testing mode for I/O bandwidth including both the hard drives cache and the actual hard drive media itself.  E.g hdparm -t /dev/hda

 The “-T” option is used to enable testing mode for I/O bandwidth to the hard drive cache but NOT to the hard drive media itself. e.g hdparm -T /dev/hda

 The “-t” and “-T”  when used together will do a compensation factor for the “-T” that takes into account the “-t” option. e.g. hdparm -t -T /dev/hda

 The option “-dX” where X can be either a zero or a one is used to disable or enable DMA on a particular hard drive respectively. The name of your hard drive will most likely be “/dev/had”. e.g. hdparm -d0 /dev/hda or hdparm -d1 /dev/hda

 The “-X” option is used to specify the type of DMA that is used if DMA is enabled. Types are:  sdma1, sdma2, udma2, udma4, mdma2, mdma4. e.g. hdparm -Xsdma /dev/hda  or  hdparm -Xudam4 /dev/hda

         Sdma is Simple DMA and is the basic DMA system used on PCs

        Udma is Ultra DMA and is used on hard drives that use the ATA33/66 I/O systems

        Mdma is multii-word DMA and is used on drives that have multi-word I/O enabled.

 

You will perform several tests and record the results. You will then compare the results and attempt to explain them.

 You should attempt to do all combinations of DMA being enabled/disabled along with the types of DMA.  You will also want to disable DMA to see the difference in performance as well.

 For any test you perform, you will want to repeat it at least 10 times and average the results so that you can account for variances due to uncontrollable issues with your operating system running multiple programs at the same time.