Re: Reserving a (large) memory block

From: coder@kanga.nu
Date: Tue Sep 05 2000 - 23:45:59 EST


On Thu, 31 Aug 2000 14:09:48 +0200 (CEST)
Ingo Molnar <mingo@elte.hu> wrote:

> On Thu, 31 Aug 2000, Alan Cox wrote:

>> We then just follow the bios. You can also reserve blocks of
>> memory by hacking arch/i386/mm/init.c and marking them reserved

> in 2.4 there is an explicit interface for this that also
> guarantees that the allocation consists of fully valid RAM (no
> matter how complex the RAM map): alloc_bootmem(). We allocate
> 300MB+ worth of mem_map[] with this on multi-gigabyte boxes.

I don't see that alloc_bootmem() and friends do what I want under
2.4 in that they don't allow me to require that the
allocation/reservation occur from an explicit physical address
(there's no promise in the "goal" handling of
__alloc_bootmem_core()). It seems that the *bootmem() calls are
intended to provide a lightweight kernel heap with alloc/free
semantics rather than an interface to explicit physical memory
reservation -- no? (am I misunderstanding how bdata is handled by
__alloc_bootmem_core()?)

  Am I correct that at init time I don't have access to the (root)
filesystem? This makes total sense to me, but I'm not familiar
enough with the boot path to know for sure.

The problem I'm trying to solve:

  I have a device that sits on the memory bus. It looks like RAM
until a (module) device driver gets at it. At that point I want it
to be reserved memory (private to driver). Now I can do this in
init if I know the location of the device in memory and its size.
The problem is that to detect the device(s) and their size I use the
i2c and smbus modules. Ergo, to reserve the physical memory I need
a kernel which is pretty well fully booted (ie the heap etc is
already built) so I can load those modules and find the devices,
which means that grabbing and reserving bits of physical memory is
unsafe (because the heap etc is already built). However, if I had
access to the filesystem at init time, I could go read a file that
told me where the device(s) are and how big they are, do the
reservations, and then have the module double check the reservations
against the reality of what's installed.

  Problem is: I don't (think I) have filesystem access at init time,
and can't safely reserve specific physical memory after init which
seems to leave my only option being to pass in the reservation specs
from the bootloader, which is what rather I'm trying to avoid.

  Or am I missing something?

-- 
J C Lawrence                                 Home: claw@kanga.nu
---------(*)                                Work: claw@nuron.com
http://www.kanga.nu/~claw/        Keys etc: finger claw@kanga.nu
--=| A man is as sane as he is dangerous to his environment |=--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Sep 07 2000 - 21:00:24 EST