Log in

View Full Version : Does SCSI emulation disable DMA?


mikeX
21st January 2004, 18:12
i've noticed that cd burning in linux is very cpu hungry (60% @24x, 90% @32x, can't really go above 40x)
is it because dma is disabled for my scsi emulated drives (both my cdrw and dvd)??

i tried unloading the ide-scsi module and when i run hdparm i saw dma was still off, + i couldn't really set it on
is DMA a no no for cd/dvd devices under linux?
and even if there is a way to turn it on, would it still be on with scsi emulation?

(i suppose that also explains my longer dvd ripping times compared to winxp)

(my drives report as UDMA 2 capable for the cdrw and 4 for the dvd at startup)

(burning @32x in winxp usually doesn't go over 10% cpu)

pyt0n
21st January 2004, 19:30
im thinking this is kernel related,
well i could be wrong, but i had (u)dma
problems with 2.4.xx and since i switched
to 2.6 i havent had any problems


im really satisfied with 2.6

im running debian.

mikeX
21st January 2004, 20:12
2.4.19-GB on SuSE 8.1
but i've had similar probles with 2.4.22 on debian sarge (on another machine)

so the high cpu usage is abnormal??

i tried compiling 2.6 test 9 once on the sarge machine but it didn't even boot (probably forgot to make clean or something, didn't know much back then)

i'm running gentoo 1.4 on that other machine now and i don't even have DMA for the hard disks (probably because the kernel is configured from scratch by me :rolleyes: ), i don't see any DMA options though (except for pci ide interfases which i don't use)

TactX
21st January 2004, 20:26
Originally posted by pyt0n
im thinking this is kernel related,
well i could be wrong, but i had (u)dma
problems with 2.4.xx and since i switched
to 2.6 i havent had any problems

With 2.6 kernel you don't need scsi-emulation for ATAPI devices anymore IIRC. I think I've heard that somewhere.

MvB
21st January 2004, 21:19
@MikeX

Hi, don't try to set the dma mode for the virtual scsi device. You have to set it for the real device, e.g. hdc , hdd , hdb ...., like this:

hdparm -d 1 /dev/hdX

MvB

Daranduil
22nd January 2004, 00:20
You can check the DMA settings with hdarm:

# hdparm /dev/hda

/dev/hda:
multcount = 16 (on)
IO_support = 1 (32-bit)
unmaskirq = 1 (on)
using_dma = 1 (on) <-- this one
keepsettings = 0 (off)
readonly = 0 (off)
readahead = 256 (on)
geometry = 65535/16/63, sectors = 117304992, start = 0

Also check your demsg if you have the correct driver for your controler, in my case:

VP_IDE: VIA vt82c596b (rev 12) IDE UDMA66 controller on pci0000:00:07.1
ide0: BM-DMA at 0xd000-0xd007, BIOS settings: hda: DMA, hdb: pio
ide1: BM-DMA at 0xd008-0xd00f, BIOS settings: hdc: DMA, hdd: DMA
hda: 117304992 sectors (60060 MB) w/1945KiB Cache, CHS=65535/16/63, UDMA(66)

I set the append in my lilo like this:
append="hdc=ide-scsi hdd=ide-scsi ide0=ata66 idebus=66"

Don't know if both are necesary (ide0 and/or idebus)

mikeX
22nd January 2004, 14:44
@ Daranduil
trying what you said:

4>Kernel command line: root=/dev/hdf1 vga=791 ide0=ata66 idebus=66 hdh=ide-scsi hdg=ide-scsi
<4>ide_setup: ide0=ata66
<4>ide_setup: idebus=66
<4>ide_setup: hdh=ide-scsi
<4>ide_setup: hdg=ide-scsi
....
<4>ide: Assuming 66MHz system bus speed for PIO modes
...
<4>PDC20276: IDE controller on PCI bus 00 dev 60
<4>PDC20276: chipset revision 1
<4>PDC20276: not 100%% native mode: will probe irqs later
<4>PDC20276: (U)DMA Burst Bit ENABLED Primary MASTER Mode Secondary MASTER Mode.
<4>PDC20276: ATA-66/100 forced bit set (WARNING)!!
<4> ide0: BM-DMA at 0xdc00-0xdc07, BIOS settings: hda: pio, hdb: pio
<4> ide1: BM-DMA at 0xdc08-0xdc0f, BIOS settings: hdc: pio, hdd: pio
...
<4>VP_IDE: IDE controller on PCI bus 00 dev 89
<6>PCI: Hardcoded IRQ 14 for device 00:11.1
<4>VP_IDE: chipset revision 6
<4>VP_IDE: not 100%% native mode: will probe irqs later
<4>VP_IDE: User given PCI clock speed impossible (66000), using 33 MHz instead.
<4>VP_IDE: Use ide0=ata66 if you want to assume 80-wire cable.
<6>VP_IDE: VIA vt8233a (rev 00) IDE UDMA133 controller on pci00:11.1
<4> ide2: BM-DMA at 0xfc00-0xfc07, BIOS settings: hde: DMA, hdf: DMA
<4> ide3: BM-DMA at 0xfc08-0xfc0f, BIOS settings: hdg: DMA, hdh: DMA
<4>hdc: WDC WD2000JB-00FUA0, ATA DISK drive
<4>hde: WDC WD800JB-00CRA1, ATA DISK drive
<4>hdf: ST36421A, ATA DISK drive
<4>hdg: SONY CD-RW CRX220E1, ATAPI CD/DVD-ROM drive
<4>hdh: Pioneer DVD-ROM ATAPIModel DVD-500M B00, ATAPI CD/DVD-ROM drive
...
<6>hdc: 390721968 sectors (200050 MB) w/8192KiB Cache, CHS=24321/255/63, UDMA(100)
...
>hde: 156301488 sectors (80026 MB) w/8192KiB Cache, CHS=9729/255/63, UDMA(100)
...
>hdf: 12596850 sectors (6450 MB) w/256KiB Cache, CHS=784/255/63, UDMA(33)

