[Top] [All Lists]

Re: use bootmem in platform code on MIPS

To: Ralf Baechle <>
Subject: Re: use bootmem in platform code on MIPS
From: Manuel Lauss <>
Date: Wed, 28 Apr 2010 18:28:45 +0200
Cc: Linux-MIPS <>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed;; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=Ouys47hPXaT1rhuQPbyKaHeT4L/3PPgWchffNiYzp0M=; b=dzpNiov7b0pgdqmsCb6J2TOv3a7HyZikOkzTL8jSHPO0PhA0cVs7OqylCwN0n7vRWh zdzRRbvzCi8p/ZdYkkL4i/+sobhZpQLc/w0mvpfMvYyXreXPUqKGzDEgATRysXPcDCzu 41vRIm7bRYPh1HXDh6SA2PcYpslLr9vc52yJo=
Domainkey-signature: a=rsa-sha1; c=nofws;; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=uXTCinJoNHK5nd/U9K6cnuWRRCsXL6r3sdQDZB1fDFrK5P3q/TMPyMaHgTT0UWhaKF d9okCHaggWUxhWoYXGOFpXyjurTVlTh0hWxuWdfv6Wx2RkqNpM2eIj7h7vZ//PhL3zWx TpgcMtE434yqiM6nqMCFVVzArOyNJEGK7fVAk=
In-reply-to: <>
Original-recipient: rfc822;
References: <> <>
On Wed, Apr 28, 2010 at 5:54 PM, Ralf Baechle <> wrote:
> On Tue, Apr 27, 2010 at 02:14:32PM +0200, Manuel Lauss wrote:
>> I'd like to use bootmem to reserve large chunks of RAM (at a particular 
>> physical
>> address; for Au1200 MAE, CIM and framebuffer, and later Au1300 OpenGL block)
>> but it seems that it can't be done:  Doing __alloc_bootmem() in
>> plat_mem_setup() is
>> too early, while an arch_initcall() is too late because by then the
>> slab allocator is
>> already up and handing out random addresses and/or refusing allocations 
>> larger
>> than a few MBytes.
> The maximum is actually configurable.  CONFIG_FORCE_MAX_ZONEORDER defaults
> to 11 which means with 4kB pages you get 8MB maximum allocation - more for
> larger pages.

I already had to modify it for large display resolutions.

> CONFIG_FORCE_MAX_ZONEORDER is a tradeoff though.  A smaller value will give
> slightly better performance and safe a bit of memory but I can't really
> quantify these numbers - I assume it's a small difference.
> It may actually be preferable to never tell the bootmem allocator about the
> memory you need for these devices that is bypass the mm code entirely.

Do you mean by not adding the whole RAM area with add_memory_region()?
Can I give the memory back later (if it's not required)?  Right now I think with
bootmem that is actually possible.

>> Is there another callback I could use which would allow me to use bootmem 
>> (short
>> of abusing plat_smp_setup)?
>> Would a separate callback like this be an acceptable solution?
> Certainly better than using plat_smp_setup which would require enabling
> SMP support for no good reason at all.
> I know we will eventually have to add another platform hooks to run after
> bootmem_init.  The name of plat_mem_setup() already shows what this hook
> originally was meant for but it ended up as the everything-and-the-kitchen-
> sink hook for platform-specific early initialization.  I just dislike

The comment above arch_mem_init() too mentions a separate function.

> conditional hooks.  Let's add a call to a new hook function and fix whatever
> breaks or think about what other hooks needs there should be.

Okay, I'll cook something up.

Thank you,
        Manuel Lauss

<Prev in Thread] Current Thread [Next in Thread>