Skip to contentSkip to conversation

ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE

PATCH New Catalin Marinas 3 participants 6 messages Oct 25, 2010 – Oct 26, 2010 Arm (32-bit)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE

From: Will Deacon <[email protected]>

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.

---
 arch/arm/include/asm/memblock.h |    3 ---
 arch/arm/mm/mmu.c               |    1 +
 2 files changed, 1 insertions(+), 3 deletions(-)
arch/arm/include/asm/memblock.h +0 -3
index fdbc43b..655b4c4 100644
@@ -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;
arch/arm/mm/mmu.c +1 -0
index 72cc529..fd7bb1e 100644
@@ -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];
#1 lore raw

PATCH 1/1 ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE

Quoted 22 lines · Catalin Marinas

From: Will Deacon <[email protected]>

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.

---
 arch/arm/include/asm/memblock.h |    3 ---
 arch/arm/mm/mmu.c               |    1 +
 2 files changed, 1 insertions(+), 3 deletions(-)
arch/arm/include/asm/memblock.h +0 -0
index fdbc43b..655b4c4 100644

arch/arm/include/asm/memblock.h line 5

Quoted 3 lines
arch/arm/include/asm/memblock.h +0 -0
@@ -3,9 +3,6 @@
 
 #ifdef CONFIG_MMU
 extern phys_addr_t lowmem_end_addr;

This doesn't need to be exported anymore.

Quoted 11 lines
arch/arm/include/asm/memblock.h +0 -3
-#define MEMBLOCK_REAL_LIMIT	lowmem_end_addr
-#else
-#define MEMBLOCK_REAL_LIMIT	0
 #endif
 
 struct meminfo;
arch/arm/mm/mmu.c +0 -0
index 72cc529..fd7bb1e 100644

arch/arm/mm/mmu.c static void __init sanity_check_meminfo(void) · line 756

Quoted 4 lines
arch/arm/mm/mmu.c +1 -0
@@ -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);
#2 lore raw

PATCH 1/1 ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE

Hi Russell,

Quoted 7 lines · Russell King - ARM Linux
Quoted 6 lines · Catalin Marinas

From: Will Deacon <[email protected]>

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.

[...]

Quoted 7 lines

Review

Quoted 1 line
(quoted diff) +0 -0

b/arch/arm/include/asm/memblock.h

Quoted 5 lines

index fdbc43b..655b4c4 100644

arch/arm/include/asm/memblock.h +0 -0
@@ -3,9 +3,6 @@
 
Quoted 5 lines

arch/arm/include/asm/memblock.h line 5

Quoted 2 lines
arch/arm/include/asm/memblock.h +0 -0
 #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.

Quoted 7 lines
Quoted 7 lines
arch/arm/mm/mmu.c +0 -0
index 72cc529..fd7bb1e 100644
@@ -753,6 +753,7 @@ static void __init sanity_check_meminfo(void)
      int i, j, highmem = 0;
 
Quoted 5 lines

arch/arm/mm/mmu.c static void __init sanity_check_meminfo(void) · line 756

Quoted 2 lines
arch/arm/mm/mmu.c +1 -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

#3 lore raw

PATCH 1/1 ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE

Quoted 4 lines · Will Deacon

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.

#4 lore raw

PATCH 1/1 ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE

Russell,

Quoted 11 lines · Russell King - ARM Linux
Quoted 4 lines · Will Deacon

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.

Quoted 1 line

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

Great, thanks.

Will

#5 lore raw

PATCH 1/1 ARM: memblock: set allocation limit for MEMBLOCK_ALLOC_ANYWHERE

Quoted 9 lines · Will Deacon

Russell,

Quoted 6 lines · Russell King - ARM Linux
Quoted 4 lines · Will Deacon

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.

Quoted 8 lines
Quoted 5 lines

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.