allocating memory at boot

Philip Downer phil at pjd.me.uk
Wed Feb 16 13:15:28 EST 2011


Hi folks,

I'm currently trying to port a (currently for unreleased hardware and 
under nda) driver from x86 to arm and in doing so I've run into a 
problem with allocating memory using pci_alloc_consistent. Looking into 
it I can't allocate more than 1MB whereas I need to allocate at least 
2MB of contiguous memory. Looking further into it, the conventional 
method to get around this at the moment seems to be to statically link 
the driver into the kernel and use alloc_bootmem or alloc_bootmem_low 
(mentioned in ldd3 and all over google).

The problem I've run into however is that I get a warning at boot which is:

WARNING: at mm/bootmem.c:672 alloc_arch_preferred_bootmem+0x34/0x64()

Looking at that code in bootmem.c this is a warning which I think is 
there to tell me that SLAB is available and warn against trying to 
allocate at boot. However it reportedly allocates the memory but when 
the driver tries to use this memory later, then the system hangs.

Is alloc_bootmem currently the correct way to get memory allocated at 
boot or is there a different call I should be using. Alternatively have 
I done something wrong by using alloc_bootmem as a drop-in replacement 
for pci_alloc_consistent? I've tried to grep the kernel sources for 
other drivers that use alloc_bootmem but there aren't many which appear 
in the listing and I find this strange for a technique which is referred 
to a lot.

Thanks,

Phil



More information about the Kernelnewbies mailing list