linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE
@ 2010-10-25 10:48 Catalin Marinas
  2010-10-25 15:15 ` Russell King - ARM Linux
  0 siblings, 1 reply; 6+ messages in thread
From: Catalin Marinas @ 2010-10-25 10:48 UTC (permalink / raw)
  To: linux-arm-kernel

From: Will Deacon <will.deacon@arm.com>

Commit e63075a3 removed the explicit MEMBLOCK_REAL_LIMIT #define
and introduced the requirement that arch code calls
memblock_set_current_limit to ensure that the __va macro can
be used on physical addresses returned from memblock_alloc.

This patch ensures that memblock allocates from lowmem on ARM
by setting the allocation limit to lowmem_end_addr.

Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
---
 arch/arm/include/asm/memblock.h |    3 ---
 arch/arm/mm/mmu.c               |    1 +
 2 files changed, 1 insertions(+), 3 deletions(-)

diff --git a/arch/arm/include/asm/memblock.h b/arch/arm/include/asm/memblock.h
index fdbc43b..655b4c4 100644
--- a/arch/arm/include/asm/memblock.h
+++ b/arch/arm/include/asm/memblock.h
@@ -3,9 +3,6 @@
 
 #ifdef CONFIG_MMU
 extern phys_addr_t lowmem_end_addr;
-#define MEMBLOCK_REAL_LIMIT	lowmem_end_addr
-#else
-#define MEMBLOCK_REAL_LIMIT	0
 #endif
 
 struct meminfo;
diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
index 72cc529..fd7bb1e 100644
--- a/arch/arm/mm/mmu.c
+++ b/arch/arm/mm/mmu.c
@@ -753,6 +753,7 @@ static void __init sanity_check_meminfo(void)
 	int i, j, highmem = 0;
 
 	lowmem_end_addr = __pa(vmalloc_min - 1) + 1;
+	memblock_set_current_limit(lowmem_end_addr);
 
 	for (i = 0, j = 0; i < meminfo.nr_banks; i++) {
 		struct membank *bank = &meminfo.bank[j];

^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH] ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE
  2010-10-25 10:48 [PATCH] ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE Catalin Marinas
@ 2010-10-25 15:15 ` Russell King - ARM Linux
  2010-10-25 22:55   ` Will Deacon
  0 siblings, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2010-10-25 15:15 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 25, 2010 at 11:48:00AM +0100, Catalin Marinas wrote:
> From: Will Deacon <will.deacon@arm.com>
> 
> Commit e63075a3 removed the explicit MEMBLOCK_REAL_LIMIT #define
> and introduced the requirement that arch code calls
> memblock_set_current_limit to ensure that the __va macro can
> be used on physical addresses returned from memblock_alloc.
> 
> This patch ensures that memblock allocates from lowmem on ARM
> by setting the allocation limit to lowmem_end_addr.
> 
> Signed-off-by: Will Deacon <will.deacon@arm.com>
> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
> ---
>  arch/arm/include/asm/memblock.h |    3 ---
>  arch/arm/mm/mmu.c               |    1 +
>  2 files changed, 1 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/arm/include/asm/memblock.h b/arch/arm/include/asm/memblock.h
> index fdbc43b..655b4c4 100644
> --- a/arch/arm/include/asm/memblock.h
> +++ b/arch/arm/include/asm/memblock.h
> @@ -3,9 +3,6 @@
>  
>  #ifdef CONFIG_MMU
>  extern phys_addr_t lowmem_end_addr;

This doesn't need to be exported anymore.

> -#define MEMBLOCK_REAL_LIMIT	lowmem_end_addr
> -#else
> -#define MEMBLOCK_REAL_LIMIT	0
>  #endif
>  
>  struct meminfo;
> diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
> index 72cc529..fd7bb1e 100644
> --- a/arch/arm/mm/mmu.c
> +++ b/arch/arm/mm/mmu.c
> @@ -753,6 +753,7 @@ static void __init sanity_check_meminfo(void)
>  	int i, j, highmem = 0;
>  
>  	lowmem_end_addr = __pa(vmalloc_min - 1) + 1;
> +	memblock_set_current_limit(lowmem_end_addr);

So this might as well become:
	memblock_set_current_limit(__pa(vmalloc_min - 1) + 1);

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE
  2010-10-25 15:15 ` Russell King - ARM Linux
@ 2010-10-25 22:55   ` Will Deacon
  2010-10-26 10:56     ` Russell King - ARM Linux
  0 siblings, 1 reply; 6+ messages in thread
From: Will Deacon @ 2010-10-25 22:55 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Russell,

On Mon, 2010-10-25 at 16:15 +0100, Russell King - ARM Linux wrote:
> On Mon, Oct 25, 2010 at 11:48:00AM +0100, Catalin Marinas wrote:
> > From: Will Deacon <will.deacon@arm.com>
> >
> > Commit e63075a3 removed the explicit MEMBLOCK_REAL_LIMIT #define
> > and introduced the requirement that arch code calls
> > memblock_set_current_limit to ensure that the __va macro can
> > be used on physical addresses returned from memblock_alloc.

[...]