...no change, and DMA was on for those drives without setting idebus or anything like that (setting only idebus=66 will give the same message as ide0=ata66 + idebus=66)

setting DMA on with hdparm doesn't really work for cd/dvd devices...it appears to be succesfull but the moment i try to read something from them it switches of(and it appears to be screwing my system badly, it hanged once, not to mention the potential damage to the devices...)

MvB
22nd January 2004, 16:01
switching on DMA with hdparm for CD/DVD works perfect for me.
I think somehow you may have a broken system?

Are you running kde while burning?
With SuSE 9.0 you have to kill SuSeplugger first before burning,
if kscd is running you'll have to kill that, too.

mikeX
22nd January 2004, 17:17
I think somehow you may have a broken system?

if you mean regarding hardware probably not cause i don't get problems with xp (though i did have problems with win2k- couldn't burn above 16x)
regarding the SuSE distro that i'm running: probably yes, it's old and at the time i set it up i knew very little about linux...
i'm gonna replace it soon (with debian sarge), just waiting to sort some things out cause i'm planning a full format/repartioning...

the speed/cpu usage ratios i mentioned at the start of this post were observed under KDE but i had similar issues with metacity/gnome and twm.. maybe cause i used frontends that require KDE libraries (cdbakeoven & k3b)

but the problem is not just with burning, i mux out on cpu if i try copying something from my cd/dvd, using either 'dd' (without mounting first) or 'cp'...
running 'hdparm -d1' is succesfull and when i run 'hdparm -i' after that, dma is on, but the moment i try using the drive the setting resets to 'off'. also 'hdparm -tT' gives ~3MB/s for both devices

i'm gonna try that 'plugger' and 'kscd' thing you mentioned later on
btw which kernel does SuSE 9.0 come with?

ferocious
25th January 2004, 14:47
AFAIK hdparm is for IDE/ATAPI devices, it's not compatible with scsi.
perhaps a grab on scsi utilities could help ?
i haven't experienced problem with ripping and burning ... yet

see http://www.torque.net/sg/ and http://www.ibiblio.org/pub/Linux/docs/HOWTO/other-formats/html_single/SCSI-Generic-HOWTO.html for more details

mikeX
25th January 2004, 19:27
@ ferocious

thanks a lot for the links, anyway i'm gonna be formating real soon and i'll probably use the 2.6 kernel on my new installation without scsi emulation (already tried it on the gentoo machine, it worked but the burning proccess was really weird, way too many buffer underuns and avg speed was dissapointing - plex 24/10/40)

but DMA works (cpu usage never went above 6%)

juicemansam
26th January 2004, 07:09
Originally posted by mikeX
anyway i'm gonna be formating real soon and i'll probably use the 2.6 kernel on my new installation without scsi emulation (already tried it on the gentoo machine, it worked but the burning proccess was really weird, way too many buffer underuns and avg speed was dissapointing - plex 24/10/40)
Just giving you a heads up on CD-Writer issues with the 2.6 kernel. Since all CD writing programs use Schilling's SCSI library to access the drives, that makes all ATAPI (IDE) drives dependent on ide-scsi emulation. Changes in the 2.6 kernel try to eliminate the dependency on what Linus and others call, a 'broken' sub-system, thus allowing for the user to use either native ATAPI or native SCSI, depending on their needs. Unfortunately none of the current CD writing programs use the ATAPI interface; only cdrecord, through a patch (I read).

From my experience, none of the programs that I've used, cdrecord and cdrdao, allow using devices like '/dev/hdb' as a CDR device (cdrecord might have, but don't recall), because it is not a SCSI device. In other words, the IDE device does not respond when called by a SCSI name like '0,0,0', which is what most programs like to do.

Good-luck.

mikeX
26th January 2004, 15:09
@ juiceman

yeah i had doubts about whether it was the kernel or the app that really made the difference, but from what you said (and from what cdrecord says , it's up to the application)

the 2.01a23 version of cdrecord i'm running on gentoo supports it:
cdrecord -dev=ATAPI:/dev/hd... (i think you can also use ATAPI:0,0,0)

but hopefully future apps will make use of this kernel feature in a more efficient way