Skip to content

Commit 4360dfa

Browse files
rppttorvalds
authored andcommitted
sparc32: register memory occupied by kernel as memblock.memory
sparc32 never registered the memory occupied by the kernel image with memblock_add() and it only reserved this memory with meblock_reserve(). With openbios as system firmware, the memory occupied by the kernel is reserved in openbios and removed from mem.available. The prom setup code in the kernel uses mem.available to set up the memory banks and essentially there is a hole for the memory occupied by the kernel image. Later in bootmem_init() this memory is memblock_reserve()d. Up until recently, memmap initialization would call __init_single_page() for the pages in that hole, the free_low_memory_core_early() would mark them as reserved and everything would be Ok. After the change in memmap initialization introduced by the commit "mm: memmap_init: iterate over memblock regions rather that check each PFN", the hole is skipped and the page structs for it are not initialized. And when they are passed from memblock to page allocator as reserved, the latter gets confused. Simply registering the memory occupied by the kernel with memblock_add() resolves this issue. Tested on qemu-system-sparc with Debian Etch [1] userspace. [1] https://people.debian.org/~aurel32/qemu/sparc/debian_etch_sparc_small.qcow2 Signed-off-by: Mike Rapoport <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Acked-by: David S. Miller <[email protected]> Cc: Guenter Roeck <[email protected]> Link: https://lkml.kernel.org/r/[email protected]/ Signed-off-by: Linus Torvalds <[email protected]>
1 parent 8cbd54f commit 4360dfa

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

arch/sparc/mm/init_32.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,7 @@ unsigned long __init bootmem_init(unsigned long *pages_avail)
193193
/* Reserve the kernel text/data/bss. */
194194
size = (start_pfn << PAGE_SHIFT) - phys_base;
195195
memblock_reserve(phys_base, size);
196+
memblock_add(phys_base, size);
196197

197198
size = memblock_phys_mem_size() - memblock_reserved_size();
198199
*pages_avail = (size >> PAGE_SHIFT) - high_pages;

0 commit comments

Comments
 (0)