> > diff --git a/arch/arm/include/asm/memblock.h
> b/arch/arm/include/asm/memblock.h
> > index fdbc43b..655b4c4 100644
> > --- a/arch/arm/include/asm/memblock.h
> > +++ b/arch/arm/include/asm/memblock.h
> > @@ -3,9 +3,6 @@
> > 
> >  #ifdef CONFIG_MMU
> >  extern phys_addr_t lowmem_end_addr;
> 
> This doesn't need to be exported anymore.
> 
Thanks for confirming this. I'll remove it from the header file.

> > diff --git a/arch/arm/mm/mmu.c b/arch/arm/mm/mmu.c
> > index 72cc529..fd7bb1e 100644
> > --- a/arch/arm/mm/mmu.c
> > +++ b/arch/arm/mm/mmu.c
> > @@ -753,6 +753,7 @@ static void __init sanity_check_meminfo(void)
> >       int i, j, highmem = 0;
> > 
> >       lowmem_end_addr = __pa(vmalloc_min - 1) + 1;
> > +     memblock_set_current_limit(lowmem_end_addr);
> 
> So this might as well become:
>         memblock_set_current_limit(__pa(vmalloc_min - 1) + 1);

Right. I could also move this call out of sanity_check_meminfo
and into arm_memblock_init now that we don't need lowmem_end_addr
to be initialised. If you're happy with me making that change then
I'll post a revised version to the patch system.

Thanks,

Will

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE
  2010-10-25 22:55   ` Will Deacon
@ 2010-10-26 10:56     ` Russell King - ARM Linux
  2010-10-26 18:08       ` Will Deacon
  0 siblings, 1 reply; 6+ messages in thread
From: Russell King - ARM Linux @ 2010-10-26 10:56 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 25, 2010 at 11:55:36PM +0100, Will Deacon wrote:
> Right. I could also move this call out of sanity_check_meminfo
> and into arm_memblock_init now that we don't need lowmem_end_addr
> to be initialised. If you're happy with me making that change then
> I'll post a revised version to the patch system.

It looks like we're doing a few things out of order.  Yes, it makes
sense to move that initialization to arm_memblock_init(), but as we're
not running sanity_check_meminfo(), it could mean there's problems
with out of order membanks and similar.

I'll look at that when I'm back.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE
  2010-10-26 10:56     ` Russell King - ARM Linux
@ 2010-10-26 18:08       ` Will Deacon
  2010-10-26 19:30         ` Russell King - ARM Linux
  0 siblings, 1 reply; 6+ messages in thread
From: Will Deacon @ 2010-10-26 18:08 UTC (permalink / raw)
  To: linux-arm-kernel

Russell,

On Tue, 2010-10-26 at 11:56 +0100, Russell King - ARM Linux wrote:
> On Mon, Oct 25, 2010 at 11:55:36PM +0100, Will Deacon wrote:
> > Right. I could also move this call out of sanity_check_meminfo
> > and into arm_memblock_init now that we don't need lowmem_end_addr
> > to be initialised. If you're happy with me making that change then
> > I'll post a revised version to the patch system.
> 
> It looks like we're doing a few things out of order.  Yes, it makes
> sense to move that initialization to arm_memblock_init(), but as we're
> not running sanity_check_meminfo(), it could mean there's problems
> with out of order membanks and similar.
> 
We could move the arm_memblock_init() call into paging_init, immediately
after the call to sanity_check_meminfo. I think everything should be
safe then.

> I'll look at that when I'm back.

Great, thanks.

Will

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH] ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE
  2010-10-26 18:08       ` Will Deacon
@ 2010-10-26 19:30         ` Russell King - ARM Linux
  0 siblings, 0 replies; 6+ messages in thread
From: Russell King - ARM Linux @ 2010-10-26 19:30 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Oct 26, 2010 at 07:08:43PM +0100, Will Deacon wrote:
> Russell,
> 
> On Tue, 2010-10-26 at 11:56 +0100, Russell King - ARM Linux wrote:
> > On Mon, Oct 25, 2010 at 11:55:36PM +0100, Will Deacon wrote:
> > > Right. I could also move this call out of sanity_check_meminfo
> > > and into arm_memblock_init now that we don't need lowmem_end_addr
> > > to be initialised. If you're happy with me making that change then
> > > I'll post a revised version to the patch system.
> > 
> > It looks like we're doing a few things out of order.  Yes, it makes
> > sense to move that initialization to arm_memblock_init(), but as we're
> > not running sanity_check_meminfo(), it could mean there's problems
> > with out of order membanks and similar.
> > 
> We could move the arm_memblock_init() call into paging_init, immediately
> after the call to sanity_check_meminfo. I think everything should be
> safe then.

Well, there's actually some things which the mmu-ful stuff does (such as
sorting) which the nommu stuff should also do for safety sake, so I
think a little bit of a cleanup in this area would be no bad thing,
rather than trying to move arm_memblock_init() into both the MMU and
noMMU code.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2010-10-26 19:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-25 10:48 [PATCH] ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE Catalin Marinas
2010-10-25 15:15 ` Russell King - ARM Linux
2010-10-25 22:55   ` Will Deacon
2010-10-26 10:56     ` Russell King - ARM Linux
2010-10-26 18:08       ` Will Deacon
2010-10-26 19:30         ` Russell King - ARM Linux

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).