Solved:HDD UDMA mode to PIO Mode Causing Performance Drop

Discussion in 'Laptop Hardware' started by ksameh, Sep 23, 2008.

  1. ksameh

    ksameh

    Joined:
    Aug 27, 2008
    Messages:
    3
    Likes Received:
    0
    My A150 suddenly was crawling like a tortoise.Hibernation took 3 minutes to complete..

    I tried disabling every imaginable service..No luck..Bench 32 gave me 1.8 MB/s on the 120 GB Sata HDD..
    1 week earlier it was 30 MB/s
    When i bought the machine it was around 49 MB/s

    i thought my hardware went bust..
    then i found that my hdd was set to PIO mode which was very weird..
    i tried uninstalling the controller from the device manager .then the system installed it automatically after a restart..

    Problem was solved..
    It guess that the low power battery is causing this problem..It happened to me after my A150 went very hot while watching a movie..


    This is quoted from http://www.erodov.com/community/showthread.php?t=7912

    Hard disk UDMA mode to PIO Mode Causing Performance Drop - Solution
    At the outset I would like to say that I have borrowed heavily for this article from various pages. In case you want the detailed articles please go the url listed below:

    PCGuide - Ref - IDE/ATA Transfer Modes and Protocols
    Microsoft Help and Support


    Also to add that this is applicable for IDE and SATA drives (on Intel chipset based boards), because on Intel Chipset based board SATA controllers are shown as IDE controllers and SATA drives use UDMA. I am not sure about Nvidia Chipsets based boards.

    THE BASICS:

    Before we get into the problem we first need understand a little bit on data Transfer Mechanisms. There are basically 2 ways in which data is sent and received from your drives (hard disk and optical drives)

    1. Programmed I/O (PIO)

    The oldest method of transferring data over the IDE/ATA interface is through the use of programmed I/O. This is a technique whereby the system CPU and support hardware directly control the transfer of data between the system and the hard disk. There are several different speeds of programmed I/O, which are of course called programmed I/O modes, or more commonly, PIO modes.

    PIO Mode 0 - 3.3 MB/s
    PIO Mode 1 - 5.2 MB/s
    PIO Mode 2 - 8.3 MB/s
    PIO Mode 3 - 11.1 MB/s
    PIO Mode 4 - 16.7 MB/s

    Not only does PIO involve a lot of wasteful overhead, the CPU is "distracted" from its ordinary work whenever a hard disk read or write is needed. This means that the more data the system must transfer, the more the CPU gets bogged down. As hard disk transfer rates continue to increase, the load on the CPU would have continued to grow. This is the key reason why PIO modes are no longer used on new systems, having been replaced by DMA modes, and then later, Ultra DMA.

    2. Direct Memory Access (DMA)

    As described above PIO as a method of transferring data between the hard disk and the rest of the system has a serious flaw: it requires a fair bit of overhead, as well as the care and attention of the system's CPU. Clearly, a better solution is to take the CPU out of the picture entirely, and have the hard disk and system memory communicate directly. Direct memory access or DMA is the generic term used to refer to a transfer protocol where a peripheral device transfers information directly to or from memory, without the system processor being required to perform the transaction. DMA has been used on the PC for years over the ISA bus, for devices like sound cards and the floppy disk interface.

    To cut a long story short the DMA technology advanced as follows:

    Single Word DMA --> MultiWord DMA --> Ultra DMA

    More details on each can be found at Direct Memory Access (DMA) Modes and Bus Mastering DMA

    The key technological advance introduced to IDE/ATA in Ultra DMA was double transition clocking. Before Ultra DMA, one transfer of data occurred on each clock cycle, triggered by the rising edge of the interface clock (or "strobe"). With Ultra DMA, data is transferred on both the rising and falling edges of the clock. Double transition clocking, along with some other minor changes made to the signaling technique to improve efficiency, allowed the data throughput of the interface to be doubled for any given clock speed.

    In order to improve the integrity of this now faster interface, Ultra DMA (UDMA) also introduced the use of cyclical redundancy checking or CRC on the interface. The device sending data uses the CRC algorithm to calculate redundant information from each block of data sent over the interface. This "CRC code" is sent along with the data. On the other end of the interface, the recipient of the data does the same CRC calculation and compares its result to the code the sender delivered. If there is a mismatch, this means data was corrupted somehow and the block of data is resent.

    Today, the use of Ultra DMA is the standard in the industry. Transfer rates on the Ultra DMA modes are :

    UDMA Mode 0 - 16.7 MB/s
    UDMA Mode 1 - 25.0 MB/s
    UDMA Mode 2 - 33.3 MB/s
    UDMA Mode 3 - 44.4 MB/s
    UDMA Mode 4 - 66.7 MB/s
    UDMA Mode 5 - 100 MB/s


    THE PROBLEM -

    The typical symptoms seen are:
    1. Major Drop in System performance
    2. Increased CPU usage but this cannot be attributed to any process in Task Manager. Thought to be a virus/spyware, but scans show a clean system.
    3. Occassional PC crash - again no reason

    THE CAUSE:

    1. The hard disk (generally the root disk containing the OS) is using the PIO mode for data transfer. As from our abouve discussion we know that hard disks should use UDMA 4 or 5 for data transfer.

    THE DIAGNOSIS:

    1. Use a hard disk benchmarking utility like HDTune and test the disk. The transfer rates would have fallen to 3-4 MB/s and the CPU utilization would be around 20-25%
    2. To confirm the problem do the following :
    - Double-click Administrative Tools, and then click Computer Management.
    - Click System Tools, and then click Device Manager.
    - Expand the IDE ATA/ATAPI Controllers node.
    - Double-click the controller (typically Primary IDE Channel) for which you want to check.
    - Here go to Advanced Settings and check the Value of Current Transfer Mode (It will be PIO)

    THE REASON:

    So why does the controller shift from UDMA to PIO mode on its own?

    For this we have to thank Microsoft. Well windows is designed such that if the Windows IDE/ATAPI Port driver (Atapi.sys) receives a cumulative total of six time-out or cyclical redundancy check (CRC) errors, the driver reduces the communications speed (the transfer mode) from the highest Direct Memory Access (DMA) mode to lower DMA modes in steps. If the driver continues to receive time-out or CRC errors, the driver eventually reduces the transfer mode to the slowest mode (PIO mode). And the worst part is that there is not straightforward way to make it go back to UDMA mode.

    WORKAROUND - How to move transfer mode from PIO back to UDMA

    To re-enable the UDMA mode for an affected device:
    1. Double-click Administrative Tools, and then click Computer Management.
    2. Click System Tools, and then click Device Manager.
    3. Expand the IDE ATA/ATAPI Controllers node.
    4. Double-click the controller (typically Primary IDE Channel) for which you want to restore the typical DMA transfer mode.
    5. Click the Driver tab.
    6. Click Uninstall.
    7. When the process completes, restart your computer. When Windows restarts, the hard disk controller is re-enumerated and the transfer mode is reset to the default value for each device that is connected to the controller.

    How to ensure that this does not repeat or atleast not as frequently

    Microsoft realising the problems faced by its customers provided a way by which a lesser aggresive policy is used when downgrading transfer modes.

    MS provided a way to make windows take a less-aggressive policy to reduce the transfer mode (from faster to slower DMA modes, and then eventually to PIO mode) on time-out and CRC errors. The existing behavior is that the IDE/ATAPI Port driver (Atapi.sys) reduces the transfer mode after any 6 cumulative time-out or CRC errors. When the new policy is implemented by this fix, Atapi.sys reduces the transfer mode only after 6 consecutive time-out or CRC errors. This new policy is implemented only if the registry value that is described below is present.

    Follow these steps, and then quit Registry Editor:
    1. Click Start, click Run, type regedit, and then click OK.
    2. Locate and then click the following key in the registry:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0001
    3. On the Edit menu, point to New, and then click DWORD Value.
    4. Type ResetErrorCountersOnSuccess, and then press ENTER.
    5. On the Edit menu, click Modify.
    6. Type 1, and then click OK.
    Follow these steps, and then quit Registry Editor:
    1. Click Start, click Run, type regedit, and then click OK.
    2. Locate and then click the following key in the registry:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0002
    3. On the Edit menu, point to New, and then click DWORD Value.
    4. Type ResetErrorCountersOnSuccess, and then press ENTER.
    5. On the Edit menu, click Modify.
    6. Type 1, and then click OK.
    Note The numbered subkeys that are listed earlier correspond to the primary and secondary IDE channels on a computer that contains a single IDE controller. If your computer contains two IDE controllers, the numbered subkeys for the primary and secondary IDE channels for each of the two controllers may be:
    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0002

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0003

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0004

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Contro l\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0005
    To verify that you have located the correct subkey, verify that the DriverDesc value for the subkey contains the string value "Primary IDE Channel" or the string value "Secondary IDE Channel."

    WARNING:

    Please note that if you disk is repeatedly moving to PIO mode then there is an issue with the Hard Disk or the Disk Cable or the power Supply. Hard disks are very sensitive to Power Supply variations.. typically if you start facing Hard Disk problems and your disk is not that old then the culprit is usually the power supply. So if your disk is repeatedly moving to PIO mode.. its time to get a new disk or a new PSU or maybe a new data cable.

    Hope you all found the article interesting and useful.
     
    ksameh, Sep 23, 2008
    #1
  2. ksameh

    ccwh

    Joined:
    Aug 29, 2008
    Messages:
    55
    Likes Received:
    0
    Location:
    France
    Thanks for this post. ;)
    Very good informations !

    Last week my HD speed was near 1.5Mo/sec. I fix the problem alone, but your post give me the reason of the slow speed of my harddrive.
     
    ccwh, Dec 6, 2008
    #2
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.