From a4b56a2c057ab6d833112e5f61758aee7afe9347 Mon Sep 17 00:00:00 2001 From: Susheel Khiani Date: Tue, 8 Sep 2015 12:34:11 +0530 Subject: [PATCH] msm: Update the kernel log messages After reclaiming vmalloc and adjusting lowmem, the two regions are no longer contiguous. Update the messages printed during bootup to list all regions corresponding to low memory and vmalloc respectively. Change-Id: Ib3e25b530b3dfbd1f9796cdc580fb79da484e850 Signed-off-by: Susheel Khiani Signed-off-by: Zhenhua Huang Signed-off-by: Qingqing Zhou --- arch/arm/mm/init.c | 100 +++++++++++++++++++++++++++++++++++++++ include/linux/memblock.h | 5 ++ 2 files changed, 105 insertions(+) diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c index 713198456322..7199dfe282bd 100644 --- a/arch/arm/mm/init.c +++ b/arch/arm/mm/init.c @@ -462,6 +462,56 @@ static void __init free_highpages(void) #endif } +#define MLK(b, t) (b), (t), (((t) - (b)) >> 10) +#define MLM(b, t) (b), (t), (((t) - (b)) >> 20) +#define MLK_ROUNDUP(b, t) (b), (t), (DIV_ROUND_UP(((t) - (b)), SZ_1K)) + +#ifdef CONFIG_ENABLE_VMALLOC_SAVING +static void print_vmalloc_lowmem_info(void) +{ + struct memblock_region *reg, *prev_reg = NULL; + + pr_notice( + " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n", + MLM((unsigned long)high_memory, VMALLOC_END)); + + for_each_memblock_rev(memory, reg) { + phys_addr_t start_phys = reg->base; + phys_addr_t end_phys = reg->base + reg->size; + + if (start_phys > arm_lowmem_limit) + continue; + + if (end_phys > arm_lowmem_limit) + end_phys = arm_lowmem_limit; + + if (prev_reg == NULL) { + prev_reg = reg; + + pr_notice( + " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n", + MLM((unsigned long)__va(start_phys), + (unsigned long)__va(end_phys))); + + continue; + } + + pr_notice( + " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n", + MLM((unsigned long)__va(end_phys), + (unsigned long)__va(prev_reg->base))); + + + pr_notice( + " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n", + MLM((unsigned long)__va(start_phys), + (unsigned long)__va(end_phys))); + + prev_reg = reg; + } +} +#endif + /* * mem_init() marks the free areas in the mem_map and tells us how much * memory is free. This is done after various parts of the system have @@ -488,6 +538,52 @@ void __init mem_init(void) mem_init_print_info(NULL); + pr_notice("Virtual kernel memory layout:\n" + " vector : 0x%08lx - 0x%08lx (%4ld kB)\n" +#ifdef CONFIG_HAVE_TCM + " DTCM : 0x%08lx - 0x%08lx (%4ld kB)\n" + " ITCM : 0x%08lx - 0x%08lx (%4ld kB)\n" +#endif + " fixmap : 0x%08lx - 0x%08lx (%4ld kB)\n", + MLK(VECTORS_BASE, VECTORS_BASE + PAGE_SIZE), +#ifdef CONFIG_HAVE_TCM + MLK(DTCM_OFFSET, (unsigned long) dtcm_end), + MLK(ITCM_OFFSET, (unsigned long) itcm_end), +#endif + MLK(FIXADDR_START, FIXADDR_END)); +#ifdef CONFIG_ENABLE_VMALLOC_SAVING + print_vmalloc_lowmem_info(); +#else + pr_notice( + " vmalloc : 0x%08lx - 0x%08lx (%4ld MB)\n" + " lowmem : 0x%08lx - 0x%08lx (%4ld MB)\n", + MLM(VMALLOC_START, VMALLOC_END), + MLM(PAGE_OFFSET, (unsigned long)high_memory)); +#endif + pr_notice( +#ifdef CONFIG_HIGHMEM + " pkmap : 0x%08lx - 0x%08lx (%4ld MB)\n" +#endif +#ifdef CONFIG_MODULES + " modules : 0x%08lx - 0x%08lx (%4ld MB)\n" +#endif + " .text : 0x%pK - 0x%pK (%4d kB)\n" + " .init : 0x%pK - 0x%pK (%4d kB)\n" + " .data : 0x%pK - 0x%pK (%4d kB)\n" + " .bss : 0x%pK - 0x%pK (%4d kB)\n", +#ifdef CONFIG_HIGHMEM + MLM(PKMAP_BASE, (PKMAP_BASE) + (LAST_PKMAP) * + (PAGE_SIZE)), +#endif +#ifdef CONFIG_MODULES + MLM(MODULES_VADDR, MODULES_END), +#endif + + MLK_ROUNDUP(_text, _etext), + MLK_ROUNDUP(__init_begin, __init_end), + MLK_ROUNDUP(_sdata, _edata), + MLK_ROUNDUP(__bss_start, __bss_stop)); + /* * Check boundaries twice: Some fundamental inconsistencies can * be detected at build time already. @@ -503,6 +599,10 @@ void __init mem_init(void) #endif } +#undef MLK +#undef MLM +#undef MLK_ROUNDUP + #ifdef CONFIG_STRICT_KERNEL_RWX struct section_perm { const char *name; diff --git a/include/linux/memblock.h b/include/linux/memblock.h index f1ca5eeb1cfe..e716490e9bf5 100644 --- a/include/linux/memblock.h +++ b/include/linux/memblock.h @@ -534,6 +534,11 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo for (i = 0, rgn = &memblock_type->regions[0]; \ i < memblock_type->cnt; \ i++, rgn = &memblock_type->regions[i]) +#define for_each_memblock_rev(memblock_type, region) \ + for (region = memblock.memblock_type.regions + \ + memblock.memblock_type.cnt - 1; \ + region >= memblock.memblock_type.regions; \ + region--) extern void *alloc_large_system_hash(const char *tablename, unsigned long bucketsize,