[3337] in linux-scsi channel archive
Re: Warning low DMA Buffers
daemon@ATHENA.MIT.EDU (Eric Youngdale)
Sun Feb 15 13:03:17 1998
Date: Sun, 15 Feb 1998 13:20:15 -0500 (EST)
From: Eric Youngdale <eric@andante.jic.com>
To: Juergen Gaertner <gaertner@mbox.si.uni-hannover.de>
cc: flavio santos <flavio@dtpdf.gov.br>, linux-scsi@vger.rutgers.edu
In-Reply-To: <34E6DB52.B062A290@mbox.si.uni-hannover.de>
Chief Luther Standing Bear - Teton Sioux
On Sun, 15 Feb 1998, Juergen Gaertner wrote:
> above DMA buffers. I got rid of it when I called "scsi_done" with interrupts
> enabled. It also seems to me, that buffers stay allocated for a while, after the
> driver has processed the command.
> Allthough WD719x is PCI-BusmasterDMA and the manual mentions that it is able to
> reach all memory up to 2^32, the driver immediatly hangs the system, if I don't
> scsi_init_malloc with the DMA-Flag. If I use kmalloc, I get rid of DMA buffer
> problem, but driver hangs if I omit "GFP_DMA". The strange thing is, that
> scsi_init_malloc itself calls kmalloc, but I read somewhere, that kmalloc won't
> work in boot process.
> Perhaps somebody can explain me, where the buffer comes from, I get in
> queuecommand function. Is this buffer above or under 16MB? The docu I found
> mentions that this depends on "unchecked ISA DMA" Flag, but I also read that
> this only affects cards on the ISA bus.
> Perhaps this is a silly question, but I'm only high-voltage engineer and not
> programmer. Maybe someone can update the famous "scsi driver writing" paper
> (dated '93 or something like this).
The buffers come from a pool that is allocated at boot time, and
possibly expanded when modules are loaded. Look for resize_dma_pool() in
scsi.c. Allocations come from scsi_malloc() and are released
by scsi_free().
When you call scsi_done(), and bounce buffers that were allocated
for the command are released. Not before. Of course you shouldn't call
scsi_done() as long as the host might be using the buffers (i.e.
transferring data via DMA), or you expose yourself to a pretty ugly race
condition.
-Eric