Re: kernel stack torture

Eric Youngdale (eric@aib.com)
Mon, 19 Feb 1996 10:07:20 -0500


>>One place to watch out is where at boot time the scsi code throws
>>on-kernel-stack buffers during the initial scsi bus probe to the
>>drivers. I ran into this quickly on the Sparc where I was assuming
>>that I could do the usual "foo_scsi_buffer - PAGE_OFFSET = physpage".
>
>This was due to the kernel memory allocation facilities being unavailble
>at boot time when I did the SCSI code. Since Linus changed the
>initialization order arround in 1.3.whatever, we should probably be doing
>GFP_DMA >kmalloc()s instead.

Actually there still is a slight dependency here - until we scan the
bus, we don't know how much DMA memory to allocate for the pool, so when we
start scanning the bus, the pool is empty. Thus we grab something off the
stack to use temporarily.

It would be relatively trivial to configure the DMA pool to contain
something like 4 or 8 Kb prior to scanning the bus, since this would
completely eliminate the problem altogether. Once we have scanned the bus,
we can reconfigure the DMA pool to the correct size (including 0, if this
would be correct). There is already some support for dynamic
reconfiguration
of the DMA pool because of the support for modules.

-Eric

-- 
"The woods are lovely, dark and deep.  But I have promises to keep,
And lines to code before I sleep, And lines to code before I sleep."