Thread: Ripping Q&A
View Single Post
Old 20th February 2006, 06:56   #10  |  Link
MrGerber
Registered User
 
Join Date: Feb 2006
Posts: 1
Fix for hidden DMA bug in Windows

I determined Windows 2000, and apparently other versions of Windows such as XP, have a feature/bug that causes Windows to slow down or stop using DMA transfers after accumulating a few I/O errors (CRC and timeout, according to Microsoft) accessing drives on the IDE bus where most DVD burners reside. This will result in much higher CPU usage during both DVD reading and writing resulting in slower performance for most PCs as 100% CPU usage struggles to move data to and from the drive.

Instruction #9 in the “Ripping Q&A”, “drive rips really slow” in this site’s Decrypting Forum advises making sure DMA is enabled in the Windows Device Manager utility, which is good advice of course. The problem is when this bug occurs, Instruction #9 to enable DMA won’t work because even when DMA is enabled in the Windows Device Manager, the OS will not fully use DMA or not use it all! In the case where enough I/O errors have accumulated to cause Windows to turn off DMA altogether, the Device Manager will show the Current Transfer Mode as PIO. If fewer I/O errors have accumulated and Windows has not yet turned DMA off and only slowed it down, no indication will appear whatsoever, anywhere! Once DMA is slowed down, or turned off in favor of PIO, it will stick in that mode – even after rebooting! Apparently, this feature was originally intended to fix hard drive problems, but becomes a nasty stealth bug for DVD readers and burners, which often encounter I/O errors from dirty or scratched discs!

In the case of my 900 MHz Pentium PC and Pioneer 16x burner, I was only getting 2.5x tops after enough I/O errors had accumulated to cause the OS to turn off DMA and switch to PIO. Prior to that, I had not seen 100% speed from my drive in a long time because prior I/O errors had been quietly knocking the DMA transfer rate down, and I had just assumed my drive was wearing out. After fixing this bug, I was able to get 100% performance from my DVD drive.

Microsoft has posted a problem report in their knowledge base: Article ID 817472. I advise following their instructions. However, like me you might find it too much trouble to call them, as suggested in the article, to get their “hotfix,” which apparently does not prevent this bug from triggering again anyway. Thus, I recommend you try the “Workaround” suggestion they provide, which requires uninstalling the IDE device driver. The driver should automatically reinstall after rebooting with a fresh start (reset) having forgotten about the accumulated I/O errors that triggered the bug. After that, you will probably need to use the Windows Device Manager Utility make sure DMA is selected for the transfer mode as suggested in Instruction #9. This procedure worked for my Windows 2000 PC.

Unfortunately, after applying the Workaround, or Microsoft’s hotfix, the bug is still present in Windows and lying in wait for more I/O errors. To make it less likely that the bug will trigger again, the registry must be edited to tell Windows to only count consecutive I/O errors instead of accumulating them. Of course, enough consecutive I/O errors are still possible with DVDs to trigger the bug again, but this will make it less likely (how much less I cannot say). I have copied Microsoft’s registry edit instructions below. If you find this registry editing too intimidating or just too much trouble, you can just skip this step and keep an eye on the performance of your drive. If you see it start to drop again, just go through the driver uninstall steps above again. I hope this helps save you the hours time I wasted debugging a slow burner.

MORE INFORMATION
The hotfix this article describes makes the following changes:

• In Windows 2000 only, read requests to ATA disks are sometimes issued with a time-out value of 4 seconds. This occurs when your computer resumes from standby. This might cause a disk time-out because drives typically take more than 4 seconds to spin up. This time-out value was changed to 10 seconds.

In Windows XP and Windows Server 2003, this time-out value is always 10 seconds.

• An alternate, less-aggressive policy is implemented 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 later in this article is present.

To implement the alternate behavior (reducing the transfer mode after six consecutive time-out or CRC errors instead of after six cumulative time-out or CRC errors), you must modify the registry as described below after you apply the hotfix.

WARNING: If you use Registry Editor incorrectly, you may cause serious problems that may require you to reinstall your operating system. Microsoft cannot guarantee that you can solve problems that result from using Registry Editor incorrectly. Use Registry Editor at your own risk.

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\Control\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\Control\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\Control\Class\{4D36E96A-E325-11CE-BFC1-08002BE10318}\0002

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

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

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\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."



<EOM>
MrGerber is offline