Re: Module loading (2.0.24) fails with "Unable to allocate DMA memory"

Gerard Roudier (groudier@club-internet.fr)
Thu, 7 Nov 1996 22:25:28 +0000 (GMT)


On Wed, 6 Nov 1996, Jean Francois Martinez wrote:

> Date: Tue, 5 Nov 1996 22:41:34 +0000 (GMT)
> From: Gerard Roudier <groudier@club-internet.fr>
> X-Sender: groudier@localhost
> cc: linux-kernel@vger.rutgers.edu
> MIME-Version: 1.0
> Content-Type: TEXT/PLAIN; charset=US-ASCII
>
>
> On Mon, 4 Nov 1996, Jean Francois Martinez wrote:
>
> >
> > When trying to load the floppy module I got "Unable to allocate DMA
> > memory". Kernel 2.0.24. Exiting a couple of programs returns things
> > to normal. In a general way when loading a module we need DMAable
> > memory (ie physically contiguous and under 16 Megs barreer) but we are
> > not under time pressure. Linux should be able to swap out some
> > process in order to get space for its DMA memory. I don't know if the
>
> Initial allocations are generally done with GFP_ATOMIC priority.
> With that priority, it is not possible to wait for swapping, so such
> allocation may fail. A driver that need memory must be able to try
> later its memory allocations. If it is not able to do that, it is buggy.
> That is my opinion.
>
> I disagree on the soundnes of GFP_ATOMIC, we are starting a module, we
> are not under time pressure I don't see the need why we deprive us of
> the possibility of make room by swapping, it is not like when we must
> serve an interrupt.

You are probably right in theory, but it seems to me that lots of GFP_ATOMIC
allocations are done, probably unnecessarily.
I am not a guru in architecture. However it seems to me that
physically contiguous allocations larger that 1 page should be avoided.

User spaces are virtually contiguous but not necessarily physically
contiguous. I would prefer that large buffers in the kernel could be
allocated virtually.
A scatter/gather process will then obviously be necessary for doing (PCI)
(or ISA) dma. With controllers that are able to accept scatter/gather(ed)
data that would have a very weak effect on performances.

It seems to me that vmalloc() has the appropriate semantic. But I am not
sure that it is possible in a portable way to break such vmalloced memory
into physical memory segments.
I would appreciate a lot some explanations from our famous gurus.

About ISA bus, in my opinion, this technology is obsolete and modern OSes
should manage such middle aged things in a way that will not pollute the
code of the system.
I think that all ISA/DMA hacks added to the kernel are useless and I imagine
(wrongly?) that Linus was not happy to add such things to the kernel.

In order to still support ISA dma, the right thing is, I think, to
use double buffering (if necessary) at a very low level. The low level
drivers are the right candidates. A pool of ISAable memory can be
allocated at system startup. That would allow to have a cleaner kernel.

> > problem is: Linux is supposed to make space but doesn't or if the DMA
> > memory category does not fit and we need a GFP_DMAABLE category where
> > we try to get memory fit for DMA but we can swap.
>
> Using modules is great and allow us to spare memory and to have a shorter
> kernel. However, ve must be aware that some drivers may have problems of
> memory shortage when they are loaded. It is indeed the case for those
> which need contiguous memory at initialisation or use ISA DMA.
>
> The real importance of modules is: allowing the authors of
> distributions to make installations where you can prescind of kernel
> recompiling. As long as you have to recompile your kernel just after
> installing, Linux will be an operating system for people with ten yars
> of experience in computing. And there is a limited supply of them
>
> ISA DMA is in my opinion some kind of bottleneck and may decrease
> performances a lot. Use PCI interfaces each time it is possible for you.
>
> They are very few 386DX with PCI bus! Yes that is my box for now :(
> and that is the kinds of things who make me consider upgrading to
> MkLinux (that is switching to Mac). But now Linux is getting its
> share of commercial or half-commercial software and this is for Intel.
> If only there was a compiler for translating Intel binaries to PowerPC
> (I saw that kinfof things for translating to Alpha, free but
> unfortunately for NT) then it would be Intel outside!
>
> Gerard.
>
> Ah did you notice I am french?

Oui, bien sur.
Simplement je profite de l'occasion pour mettre sur le tapis certaines
choses qui me tracassent dans le noyau Linux et que je souhaiterais voir
ameliorer.

> --
>
> Jean Francois Martinez
>
> -What is the operating system used by Bill Gates?
> -Linux of course. Do you think stupid people become millionnaire?
>

Gerard.