Bug 39650

Summary: Digital audio extraction on an atapi CD does not use DMA even when atamode is DMA
Product: Base System Reporter: Dave Barker <dave_barker>
Component: kernAssignee: freebsd-bugs (Nobody) <bugs>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Unspecified   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
atapi-all.c.diff
none
ata.4.diff none

Description Dave Barker 2002-06-22 10:00:07 UTC
Even with atapi CD DMA turned on and working, digital audio extraction (using dagrab) still uses PIO.  Hence DAE is slow and consumes too much CPU time.
"atapi-all.c" looks at the atapi command packet and only sets up a DMA transfer for normal reads and writes.

Fix: DMA to be used to for DAE, provided DMA is enabled for the drive, and a new sysctl tunable has not been set to force PIO transfers for DAE.

Tested on several audio CDs and 2 CD readers on my Athlon system:
atapci0: <VIA 82C686 ATA100 controller> port 0xe000-0xe00f at device 17.1 on pci0
acd0: DVD-ROM <MATSHITADVD-ROM SR-8586> at ata1-master using UDMA33
acd1: CD-RW <PLEXTOR CD-R PX-W1610A> at ata1-slave using UDMA33

New tunable:
hw.ata.atapi_dae_without_dma: 0

Patch to /usr/src/sys/dev/ata/atapi-all.c:
patch to /usr/src/share/man/man4/ata.4:
How-To-Repeat: Run dagrab to extract an audio track.  Speeds will be low, and top will report little idle time and lots of interrupt time.
Before patching, I could only achieve 12x DAE on my PlexWriter 16/10/40A (Athlon 1.3GHz system) at around 100% CPU usage.
After patching, I get up to 33x (outer tracks) at around 5% CPU usage.
Comment 1 Søren Schmidt freebsd_committer freebsd_triage 2003-05-05 11:15:28 UTC
State Changed
From-To: open->closed

fixed in -current (5.1)