Re: SCSI tape buffer allocation hitting memory allocation

Simon Kirby (sim@netnation.com)
Fri, 12 Feb 1999 15:49:49 -0800 (PST)


On Fri, 12 Feb 1999, Steve Dodd wrote:
> On Fri, Feb 12, 1999 at 01:18:39PM -0800, Simon Kirby wrote:
>
> > Looking at the code, it seems to do this when scsi_init_malloc() returns
> > NULL (fails). So, I hit alt-sysreq...Sure enough, there didn't appear to
> > be any large areas free. I remembered that I saw that the floppy driver
> > once spat out that it was resorting to virtual DMA, so I thought that
> > maybe I would be able to convert scsi_init_malloc() to fall back to use
> > vmalloc() if allocation in physical memory fails. I don't know if this
>
> Erm, if the pages aren't contiguous in physical memory (=vmalloc), you can't
> DMA to them in one go, can you? (Not knowing much about it). Surely the code
> would use vmalloc() by default otherwise. Maybe the floppy driver does
> something funky to handle the vmalloc()'d memory, but on a SCSI device I'd
> imagine the performance overhead would be such that it'd be better to just
> drop the DMA buffer size back.

It seems to be something to do with the compression/decompression of the
drive. It seems almost 8 times faster to use 64kb blocks than 4kb
blocks to transfer the same data.

Hmm...it makes obvious sense that some sort of transfer from a device to
physical memory wouldn't be able to go through the page translation on the
CPU unless the CPU was doing the transfer, so it makes sense that
vmalloc()ed pages wouldn't work. I wonder what the floppy driver does,
then...

> > And I was happy...But then I ran the exact same command again and the
> > machine froze hard (even interrupts were dead -- no sysreq). So, is this
> > not possible? Is there another workaround that could be done? Is there
> > just a dumb bug in my patch (attached)?
>
> I'm guessing your SCSI controller just DMA'd over the top of something
> critical (kernel code, page table, ...).

Yeah...Probably. I was expecting this to happen anyway, but the fact that
for the three times I tested it it worked flawlessly the first time and
locked up the next time was confusing me. :)

Hmm...Maybe I could make it free lots and lots of memory until it can find
a big enough contiguous region...

Simon-

| Simon Kirby | Systems Administration |
| mailto:sim@netnation.com | NetNation Communications |
| http://www.netnation.com/ | Tech: (604) 684-6892 |

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/