All of lore.kernel.org
 help / color / mirror / Atom feed
From: Larry Bassel <lbassel@codeaurora.org>
To: Colin Cross <ccross@google.com>
Cc: Larry Bassel <lbassel@codeaurora.org>,
	linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org
Subject: Re: how can I cleanly exclude memory from the kernel memory allocator?
Date: Fri, 25 Mar 2011 10:37:12 -0700	[thread overview]
Message-ID: <20110325173712.GC29359@labbmf-linux.qualcomm.com> (raw)
In-Reply-To: <AANLkTinKketbDZ87Qp400uzSBv5t3bF9azJgXqbwudL9@mail.gmail.com>

On 24 Mar 11 16:14, Colin Cross wrote:
> On Thu, Mar 24, 2011 at 3:18 PM, Larry Bassel <lbassel@codeaurora.org> wrote:
> > I want to (early in system initialization) exclude some
> > contiguous physical memory from one or more memory banks
> > so that it won't be mapped in the normal kernel 1-to-1 mapping
> > (so that it can be mapped uncached, strongly ordered, etc.
> > as needed -- I know that it is forbidden to have a cached
> > and an uncached mapping to the same memory) and so that it
> > won't be freed into the kernel memory allocator (so that
> > it won't fragment and can be allocated using genalloc).
> >
> > I have tried to find a clean way to do this, but none of
> > the approaches I've considered seem very good:
> >
> > 1. Add a hook to the memory tag parsing routine to (possibly)
> > change each tag before arm_add_memory() is called,
> > or alter arm_add_memory() itself.
> > 2. Add a hook at the beginning of paging_init() to inspect
> > and alter the meminfo memory bank starts and sizes as needed.
> > 3. Wait until after the memory is added to the normal
> > kernel memory pool and somehow get it back out
> > (I can't use alloc_bootmem() or related functionality of course
> > since then the memory will be part of the cached kernel 1-to-1 1M
> > page mapping, precluding use of ioremap() on it).
> >
> > A further drawback for #1 is that I'd really like to
> > see all of the available memory banks before deciding which
> > memory to steal (we often have multiple memory banks on
> > our platforms).
> >
> > Perhaps there is a solution for this problem that already exists
> > that I'm unaware of (or at least community consensus about how
> > one should add this functionality).
> >
> > I believe Russell King has stated that he intends
> > to carve out memory that can be used for dma_alloc_coherent(),
> > that won't be mapped otherwise by the kernel.
> >
> > I'd like to know how he is planning to do this, as I could hopefully
> > do something similar.
> >
> > Thanks.
> >
> > Larry Bassel
> 
> You want memblock_remove, called from the new .reserve machine entry
> function.  See arch/arm/plat-omap/devices.c for an example.

Yes, this is effectively my option #2 (reserve memory after the tags
are parsed and before paging_init). This looks like a good approach.

Thanks.

Larry

> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

WARNING: multiple messages have this Message-ID (diff)
From: lbassel@codeaurora.org (Larry Bassel)
To: linux-arm-kernel@lists.infradead.org
Subject: how can I cleanly exclude memory from the kernel memory allocator?
Date: Fri, 25 Mar 2011 10:37:12 -0700	[thread overview]
Message-ID: <20110325173712.GC29359@labbmf-linux.qualcomm.com> (raw)
In-Reply-To: <AANLkTinKketbDZ87Qp400uzSBv5t3bF9azJgXqbwudL9@mail.gmail.com>

On 24 Mar 11 16:14, Colin Cross wrote:
> On Thu, Mar 24, 2011 at 3:18 PM, Larry Bassel <lbassel@codeaurora.org> wrote:
> > I want to (early in system initialization) exclude some
> > contiguous physical memory from one or more memory banks
> > so that it won't be mapped in the normal kernel 1-to-1 mapping
> > (so that it can be mapped uncached, strongly ordered, etc.
> > as needed -- I know that it is forbidden to have a cached
> > and an uncached mapping to the same memory) and so that it
> > won't be freed into the kernel memory allocator (so that
> > it won't fragment and can be allocated using genalloc).
> >
> > I have tried to find a clean way to do this, but none of
> > the approaches I've considered seem very good:
> >
> > 1. Add a hook to the memory tag parsing routine to (possibly)
> > change each tag before arm_add_memory() is called,
> > or alter arm_add_memory() itself.
> > 2. Add a hook at the beginning of paging_init() to inspect
> > and alter the meminfo memory bank starts and sizes as needed.
> > 3. Wait until after the memory is added to the normal
> > kernel memory pool and somehow get it back out
> > (I can't use alloc_bootmem() or related functionality of course
> > since then the memory will be part of the cached kernel 1-to-1 1M
> > page mapping, precluding use of ioremap() on it).
> >
> > A further drawback for #1 is that I'd really like to
> > see all of the available memory banks before deciding which
> > memory to steal (we often have multiple memory banks on
> > our platforms).
> >
> > Perhaps there is a solution for this problem that already exists
> > that I'm unaware of (or at least community consensus about how
> > one should add this functionality).
> >
> > I believe Russell King has stated that he intends
> > to carve out memory that can be used for dma_alloc_coherent(),
> > that won't be mapped otherwise by the kernel.
> >
> > I'd like to know how he is planning to do this, as I could hopefully
> > do something similar.
> >
> > Thanks.
> >
> > Larry Bassel
> 
> You want memblock_remove, called from the new .reserve machine entry
> function.  See arch/arm/plat-omap/devices.c for an example.

Yes, this is effectively my option #2 (reserve memory after the tags
are parsed and before paging_init). This looks like a good approach.

Thanks.

Larry

> --
> To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
> the body of a message to majordomo at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

-- 
Sent by an employee of the Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum.

  reply	other threads:[~2011-03-25 17:37 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-24 22:18 how can I cleanly exclude memory from the kernel memory allocator? Larry Bassel
2011-03-24 22:18 ` Larry Bassel
2011-03-24 23:14 ` Colin Cross
2011-03-24 23:14   ` Colin Cross
2011-03-25 17:37   ` Larry Bassel [this message]
2011-03-25 17:37     ` Larry Bassel
2011-03-24 23:27 ` Nicolas Pitre
2011-03-24 23:27   ` Nicolas Pitre
2011-03-25 15:28   ` Larry Bassel
2011-03-25 15:28     ` Larry Bassel
2011-03-25 17:39   ` Larry Bassel
2011-03-25 17:39     ` Larry Bassel
2011-03-25 20:27     ` Russell King - ARM Linux
2011-03-25 20:27       ` Russell King - ARM Linux
2011-04-19 23:33       ` Larry Bassel
2011-04-19 23:33         ` Larry Bassel
2011-04-19 23:40         ` Larry Bassel
2011-04-19 23:40           ` Larry Bassel
2011-04-20  6:48         ` Colin Cross
2011-04-20  6:48           ` Colin Cross
2011-04-20 19:22           ` Larry Bassel
2011-04-20 19:22             ` Larry Bassel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110325173712.GC29359@labbmf-linux.qualcomm.com \
    --to=lbassel@codeaurora.org \
    --cc=ccross@google.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.