Remove ARM meminfo
Subsystems (9)
v4 cover Remove ARM meminfo
Hi,
This is v4 of meminfo removal to fix a few additional issues. Review/test away.
Thanks,
Laura
v4: Added nommu support. Fixed issues with !HIGHMEM per Grygorii Strashko.
v3: Fixed compilation issue for CONFIG_SPARSEMEM. Fixed several typos in spitz.c. Removed early_init_dt_add_memory_arch per Grant's suggestion.
v2: Implemented full commandline support for mem at addr
Laura Abbott (2):
mm/memblock: add memblock_get_current_limit
arm: Get rid of meminfo
arch/arm/include/asm/mach/arch.h | 4 +- arch/arm/include/asm/memblock.h | 3 +- arch/arm/include/asm/setup.h | 23 ------ arch/arm/kernel/atags_parse.c | 5 +- arch/arm/kernel/devtree.c | 5 -- arch/arm/kernel/setup.c | 30 ++------ arch/arm/mach-clps711x/board-clep7312.c | 7 +- arch/arm/mach-clps711x/board-edb7211.c | 10 +-- arch/arm/mach-clps711x/board-p720t.c | 2 +- arch/arm/mach-footbridge/cats-hw.c | 2 +- arch/arm/mach-footbridge/netwinder-hw.c | 2 +- arch/arm/mach-msm/board-halibut.c | 6 -- arch/arm/mach-msm/board-mahimahi.c | 13 +--- arch/arm/mach-msm/board-msm7x30.c | 3 +- arch/arm/mach-msm/board-sapphire.c | 13 ++-- arch/arm/mach-msm/board-trout.c | 8 +-- arch/arm/mach-orion5x/common.c | 3 +- arch/arm/mach-orion5x/common.h | 3 +- arch/arm/mach-pxa/cm-x300.c | 3 +- arch/arm/mach-pxa/corgi.c | 10 +-- arch/arm/mach-pxa/eseries.c | 9 +-- arch/arm/mach-pxa/poodle.c | 8 +-- arch/arm/mach-pxa/spitz.c | 8 +-- arch/arm/mach-pxa/tosa.c | 8 +-- arch/arm/mach-realview/core.c | 11 +-- arch/arm/mach-realview/core.h | 3 +- arch/arm/mach-realview/realview_pb1176.c | 8 +-- arch/arm/mach-realview/realview_pbx.c | 17 ++--- arch/arm/mach-s3c24xx/mach-smdk2413.c | 8 +-- arch/arm/mach-s3c24xx/mach-vstms.c | 8 +-- arch/arm/mach-sa1100/assabet.c | 2 +- arch/arm/mm/init.c | 67 +++++++----------- arch/arm/mm/mmu.c | 115 +++++++++--------------------- arch/arm/mm/nommu.c | 66 +++++++++-------- include/linux/memblock.h | 2 + mm/memblock.c | 5 ++ 36 files changed, 179 insertions(+), 321 deletions(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 1/2 mm/memblock: add memblock_get_current_limit
Apart from setting the limit of memblock, it's also useful to be able to get the limit to avoid recalculating it every time. Add the function to do so.
--- include/linux/memblock.h | 2 ++ mm/memblock.c | 5 +++++ 2 files changed, 7 insertions(+), 0 deletions(-)
include/linux/memblock.h +2 -0
@@ -252,6 +252,8 @@ static inline void memblock_dump_all(void)void memblock_set_current_limit (phys_addr_t limit); +phys_addr_t memblock_get_current_limit (void ); +/* * pfn conversion functions *
mm/memblock.c +5 -0
@@ -1407,6 +1407,11 @@ void __init_memblock memblock_set_current_limit(phys_addr_t limit) memblock.current_limit = limit; } +phys_addr_t __init_memblock memblock_get_current_limit(void) +{ +return memblock.current_limit; +} + static void __init_memblock memblock_dump(struct memblock_type *type, char *name) {unsigned long long base, size;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCHv4 1/2] mm/memblock: add memblock_get_current_limit
Quoted 8 lines · Laura Abbott
Apart from setting the limit of memblock, it's also useful to be able to get the limit to avoid recalculating it every time. Add the function to do so.
Acked-by Catalin Marinas <[email protected]>Acked-by Andrew Morton <[email protected]>Signed-off-by Laura Abbott <[email protected]>
Quoted 38 lines
--- include/linux/memblock.h | 2 ++ mm/memblock.c | 5 +++++ 2 files changed, 7 insertions(+), 0 deletions(-)include/linux/memblock.h +2
-0@@ -252,6 +252,8 @@ static inline void memblock_dump_all(void)void memblock_set_current_limit (phys_addr_t limit); +phys_addr_t memblock_get_current_limit (void ); +/* * pfn conversion functions * mm/memblock.c +5
-0@@ -1407,6 +1407,11 @@ void __init_memblock memblock_set_current_limit(phys_addr_t limit) memblock.current_limit = limit; } +phys_addr_t __init_memblock memblock_get_current_limit(void) +{ +return memblock.current_limit; +} + static void __init_memblock memblock_dump(struct memblock_type *type, char *name) {unsigned long long base, size;Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
PATCH v4 2/2 arm: Get rid of meminfo
In reply to Laura Abbottmemblock is now fully integrated into the kernel and is the prefered method for tracking memory. Rather than reinvent the wheel with meminfo, migrate to using memblock directly instead of meminfo as an intermediate.
--- arch/arm/include/asm/mach/arch.h | 4 +- arch/arm/include/asm/memblock.h | 3 +- arch/arm/include/asm/setup.h | 23 ------ arch/arm/kernel/atags_parse.c | 5 +- arch/arm/kernel/devtree.c | 5 -- arch/arm/kernel/setup.c | 30 ++------ arch/arm/mach-clps711x/board-clep7312.c | 7 +- arch/arm/mach-clps711x/board-edb7211.c | 10 +-- arch/arm/mach-clps711x/board-p720t.c | 2 +- arch/arm/mach-footbridge/cats-hw.c | 2 +- arch/arm/mach-footbridge/netwinder-hw.c | 2 +- arch/arm/mach-msm/board-halibut.c | 6 -- arch/arm/mach-msm/board-mahimahi.c | 13 +--- arch/arm/mach-msm/board-msm7x30.c | 3 +- arch/arm/mach-msm/board-sapphire.c | 13 ++-- arch/arm/mach-msm/board-trout.c | 8 +-- arch/arm/mach-orion5x/common.c | 3 +- arch/arm/mach-orion5x/common.h | 3 +- arch/arm/mach-pxa/cm-x300.c | 3 +- arch/arm/mach-pxa/corgi.c | 10 +-- arch/arm/mach-pxa/eseries.c | 9 +-- arch/arm/mach-pxa/poodle.c | 8 +-- arch/arm/mach-pxa/spitz.c | 8 +-- arch/arm/mach-pxa/tosa.c | 8 +-- arch/arm/mach-realview/core.c | 11 +-- arch/arm/mach-realview/core.h | 3 +- arch/arm/mach-realview/realview_pb1176.c | 8 +-- arch/arm/mach-realview/realview_pbx.c | 17 ++--- arch/arm/mach-s3c24xx/mach-smdk2413.c | 8 +-- arch/arm/mach-s3c24xx/mach-vstms.c | 8 +-- arch/arm/mach-sa1100/assabet.c | 2 +- arch/arm/mm/init.c | 67 +++++++----------- arch/arm/mm/mmu.c | 115 +++++++++--------------------- arch/arm/mm/nommu.c | 66 +++++++++-------- 34 files changed, 172 insertions(+), 321 deletions(-)
arch/arm/include/asm/mach/arch.h +1 -3
@@ -14,7 +14,6 @@#include <linux/reboot.h> struct tag ; -struct meminfo ;struct pt_regs ;struct smp_operations ;#ifdef CONFIG_SMP
@@ -47,8 +46,7 @@ struct machine_desc {enum reboot_mode reboot_mode;/* default restart mode */ struct smp_operations *smp;/* SMP operations */ bool (*smp_init)(void ); -void (*fixup)(struct tag *,char **, -struct meminfo *); +void (*fixup)(struct tag *,char **);void (*init_meminfo)(void );void (*reserve)(void );/* reserve mem blocks */ void (*map_io)(void );/* IO mapping function */
arch/arm/include/asm/memblock.h +1 -2
@@ -1,10 +1,9 @@#ifndef _ASM_ARM_MEMBLOCK_H#define _ASM_ARM_MEMBLOCK_H -struct meminfo ;struct machine_desc ; -void arm_memblock_init (struct meminfo *,const struct machine_desc *); +void arm_memblock_init (const struct machine_desc *);phys_addr_t arm_memblock_steal (phys_addr_t size,phys_addr_t align);#endif
arch/arm/include/asm/setup.h +0 -23
@@ -26,29 +26,6 @@ static const struct tagtable __tagtable_##fn __tag = { tag, fn }*/ #define NR_BANKS CONFIG_ARM_NR_BANKS -struct membank { -phys_addr_t start; -phys_addr_t size; -unsigned int highmem; -}; - -struct meminfo { -int nr_banks; -struct membank bank[NR_BANKS ]; -}; - -extern struct meminfo meminfo; - -#define for_each_bank (iter,mi) \ - for (iter = 0; iter < (mi)->nr_banks; iter++) - -#define bank_pfn_start (bank) __phys_to_pfn((bank)->start) -#define bank_pfn_end (bank) __phys_to_pfn((bank)->start + (bank)->size) -#define bank_pfn_size (bank) ((bank)->size >> PAGE_SHIFT) -#define bank_phys_start (bank) (bank)->start -#define bank_phys_end (bank) ((bank)->start + (bank)->size) -#define bank_phys_size (bank) (bank)->size -extern int arm_add_memory (u64 start,u64 size);extern void early_print (const char *str, ...);extern void dump_machine_table (void );
arch/arm/kernel/atags_parse.c +3 -2
@@ -22,6 +22,7 @@#include <linux/fs.h> #include <linux/root_dev.h> #include <linux/screen_info.h> +#include <linux/memblock.h> #include <asm/setup.h> #include <asm/system_info.h>
@@ -222,10 +223,10 @@ setup_machine_tags(phys_addr_t __atags_pointer, unsigned int machine_nr) }if (mdesc->fixup) - mdesc->fixup (tags, &from, &meminfo); + mdesc->fixup (tags, &from);if (tags->hdr.tag ==ATAG_CORE ) { -if (meminfo.nr_banks !=0 ) +if (memblock_phys_mem_size ())squash_mem_tags (tags);save_atags (tags);parse_tags (tags);
arch/arm/kernel/devtree.c +0 -5
@@ -26,11 +26,6 @@#include <asm/mach/arch.h> #include <asm/mach-types.h> -void __init early_init_dt_add_memory_arch (u64 base,u64 size) -{ -arm_add_memory (base, size); -} -void *__init early_init_dt_alloc_memory_arch (u64 size,u64 align) {return memblock_virt_alloc (size, align);
arch/arm/kernel/setup.c +8 -22
@@ -625,15 +625,8 @@ void __init dump_machine_table(void)int __init arm_add_memory (u64 start,u64 size) { -struct membank *bank = &meminfo.bank[meminfo.nr_banks];u64 aligned_start; -if (meminfo.nr_banks >=NR_BANKS ) { -pr_crit ("NR_BANKS too low, ignoring memory at 0x%08llx\n" , - (long long )start); -return -EINVAL ; - } -/* * Ensure that start/size are aligned to a page boundary. * Size is appropriately rounded down, start is rounded up.
@@ -674,17 +667,17 @@ int __init arm_add_memory(u64 start, u64 size) aligned_start =PHYS_OFFSET ; } - bank->start = aligned_start; - bank->size = size & ~(phys_addr_t)(PAGE_SIZE -1 ); + start = aligned_start; + size = size & ~(phys_addr_t)(PAGE_SIZE -1 );/* * Check whether this memory region has non-zero size or * invalid node number. */ -if (bank->size ==0 ) +if (size ==0 )return -EINVAL ; - meminfo.nr_banks++; +memblock_add (start, size);return 0 ; }
@@ -692,6 +685,7 @@ int __init arm_add_memory(u64 start, u64 size)* Pick out the memory size. We look for mem=size at start, * where start and size are "size[KkMm]" */ +static int __init early_mem (char *p) {static int usermem__initdata =0 ;
@@ -706,7 +700,8 @@ static int __init early_mem(char *p)*/ if (usermem ==0 ) { usermem =1 ; - meminfo.nr_banks =0 ; +memblock_remove (memblock_start_of_DRAM (), +memblock_end_of_DRAM () -memblock_start_of_DRAM ()); } start =PHYS_OFFSET ;
@@ -851,13 +846,6 @@ static void __init reserve_crashkernel(void)static inline void reserve_crashkernel (void ) {}#endif /* CONFIG_KEXEC */ -static int __init meminfo_cmp (const void *_a,const void *_b) -{ -const struct membank *a = _a, *b = _b; -long cmp =bank_pfn_start (a) -bank_pfn_start (b); -return cmp <0 ?-1 : cmp >0 ?1 :0 ; -} -void __init hyp_mode_check (void ) {#ifdef CONFIG_ARM_VIRT_EXT
@@ -900,12 +888,10 @@ void __init setup_arch(char **cmdline_p)parse_early_param (); -sort (&meminfo.bank, meminfo.nr_banks,sizeof (meminfo.bank[0 ]), meminfo_cmp,NULL ); -early_paging_init (mdesc,lookup_processor_type (read_cpuid_id ()));setup_dma_zone (mdesc);sanity_check_meminfo (); -arm_memblock_init (&meminfo, mdesc); +arm_memblock_init (mdesc);paging_init (mdesc);request_standard_resources (mdesc);
arch/arm/mach-clps711x/board-clep7312.c +3 -4
@@ -18,6 +18,7 @@#include <linux/init.h> #include <linux/types.h> #include <linux/string.h> +#include <linux/memblock.h> #include <asm/setup.h> #include <asm/mach-types.h>
@@ -26,11 +27,9 @@#include "common.h" static void __init -fixup_clep7312 (struct tag *tags,char **cmdline,struct meminfo *mi) +fixup_clep7312 (struct tag *tags,char **cmdline) { - mi->nr_banks=1 ; - mi->bank[0 ].start =0xc0000000 ; - mi->bank[0 ].size =0x01000000 ; +memblock_add (0xc0000000 ,0x01000000 ); }MACHINE_START (CLEP7212 ,"Cirrus Logic 7212/7312" )
arch/arm/mach-clps711x/board-edb7211.c +4 -6
@@ -16,6 +16,7 @@#include <linux/interrupt.h> #include <linux/backlight.h> #include <linux/platform_device.h> +#include <linux/memblock.h> #include <linux/mtd/physmap.h> #include <linux/mtd/partitions.h>
@@ -133,7 +134,7 @@ static void __init edb7211_reserve(void) }static void __init -fixup_edb7211 (struct tag *tags,char **cmdline,struct meminfo *mi) +fixup_edb7211 (struct tag *tags,char **cmdline) {/* * Bank start addresses are not present in the information
@@ -143,11 +144,8 @@ fixup_edb7211(struct tag *tags, char **cmdline, struct meminfo *mi)* Banks sizes _are_ present in the param block, but we're * not using that information yet. */ - mi->bank[0 ].start =0xc0000000 ; - mi->bank[0 ].size =SZ_8M ; - mi->bank[1 ].start =0xc1000000 ; - mi->bank[1 ].size =SZ_8M ; - mi->nr_banks =2 ; +memblock_add (0xc0000000 ,SZ_8M ); +memblock_add (0xc1000000 ,SZ_8M ); }static void __init edb7211_init (void )
arch/arm/mach-clps711x/board-p720t.c +1 -1
@@ -295,7 +295,7 @@ static struct generic_bl_info p720t_lcd_backlight_pdata = { };static void __init -fixup_p720t (struct tag *tag,char **cmdline,struct meminfo *mi) +fixup_p720t (struct tag *tag,char **cmdline) {/* * Our bootloader doesn't setup any tags (yet).
arch/arm/mach-footbridge/cats-hw.c +1 -1
@@ -76,7 +76,7 @@ __initcall(cats_hw_init);* hard reboots fail on early boards. */ static void __init -fixup_cats (struct tag *tags,char **cmdline,struct meminfo *mi) +fixup_cats (struct tag *tags,char **cmdline) { screen_info.orig_video_lines =25 ; screen_info.orig_video_points =16 ;
arch/arm/mach-footbridge/netwinder-hw.c +1 -1
@@ -620,7 +620,7 @@ __initcall(nw_hw_init);* the parameter page. */ static void __init -fixup_netwinder (struct tag *tags,char **cmdline,struct meminfo *mi) +fixup_netwinder (struct tag *tags,char **cmdline) {#ifdef CONFIG_ISAPNP extern int isapnp_disable;
arch/arm/mach-msm/board-halibut.c +0 -6
@@ -83,11 +83,6 @@ static void __init halibut_init(void)platform_add_devices (devices,ARRAY_SIZE (devices)); } -static void __init halibut_fixup (struct tag *tags,char **cmdline, -struct meminfo *mi) -{ -} -static void __init halibut_map_io (void ) {msm_map_common_io ();
@@ -100,7 +95,6 @@ static void __init halibut_init_late(void)MACHINE_START (HALIBUT ,"Halibut Board (QCT SURF7200A)" ) .atag_offset = 0x100, - .fixup = halibut_fixup, .map_io = halibut_map_io, .init_early = halibut_init_early, .init_irq = halibut_init_irq,
arch/arm/mach-msm/board-mahimahi.c +4 -9
@@ -22,6 +22,7 @@#include <linux/io.h> #include <linux/kernel.h> #include <linux/platform_device.h> +#include <linux/memblock.h> #include <asm/mach-types.h> #include <asm/mach/arch.h>
@@ -52,16 +53,10 @@ static void __init mahimahi_init(void)platform_add_devices (devices,ARRAY_SIZE (devices)); } -static void __init mahimahi_fixup (struct tag *tags,char **cmdline, -struct meminfo *mi) +static void __init mahimahi_fixup (struct tag *tags,char **cmdline) { - mi->nr_banks =2 ; - mi->bank[0 ].start =PHYS_OFFSET ; - mi->bank[0 ].node =PHYS_TO_NID (PHYS_OFFSET ); - mi->bank[0 ].size = (219 *1024 *1024 ); - mi->bank[1 ].start =MSM_HIGHMEM_BASE ; - mi->bank[1 ].node =PHYS_TO_NID (MSM_HIGHMEM_BASE ); - mi->bank[1 ].size =MSM_HIGHMEM_SIZE ; +memblock_add (PHYS_OFFSET ,219 *SZ_1M ); +memblock_add (MSM_HIGHMEM_BASE ,MSM_HIGHMEM_SIZE ); }static void __init mahimahi_map_io (void )
arch/arm/mach-msm/board-msm7x30.c +1 -2
@@ -40,8 +40,7 @@#include "proc_comm.h" #include "common.h" -static void __init msm7x30_fixup (struct tag *tag,char **cmdline, -struct meminfo *mi) +static void __init msm7x30_fixup (struct tag *tag,char **cmdline) {for (; tag->hdr.size; tag =tag_next (tag))if (tag->hdr.tag ==ATAG_MEM && tag->u.mem.start ==0x200000 ) {
arch/arm/mach-msm/board-sapphire.c +5 -8
@@ -35,6 +35,7 @@#include <linux/mtd/nand.h> #include <linux/mtd/partitions.h> +#include <linux/memblock.h> #include "gpio_chip.h" #include "board-sapphire.h"
@@ -74,22 +75,18 @@ static struct map_desc sapphire_io_desc[] __initdata = { } }; -static void __init sapphire_fixup (struct tag *tags,char **cmdline, -struct meminfo *mi) +static void __init sapphire_fixup (struct tag *tags,char **cmdline) {int smi_sz =parse_tag_smi ((const struct tag *)tags); - mi->nr_banks =1 ; - mi->bank[0 ].start =PHYS_OFFSET ; - mi->bank[0 ].node =PHYS_TO_NID (PHYS_OFFSET );if (smi_sz ==32 ) { - mi->bank[0 ].size = (84 *1024 *1024 ); +memblock_add (PHYS_OFFSET ,84 *SZ_1M ); }else if (smi_sz ==64 ) { - mi->bank[0 ].size = (101 *1024 *1024 ); +memblock_add (PHYS_OFFSET ,101 *SZ_1M ); }else { +memblock_add (PHYS_OFFSET ,101 *SZ_1M );/* Give a default value when not get smi size */ smi_sz =64 ; - mi->bank[0 ].size = (101 *1024 *1024 ); } }
arch/arm/mach-msm/board-trout.c +3 -5
@@ -19,6 +19,7 @@#include <linux/init.h> #include <linux/platform_device.h> #include <linux/clkdev.h> +#include <linux/memblock.h> #include <asm/system_info.h> #include <asm/mach-types.h>
@@ -55,12 +56,9 @@ static void __init trout_init_irq(void)msm_init_irq (); } -static void __init trout_fixup (struct tag *tags,char **cmdline, -struct meminfo *mi) +static void __init trout_fixup (struct tag *tags,char **cmdline) { - mi->nr_banks =1 ; - mi->bank[0 ].start =PHYS_OFFSET ; - mi->bank[0 ].size = (101 *1024 *1024 ); +memblock_add (PHYS_OFFSET ,101 *SZ_1M ); }static void __init trout_init (void )
arch/arm/mach-orion5x/common.c +1 -2
@@ -365,8 +365,7 @@ void orion5x_restart(enum reboot_mode mode, const char *cmd)* Many orion-based systems have buggy bootloader implementations. * This is a common fixup for bogus memory tags. */ -void __init tag_fixup_mem32 (struct tag *t,char **from, -struct meminfo *meminfo) +void __init tag_fixup_mem32 (struct tag *t,char **from) {for (; t->hdr.size; t =tag_next (t)) if (t->hdr.tag == ATAG_MEM &&
arch/arm/mach-orion5x/common.h +1 -2
@@ -71,9 +71,8 @@ void edmini_v2_init(void);static inline void edmini_v2_init (void ) {};#endif -struct meminfo ;struct tag ; -extern void __init tag_fixup_mem32 (struct tag *,char **,struct meminfo *); +extern void __init tag_fixup_mem32 (struct tag *,char **);/***************************************************************************** * Helpers to access Orion registers
arch/arm/mach-pxa/cm-x300.c +1 -2
@@ -837,8 +837,7 @@ static void __init cm_x300_init(void)cm_x300_init_bl (); } -static void __init cm_x300_fixup (struct tag *tags,char **cmdline, -struct meminfo *mi) +static void __init cm_x300_fixup (struct tag *tags,char **cmdline) {/* Make sure that mi->bank[0].start = PHYS_ADDR */ for (; tags->hdr.size; tags =tag_next (tags))
arch/arm/mach-pxa/corgi.c +4 -6
@@ -33,6 +33,7 @@#include <linux/mtd/sharpsl.h> #include <linux/input/matrix_keypad.h> #include <linux/module.h> +#include <linux/memblock.h> #include <video/w100fb.h> #include <asm/setup.h>
@@ -713,16 +714,13 @@ static void __init corgi_init(void)platform_add_devices (devices,ARRAY_SIZE (devices)); } -static void __init fixup_corgi (struct tag *tags,char **cmdline, -struct meminfo *mi) +static void __init fixup_corgi (struct tag *tags,char **cmdline) {sharpsl_save_param (); - mi->nr_banks=1 ; - mi->bank[0 ].start =0xa0000000 ;if (machine_is_corgi ()) - mi->bank[0 ].size = (32 *1024 *1024 ); +memblock_add (0xa0000000 ,SZ_32M );else - mi->bank[0 ].size = (64 *1024 *1024 ); +memblock_add (0xa0000000 ,SZ_64M ); }#ifdef CONFIG_MACH_CORGI
arch/arm/mach-pxa/eseries.c +4 -5
@@ -21,6 +21,7 @@#include <linux/mtd/nand.h> #include <linux/mtd/partitions.h> #include <linux/usb/gpio_vbus.h> +#include <linux/memblock.h> #include <video/w100fb.h>
@@ -41,14 +42,12 @@#include "clock.h" /* Only e800 has 128MB RAM */ -void __init eseries_fixup (struct tag *tags,char **cmdline,struct meminfo *mi) +void __init eseries_fixup (struct tag *tags,char **cmdline) { - mi->nr_banks=1 ; - mi->bank[0 ].start =0xa0000000 ;if (machine_is_e800 ()) - mi->bank[0 ].size = (128 *1024 *1024 ); +memblock_add (0xa0000000 ,SZ_128M );else - mi->bank[0 ].size = (64 *1024 *1024 ); +memblock_add (0xa0000000 ,SZ_64M ); }struct gpio_vbus_mach_info e7xx_udc_info = {
arch/arm/mach-pxa/poodle.c +3 -5
@@ -29,6 +29,7 @@#include <linux/spi/ads7846.h> #include <linux/spi/pxa2xx_spi.h> #include <linux/mtd/sharpsl.h> +#include <linux/memblock.h> #include <mach/hardware.h> #include <asm/mach-types.h>
@@ -456,13 +457,10 @@ static void __init poodle_init(void)poodle_init_spi (); } -static void __init fixup_poodle (struct tag *tags,char **cmdline, -struct meminfo *mi) +static void __init fixup_poodle (struct tag *tags,char **cmdline) {sharpsl_save_param (); - mi->nr_banks=1 ; - mi->bank[0 ].start =0xa0000000 ; - mi->bank[0 ].size = (32 *1024 *1024 ); +memblock_add (0xa0000000 ,SZ_32M ); }MACHINE_START (POODLE ,"SHARP Poodle" )
arch/arm/mach-pxa/spitz.c +3 -5
@@ -32,6 +32,7 @@#include <linux/io.h> #include <linux/module.h> #include <linux/reboot.h> +#include <linux/memblock.h> #include <asm/setup.h> #include <asm/mach-types.h>
@@ -971,13 +972,10 @@ static void __init spitz_init(void)spitz_i2c_init (); } -static void __init spitz_fixup (struct tag *tags,char **cmdline, -struct meminfo *mi) +static void __init spitz_fixup (struct tag *tags,char **cmdline) {sharpsl_save_param (); - mi->nr_banks =1 ; - mi->bank[0 ].start =0xa0000000 ; - mi->bank[0 ].size = (64 *1024 *1024 ); +memblock_add (0xa0000000 ,SZ_64M ); }#ifdef CONFIG_MACH_SPITZ
arch/arm/mach-pxa/tosa.c +3 -5
@@ -37,6 +37,7 @@#include <linux/i2c/pxa-i2c.h> #include <linux/usb/gpio_vbus.h> #include <linux/reboot.h> +#include <linux/memblock.h> #include <asm/setup.h> #include <asm/mach-types.h>
@@ -960,13 +961,10 @@ static void __init tosa_init(void)platform_add_devices (devices,ARRAY_SIZE (devices)); } -static void __init fixup_tosa (struct tag *tags,char **cmdline, -struct meminfo *mi) +static void __init fixup_tosa (struct tag *tags,char **cmdline) {sharpsl_save_param (); - mi->nr_banks=1 ; - mi->bank[0 ].start =0xa0000000 ; - mi->bank[0 ].size = (64 *1024 *1024 ); +memblock_add (0xa0000000 ,SZ_64M ); }MACHINE_START (TOSA ,"SHARP Tosa" )
arch/arm/mach-realview/core.c +4 -7
@@ -31,6 +31,7 @@#include <linux/amba/mmci.h> #include <linux/gfp.h> #include <linux/mtd/physmap.h> +#include <linux/memblock.h> #include <mach/hardware.h> #include <asm/irq.h>
@@ -370,19 +371,15 @@ void __init realview_timer_init(unsigned int timer_irq)/* * Setup the memory banks. */ -void realview_fixup (struct tag *tags,char **from,struct meminfo *meminfo) +void realview_fixup (struct tag *tags,char **from) {/* * Most RealView platforms have 512MB contiguous RAM at 0x70000000. * Half of this is mirrored at 0. */ #ifdef CONFIG_REALVIEW_HIGH_PHYS_OFFSET - meminfo->bank[0 ].start =0x70000000 ; - meminfo->bank[0 ].size =SZ_512M ; - meminfo->nr_banks =1 ; +memblock_add (0x70000000 ,SZ_512M );#else - meminfo->bank[0 ].start =0 ; - meminfo->bank[0 ].size =SZ_256M ; - meminfo->nr_banks =1 ; +memblock_add (0 ,SZ_256M );#endif }
arch/arm/mach-realview/core.h +1 -2
@@ -51,8 +51,7 @@ extern int realview_flash_register(struct resource *res, u32 num);extern int realview_eth_register (const char *name,struct resource *res);extern int realview_usb_register (struct resource *res);extern void realview_init_early (void ); -extern void realview_fixup (struct tag *tags,char **from, -struct meminfo *meminfo); +extern void realview_fixup (struct tag *tags,char **from);extern struct smp_operations realview_smp_ops;extern void realview_cpu_die (unsigned int cpu);
arch/arm/mach-realview/realview_pb1176.c +3 -5
@@ -32,6 +32,7 @@#include <linux/irqchip/arm-gic.h> #include <linux/platform_data/clk-realview.h> #include <linux/reboot.h> +#include <linux/memblock.h> #include <mach/hardware.h> #include <asm/irq.h>
@@ -339,15 +340,12 @@ static void realview_pb1176_restart(enum reboot_mode mode, const char *cmd)dsb (); } -static void realview_pb1176_fixup (struct tag *tags,char **from, -struct meminfo *meminfo) +static void realview_pb1176_fixup (struct tag *tags,char **from) {/* * RealView PB1176 only has 128MB of RAM mapped at 0. */ - meminfo->bank[0 ].start =0 ; - meminfo->bank[0 ].size =SZ_128M ; - meminfo->nr_banks =1 ; +memblock_add (0 ,SZ_128M ); }static void __init realview_pb1176_init (void )
arch/arm/mach-realview/realview_pbx.c +7 -10
@@ -29,6 +29,7 @@#include <linux/irqchip/arm-gic.h> #include <linux/platform_data/clk-realview.h> #include <linux/reboot.h> +#include <linux/memblock.h> #include <asm/irq.h> #include <asm/mach-types.h>
@@ -325,23 +326,19 @@ static void __init realview_pbx_timer_init(void)realview_pbx_twd_init (); } -static void realview_pbx_fixup (struct tag *tags,char **from, -struct meminfo *meminfo) +static void realview_pbx_fixup (struct tag *tags,char **from) {#ifdef CONFIG_SPARSEMEM /* * Memory configuration with SPARSEMEM enabled on RealView PBX (see * asm/mach/memory.h for more information). */ - meminfo->bank[0 ].start =0 ; - meminfo->bank[0 ].size =SZ_256M ; - meminfo->bank[1 ].start =0x20000000 ; - meminfo->bank[1 ].size =SZ_512M ; - meminfo->bank[2 ].start =0x80000000 ; - meminfo->bank[2 ].size =SZ_256M ; - meminfo->nr_banks =3 ; + +memblock_add (0 ,SZ_256M ); +memblock_add (0x20000000 ,SZ_512M ); +memblock_add (0x80000000 ,SZ_256M );#else -realview_fixup (tags, from, meminfo); +realview_fixup (tags, from);#endif }
arch/arm/mach-s3c24xx/mach-smdk2413.c +3 -5
@@ -22,6 +22,7 @@#include <linux/serial_s3c.h> #include <linux/platform_device.h> #include <linux/io.h> +#include <linux/memblock.h> #include <asm/mach/arch.h> #include <asm/mach/map.h>
@@ -93,13 +94,10 @@ static struct platform_device *smdk2413_devices[] __initdata = { &s3c2412_device_dma, }; -static void __init smdk2413_fixup (struct tag *tags,char **cmdline, -struct meminfo *mi) +static void __init smdk2413_fixup (struct tag *tags,char **cmdline) {if (tags !=phys_to_virt (S3C2410_SDRAM_PA +0x100 )) { - mi->nr_banks=1 ; - mi->bank[0 ].start =0x30000000 ; - mi->bank[0 ].size =SZ_64M ; +memblock_add (0x30000000 ,SZ_64M ); } }
arch/arm/mach-s3c24xx/mach-vstms.c +3 -5
@@ -23,6 +23,7 @@#include <linux/mtd/nand.h> #include <linux/mtd/nand_ecc.h> #include <linux/mtd/partitions.h> +#include <linux/memblock.h> #include <asm/mach/arch.h> #include <asm/mach/map.h>
@@ -129,13 +130,10 @@ static struct platform_device *vstms_devices[] __initdata = { &s3c2412_device_dma, }; -static void __init vstms_fixup (struct tag *tags,char **cmdline, -struct meminfo *mi) +static void __init vstms_fixup (struct tag *tags,char **cmdline) {if (tags !=phys_to_virt (S3C2410_SDRAM_PA +0x100 )) { - mi->nr_banks=1 ; - mi->bank[0 ].start =0x30000000 ; - mi->bank[0 ].size =SZ_64M ; +memblock_add (0x30000000 ,SZ_64M ); } }
arch/arm/mach-sa1100/assabet.c +1 -1
@@ -531,7 +531,7 @@ static void __init get_assabet_scr(void) }static void __init -fixup_assabet (struct tag *tags,char **cmdline,struct meminfo *mi) +fixup_assabet (struct tag *tags,char **cmdline) {/* This must be done before any call to machine_has_neponset() */ map_sa1100_gpio_regs ();
arch/arm/mm/init.c +25 -42
140 lines not on this page · raw message
arch/arm/mm/mmu.c +33 -82
142 lines not on this page · raw message
arch/arm/mm/nommu.c +36 -30
96 lines not on this page · raw message
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCHv4 2/2] arm: Get rid of meminfo
Quoted 7 lines · Laura Abbott
memblock is now fully integrated into the kernel and is the prefered method for tracking memory. Rather than reinvent the wheel with meminfo, migrate to using memblock directly instead of meminfo as an intermediate.
#define
NR_BANKSCONFIG_ARM_NR_BANKS
arch/arm/include/asm/setup.h static const struct tagtable __tagtable_##fn __tag = { tag, fn } · line 38
Quoted 10 lines
arch/arm/include/asm/setup.h +0
-10-struct membank { -phys_addr_t start; -phys_addr_t size; -unsigned int highmem; -}; - -struct meminfo { -int nr_banks; -struct membank bank[NR_BANKS ]; -};
Doesn't this make NR_BANKS (and CONFIG_ARM_NR_BANKS) unused?
Signature · 3 lines
FTTC broadband for 0.8mile line: 5.8Mbps down 500kbps up. Estimation in database were 13.1 to 19Mbit for a good line, about 7.5+ for a bad. Estimate before purchase was "up to 13.2Mbit".
Re: [PATCHv4 2/2] arm: Get rid of meminfo
Quoted 8 lines · Russell King - ARM Linux
Quoted 7 lines · Laura Abbott
memblock is now fully integrated into the kernel and is the prefered method for tracking memory. Rather than reinvent the wheel with meminfo, migrate to using memblock directly instead of meminfo as an intermediate.
#define
NR_BANKSCONFIG_ARM_NR_BANKS
Quoted 12 lines
arch/arm/include/asm/setup.h static const struct tagtable __tagtable_##fn __tag = { tag, fn } · line 38
Quoted 10 lines
arch/arm/include/asm/setup.h +0
-10-struct membank { -phys_addr_t start; -phys_addr_t size; -unsigned int highmem; -}; - -struct meminfo { -int nr_banks; -struct membank bank[NR_BANKS ]; -};Doesn't this make
NR_BANKS(andCONFIG_ARM_NR_BANKS) unused?
Still used in atag_to_fdt.c but I just sent a patch moving it there.
Nicolas
Re: [PATCHv4 2/2] arm: Get rid of meminfo
In reply to Laura AbbottQuoted 5 lines · Laura Abbott
memblock is now fully integrated into the kernel and is the prefered method for tracking memory. Rather than reinvent the wheel with meminfo, migrate to using memblock directly instead of meminfo as an intermediate.
Quoted 7 lines
Acked-by Jason Cooper <[email protected]>Acked-by Catalin Marinas <[email protected]>Acked-by Kukjin Kim <[email protected]>Tested-by Marek Szyprowski <[email protected]>Tested-by Leif Lindholm <[email protected]>Signed-off-by Laura Abbott <[email protected]>
A small comments below.
arch/arm/include/asm/setup.h static const struct tagtable __tagtable_##fn __tag = { tag, fn } · line 27
Quoted 7 lines
arch/arm/include/asm/setup.h +0
-0@@ -26,29 +26,6 @@ static const struct tagtable __tagtable_##fn __tag = { tag, fn }*/ #define NR_BANKS CONFIG_ARM_NR_BANKS
This may go as well now. Please consider this patch as well for your series:
Subject: [PATCH] arm: Get rid of NR_BANKS
This constant is no longer used, except in the atag_to_fdt compatibility layer where a local definition is now provided. This could be removed entirely i.e. having no limits but this is probably not worth it.
arch/arm/Kconfig +0 -5
@@ -1090,11 +1090,6 @@ source "arch/arm/firmware/Kconfig" source arch/arm/mm/Kconfig -config ARM_NR_BANKS - int - default 16 if ARCH_EP93XX - default 8 - config IWMMXT bool "Enable iWMMXt support" if !CPU_PJ4 depends on CPU_XSCALE || CPU_XSC3 || CPU_MOHAWK || CPU_PJ4
arch/arm/boot/compressed/atags_to_fdt.c +2 -0
@@ -7,6 +7,8 @@#define do_extend_cmdline 0#endif +#define NR_BANKS 16 +static int node_offset (void *fdt,const char *node_path) {int offset =fdt_path_offset (fdt, node_path);
arch/arm/include/asm/setup.h +0 -5
@@ -21,11 +21,6 @@#define __tagtable (tag, fn) \ static const struct tagtable __tagtable_##fn __tag = { tag, fn } -/* -* Memory map description -*/ -#define NR_BANKS CONFIG_ARM_NR_BANKS -extern int arm_add_memory (u64 start,u64 size);extern void early_print (const char *str, ...);extern void dump_machine_table (void );
Re: [PATCHv4 2/2] arm: Get rid of meminfo
In reply to Laura AbbottQuoted 5 lines · Laura Abbott
memblock is now fully integrated into the kernel and is the prefered method for tracking memory. Rather than reinvent the wheel with meminfo, migrate to using memblock directly instead of meminfo as an intermediate.
Quoted 7 lines
Acked-by Jason Cooper <[email protected]>Acked-by Catalin Marinas <[email protected]>Acked-by Kukjin Kim <[email protected]>Tested-by Marek Szyprowski <[email protected]>Tested-by Leif Lindholm <[email protected]>Signed-off-by Laura Abbott <[email protected]>
Laura,
This patch causes a bunch of platforms to no longer boot - imx6solo with 1GB of RAM boots, imx6q with 2GB of RAM doesn't. Versatile Express doesn't.
The early printk messages don't reveal anything too interesting:
Booting Linux on physical CPU 0x0
Linux version 3.14.0-rc6+ (rmk at rmk-PC.arm.linux.org.uk) (gcc version 4.6.4 (GCC) ) #630 SMP Wed Mar 12 01:13:36 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quad
cma: CMA: reserved 64 MiB at 8c000000
Memory policy: Data cache writealloc
<hang>
vs.
Booting Linux on physical CPU 0x0
Linux version 3.14.0-rc6+ (rmk at rmk-PC.arm.linux.org.uk) (gcc version 4.6.4 (GCC) ) #631 SMP Wed Mar 12 01:15:37 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quad
cma: CMA: reserved 64 MiB at 3b800000
Memory policy: Data cache writealloc
On node 0 totalpages: 524288free_area_init_node: node 0, pgdat c09d0240, node_mem_map ea7d8000
Normal zone: 1520 pages used for memmap
Normal zone: 0 pages reserved
Normal zone: 194560 pages, LIFO batch:31
HighMem zone: 2576 pages used for memmap
HighMem zone: 329728 pages, LIFO batch:31
...
The only obvious difference is the address of that CMA reservation, CMA shouldn't make a difference here - but I suspect that other allocations which need to be in lowmem probably aren't.
Signature · 2 lines
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly improving, and getting towards what was expected from it.
Re: [PATCHv4 2/2] arm: Get rid of meminfo
Hi Russell,
Quoted 48 lines · Russell King - ARM Linux
Quoted 5 lines · Laura Abbott
memblock is now fully integrated into the kernel and is the prefered method for tracking memory. Rather than reinvent the wheel with meminfo, migrate to using memblock directly instead of meminfo as an intermediate.
Quoted 7 lines
Acked-by Jason Cooper <[email protected]>Acked-by Catalin Marinas <[email protected]>Acked-by Kukjin Kim <[email protected]>Tested-by Marek Szyprowski <[email protected]>Tested-by Leif Lindholm <[email protected]>Signed-off-by Laura Abbott <[email protected]>Laura,
This patch causes a bunch of platforms to no longer boot - imx6solo with 1GB of RAM boots, imx6q with 2GB of RAM doesn't. Versatile Express doesn't.
The early printk messages don't reveal anything too interesting:
Booting Linux on physical CPU
0x0
Linux version 3.14.0-rc6+ ([email protected]) (gcc version 4.6.4 (GCC) ) #630 SMP Wed Mar 12 01:13:36 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quad
cma: CMA: reserved 64 MiB at8c000000
Memory policy: Data cache writealloc
<hang>vs.
Booting Linux on physical CPU
0x0
Linux version 3.14.0-rc6+ ([email protected]) (gcc version 4.6.4 (GCC) ) #631 SMP Wed Mar 12 01:15:37 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quad
cma: CMA: reserved 64 MiB at3b800000
Memory policy: Data cache writealloc
On node 0 totalpages: 524288free_area_init_node: node 0, pgdatc09d0240,node_mem_mapea7d8000
Normal zone: 1520 pages used for memmap
Normal zone: 0 pages reserved
Normal zone: 194560 pages, LIFO batch:31
HighMem zone: 2576 pages used for memmap
HighMem zone: 329728 pages, LIFO batch:31
...
Quoted 4 lines
The only obvious difference is the address of that CMA reservation, CMA shouldn't make a difference here - but I suspect that other allocations which need to be in lowmem probably aren't.
Could it be possible to enable memblock debug by adding "memblock=debug" in cmdline?
Regards,
-grygorii
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in the body to [email protected]. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"[email protected]"> [email protected] </a>
Re: [PATCHv4 2/2] arm: Get rid of meminfo
Quoted 51 lines · Grygorii Strashko
Hi Russell,
Quoted 48 lines · Russell King - ARM Linux
Quoted 5 lines · Laura Abbott
memblock is now fully integrated into the kernel and is the prefered method for tracking memory. Rather than reinvent the wheel with meminfo, migrate to using memblock directly instead of meminfo as an intermediate.
Quoted 7 lines
Acked-by Jason Cooper <[email protected]>Acked-by Catalin Marinas <[email protected]>Acked-by Kukjin Kim <[email protected]>Tested-by Marek Szyprowski <[email protected]>Tested-by Leif Lindholm <[email protected]>Signed-off-by Laura Abbott <[email protected]>Laura,
This patch causes a bunch of platforms to no longer boot - imx6solo with 1GB of RAM boots, imx6q with 2GB of RAM doesn't. Versatile Express doesn't.
The early printk messages don't reveal anything too interesting:
Booting Linux on physical CPU
0x0
Linux version 3.14.0-rc6+ (rmk at rmk-PC.arm.linux.org.uk) (gcc version 4.6.4 (GCC) ) #630 SMP Wed Mar 12 01:13:36 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quad
cma: CMA: reserved 64 MiB at8c000000
Memory policy: Data cache writealloc
<hang>vs.
Booting Linux on physical CPU
0x0
Linux version 3.14.0-rc6+ (rmk at rmk-PC.arm.linux.org.uk) (gcc version 4.6.4 (GCC) ) #631 SMP Wed Mar 12 01:15:37 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quad
cma: CMA: reserved 64 MiB at3b800000
Memory policy: Data cache writealloc
On node 0 totalpages: 524288free_area_init_node: node 0, pgdatc09d0240,node_mem_mapea7d8000
Normal zone: 1520 pages used for memmap
Normal zone: 0 pages reserved
Normal zone: 194560 pages, LIFO batch:31
HighMem zone: 2576 pages used for memmap
HighMem zone: 329728 pages, LIFO batch:31
...
Quoted 7 lines
Quoted 4 lines
The only obvious difference is the address of that CMA reservation, CMA shouldn't make a difference here - but I suspect that other allocations which need to be in lowmem probably aren't.
Could it be possible to enable memblock debug by adding "memblock=debug" in cmdline?
Here's with Laura's patch:
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU 0x0
Linux version 3.14.0-rc6+ (rmk at rmk-PC.arm.linux.org.uk) (gcc version 4.6.4 (GCC) ) #633 SMP Wed Mar 12 12:56:15 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quadmemblock_reserve: [0x00000010008240-0x0000001112c1f7] flags 0x0 arm_memblock_init+0x28/0x1a8memblock_reserve: [0x00000020000040-0x000000201caa57] flags 0x0 arm_memblock_init+0x108/0x1a8memblock_reserve: [0x00000010004000-0x00000010007fff] flags 0x0 arm_mm_memblock_reserve+0x1c/0x24memblock_reserve: [0x00000018000000-0x0000001800b07f] flags 0x0 arm_dt_memblock_reserve+0x2c/0x70memblock_reserve: [0x00000018000000-0x0000001800afff] flags 0x0 arm_dt_memblock_reserve+0x68/0x70memblock_reserve: [0x00000020000040-0x000000201caa57] flags 0x0 arm_dt_memblock_reserve+0x68/0x70memblock_reserve: [0x0000008c000000-0x0000008fffffff] flags 0x0 memblock_alloc_base_nid+0x40/0x54
cma: CMA: reserved 64 MiB at 8c000000
MEMBLOCK configuration:
memory size = 0x80000000 reserved size = 0x52fda50
memory.cnt = 0x1
memory[0x0] [0x00000010000000-0x0000008fffffff], 0x80000000 bytes flags: 0x06
reserved.cnt = 0x5
reserved[0x0] [0x00000010004000-0x00000010007fff], 0x4000 bytes flags: 0x0
reserved[0x1] [0x00000010008240-0x0000001112c1f7], 0x1123fb8 bytes flags: 0x0
reserved[0x2] [0x00000018000000-0x0000001800b07f], 0xb080 bytes flags: 0x0
reserved[0x3] [0x00000020000040-0x000000201caa57], 0x1caa18 bytes flags: 0x0
reserved[0x4] [0x0000008c000000-0x0000008fffffff], 0x4000000 bytes flags: 0x0
Memory policy: Data cache writeallocmemblock_reserve: [0x0000008bffffd8-0x0000008bffffff] flags 0x0 memblock_alloc_base_nid+0x40/0x54
Here's without:
Booting Linux on physical CPU 0x0
Linux version 3.14.0-rc6+ (rmk at rmk-PC.arm.linux.org.uk) (gcc version 4.6.4 (GCC) ) #635 SMP Wed Mar 12 13:22:15 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quadmemblock_reserve: [0x00000010008240-0x0000001112c277] flags 0x0 arm_memblock_init+0x54/0x1d4memblock_reserve: [0x00000020000040-0x000000201caa57] flags 0x0 arm_memblock_init+0x134/0x1d4memblock_reserve: [0x00000010004000-0x00000010007fff] flags 0x0 arm_mm_memblock_reserve+0x1c/0x24memblock_reserve: [0x00000018000000-0x0000001800b07f] flags 0x0 arm_dt_memblock_reserve+0x2c/0x70memblock_reserve: [0x00000018000000-0x0000001800afff] flags 0x0 arm_dt_memblock_reserve+0x68/0x70memblock_reserve: [0x00000020000040-0x000000201caa57] flags 0x0 arm_dt_memblock_reserve+0x68/0x70memblock_reserve: [0x0000003b800000-0x0000003f7fffff] flags 0x0 memblock_alloc_base_nid+0x40/0x54
cma: CMA: reserved 64 MiB at 3b800000
MEMBLOCK configuration:
memory size = 0x80000000 reserved size = 0x52fdad0
memory.cnt = 0x1
memory[0x0] [0x00000010000000-0x0000008fffffff], 0x80000000 bytes flags: 0x0
reserved.cnt = 0x5
reserved[0x0] [0x00000010004000-0x00000010007fff], 0x4000 bytes flags: 0x0 reserved[0x1] [0x00000010008240-0x0000001112c277], 0x1124038 bytes flags: 0x0 reserved[0x2] [0x00000018000000-0x0000001800b07f], 0xb080 bytes flags: 0x0 reserved[0x3] [0x00000020000040-0x000000201caa57], 0x1caa18 bytes flags: 0x0 reserved[0x4] [0x0000003b800000-0x0000003f7fffff], 0x4000000 bytes flags: 0x0
Memory policy: Data cache writeallocmemblock_reserve: [0x0000003b7fffd8-0x0000003b7fffff] flags 0x0 memblock_alloc_base_nid+0x40/0x54memblock_reserve: [0x0000003b7fe000-0x0000003b7fefff] flags 0x0 memblock_alloc_base_nid+0x40/0x54memblock_reserve: [0x0000003b7fd000-0x0000003b7fdfff] flags 0x0 memblock_alloc_base_nid+0x40/0x54memblock_reserve: [0x0000003b7fc000-0x0000003b7fcfff] flags 0x0 memblock_alloc_base_nid+0x40/0x54
...
So it looks like allocations which must come from lowmem aren't being limited to lowmem.
Try booting a machine with 2G of RAM with page offset set to 3GB and highmem enabled - it will fail as per the above.
In fact, if we look at sanity_check_meminfo() post that patch, it's clearly wrong:
for_each_memblock(memory, reg) {
phys_addr_t block_start = reg->base;
phys_addr_t block_end = reg->base + reg->size;
phys_addr_t size_limit = reg->size;
if (reg->base >= vmalloc_limit)
highmem = 1;
else
size_limit = vmalloc_limit - reg->base;
...
if (!highmem) {
if (block_end > arm_lowmem_limit)
arm_lowmem_limit = block_end;
...
}
}
high_memory = __va(arm_lowmem_limit - 1) + 1;What this appears to assume is that each block of memory in memblock is either totally in lowmem, or totally in highmem. This is not the case most of the time - blocks are most often split in two.
Apart from that, there's other problems:
for_each_memblock (memory, reg) {
unsigned int pfn1, pfn2;
struct page *page, *end;
pfn1 = memblock_region_memory_base_pfn(reg);
pfn2 = memblock_region_memory_end_pfn(reg);
page = pfn_to_page(pfn1);
end = pfn_to_page(pfn2 - 1) + 1;
do {
... dereference page ...
page++;
} while (page < end);
}Since memblock coalesces memory ranges together, when sparsemem is enabled, page...end may not be a continuous range of struct page
entries: they can be in different sparsemem banks. That's precisely why I never meminfo, because this split information is lost as soon as you push over to memblock - two meminfo banks which are contiguous are combined into one block by memblock and are not kept separate.
I made this point on 15th January, and that point remains valid and unaddressed.
Signature · 2 lines
FTTC broadband for 0.8mile line: [email protected] down 460kbps up... slowly improving, and getting towards what was expected from it.
Re: [PATCHv4 2/2] arm: Get rid of meminfo
Quoted 2 lines · Russell King - ARM Linux
Try booting a machine with 2G of RAM with page offset set to 3GB and highmem enabled - it will fail as per the above.
BTW, simple way to test this on any ARM platform:
Build with PAGE_OFFSET=3GB and highmem enabled. Pass vmalloc=1G on the kernel command line to force maximal vmalloc region (which should push lowmem down to the minimum of 32MB.) The remainder will be highmem.
Now, with Laura's patch applied, some platforms do boot but the result is rather odd:
vmalloc area is too big, limiting to 976MB
So, the vmalloc=1G has done the right thing here, but:
Memory: 507404K/523264K available (3839K kernel code, 230K rwdata, 1388K rodata, 211K init, 5266K bss, 15860K reserved, 0K highmem) Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xe0800000 - 0xff000000 ( 488 MB)
lowmem : 0xc0000000 - 0xe0000000 ( 512 MB)
pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
.text : 0xc0008000 - 0xc0522f34 (5228 kB)
.init : 0xc0523000 - 0xc0557fc0 ( 212 kB)
.data : 0xc0558000 - 0xc0591980 ( 231 kB)
.bss : 0xc0591988 - 0xc0ab6220 (5267 kB)something has overriden it, and we end up with no highmem. Without Laura's patch, it all behaves correctly:
vmalloc area is too big, limiting to 976MB
...
Memory: 507932K/523264K available (3839K kernel code, 230K rwdata, 1388K rodata, 211K init, 5266K bss, 15332K reserved, 490496K highmem) Virtual kernel memory layout:
vector : 0xffff0000 - 0xffff1000 ( 4 kB)
fixmap : 0xfff00000 - 0xfffe0000 ( 896 kB)
vmalloc : 0xc2800000 - 0xff000000 ( 968 MB)
lowmem : 0xc0000000 - 0xc2000000 ( 32 MB)
pkmap : 0xbfe00000 - 0xc0000000 ( 2 MB)
modules : 0xbf000000 - 0xbfe00000 ( 14 MB)
.text : 0xc0008000 - 0xc0522f34 (5228 kB)
.init : 0xc0523000 - 0xc0557fc0 ( 212 kB)
.data : 0xc0558000 - 0xc0591980 ( 231 kB)
.bss : 0xc0591988 - 0xc0ab6260 (5267 kB)So... the more I look at the boot results from last night's autobuild, the more stuff appears to be broken with this meminfo removal.
Therefore, I have to wonder what kind of testing was done with these patches - I suspect the test consisted of "does it boot" without looking at any of the details about what memory was where.
Signature · 2 lines
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly improving, and getting towards what was expected from it.
Re: [PATCHv4 2/2] arm: Get rid of meminfo
In reply to Russell King - ARM LinuxQuoted 130 lines · Russell King - ARM Linux
Quoted 51 lines · Grygorii Strashko
Hi Russell,
Quoted 48 lines · Russell King - ARM Linux
Quoted 5 lines · Laura Abbott
memblock is now fully integrated into the kernel and is the prefered method for tracking memory. Rather than reinvent the wheel with meminfo, migrate to using memblock directly instead of meminfo as an intermediate.
Quoted 7 lines
Acked-by Jason Cooper <[email protected]>Acked-by Catalin Marinas <[email protected]>Acked-by Kukjin Kim <[email protected]>Tested-by Marek Szyprowski <[email protected]>Tested-by Leif Lindholm <[email protected]>Signed-off-by Laura Abbott <[email protected]>Laura,
This patch causes a bunch of platforms to no longer boot - imx6solo with 1GB of RAM boots, imx6q with 2GB of RAM doesn't. Versatile Express doesn't.
The early printk messages don't reveal anything too interesting:
Booting Linux on physical CPU
0x0
Linux version 3.14.0-rc6+ ([email protected]) (gcc version 4.6.4 (GCC) ) #630 SMP Wed Mar 12 01:13:36 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quad
cma: CMA: reserved 64 MiB at8c000000
Memory policy: Data cache writealloc
<hang>vs.
Booting Linux on physical CPU
0x0
Linux version 3.14.0-rc6+ ([email protected]) (gcc version 4.6.4 (GCC) ) #631 SMP Wed Mar 12 01:15:37 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quad
cma: CMA: reserved 64 MiB at3b800000
Memory policy: Data cache writealloc
On node 0 totalpages: 524288free_area_init_node: node 0, pgdatc09d0240,node_mem_mapea7d8000
Normal zone: 1520 pages used for memmap
Normal zone: 0 pages reserved
Normal zone: 194560 pages, LIFO batch:31
HighMem zone: 2576 pages used for memmap
HighMem zone: 329728 pages, LIFO batch:31
...Quoted 7 lines
Quoted 4 lines
The only obvious difference is the address of that CMA reservation, CMA shouldn't make a difference here - but I suspect that other allocations which need to be in lowmem probably aren't.
Could it be possible to enable memblock debug by adding "memblock=debug" in cmdline?
Here's with Laura's patch:
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU0x0
Linux version 3.14.0-rc6+ ([email protected]) (gcc version 4.6.4 (GCC) ) #633 SMP Wed Mar 12 12:56:15 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quadmemblock_reserve: [0x00000010008240-0x0000001112c1f7] flags0x0arm_memblock_init+0x28/0x1a8memblock_reserve: [0x00000020000040-0x000000201caa57] flags0x0arm_memblock_init+0x108/0x1a8memblock_reserve: [0x00000010004000-0x00000010007fff] flags0x0arm_mm_memblock_reserve+0x1c/0x24memblock_reserve: [0x00000018000000-0x0000001800b07f] flags0x0arm_dt_memblock_reserve+0x2c/0x70memblock_reserve: [0x00000018000000-0x0000001800afff] flags0x0arm_dt_memblock_reserve+0x68/0x70memblock_reserve: [0x00000020000040-0x000000201caa57] flags0x0arm_dt_memblock_reserve+0x68/0x70memblock_reserve: [0x0000008c000000-0x0000008fffffff] flags0x0memblock_alloc_base_nid+0x40/0x54
cma: CMA: reserved 64 MiB at8c000000
MEMBLOCK configuration:
memory size =0x80000000reserved size =0x52fda50
memory.cnt =0x1
memory[0x0] [0x00000010000000-0x0000008fffffff],0x80000000bytes flags:0x06
reserved.cnt =0x5
reserved[0x0] [0x00000010004000-0x00000010007fff],0x4000bytes flags:0x0
reserved[0x1] [0x00000010008240-0x0000001112c1f7],0x1123fb8bytes flags:0x0
reserved[0x2] [0x00000018000000-0x0000001800b07f],0xb080bytes flags:0x0
reserved[0x3] [0x00000020000040-0x000000201caa57],0x1caa18bytes flags:0x0
reserved[0x4] [0x0000008c000000-0x0000008fffffff],0x4000000bytes flags:0x0
Memory policy: Data cache writeallocmemblock_reserve: [0x0000008bffffd8-0x0000008bffffff] flags0x0memblock_alloc_base_nid+0x40/0x54Here's without:
Booting Linux on physical CPU
0x0
Linux version 3.14.0-rc6+ ([email protected]) (gcc version 4.6.4 (GCC) ) #635 SMP Wed Mar 12 13:22:15 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quadmemblock_reserve: [0x00000010008240-0x0000001112c277] flags0x0arm_memblock_init+0x54/0x1d4memblock_reserve: [0x00000020000040-0x000000201caa57] flags0x0arm_memblock_init+0x134/0x1d4memblock_reserve: [0x00000010004000-0x00000010007fff] flags0x0arm_mm_memblock_reserve+0x1c/0x24memblock_reserve: [0x00000018000000-0x0000001800b07f] flags0x0arm_dt_memblock_reserve+0x2c/0x70memblock_reserve: [0x00000018000000-0x0000001800afff] flags0x0arm_dt_memblock_reserve+0x68/0x70memblock_reserve: [0x00000020000040-0x000000201caa57] flags0x0arm_dt_memblock_reserve+0x68/0x70memblock_reserve: [0x0000003b800000-0x0000003f7fffff] flags0x0memblock_alloc_base_nid+0x40/0x54
cma: CMA: reserved 64 MiB at3b800000
MEMBLOCK configuration:
memory size =0x80000000reserved size =0x52fdad0
memory.cnt =0x1
memory[0x0] [0x00000010000000-0x0000008fffffff],0x80000000bytes flags:0x0
reserved.cnt =0x5reserved[0x0] [0x00000010004000-0x00000010007fff], 0x4000 bytes flags: 0x0 reserved[0x1] [0x00000010008240-0x0000001112c277], 0x1124038 bytes flags: 0x0 reserved[0x2] [0x00000018000000-0x0000001800b07f], 0xb080 bytes flags: 0x0 reserved[0x3] [0x00000020000040-0x000000201caa57], 0x1caa18 bytes flags: 0x0 reserved[0x4] [0x0000003b800000-0x0000003f7fffff], 0x4000000 bytes flags: 0x0Memory policy: Data cache writealloc
memblock_reserve: [0x0000003b7fffd8-0x0000003b7fffff] flags0x0memblock_alloc_base_nid+0x40/0x54memblock_reserve: [0x0000003b7fe000-0x0000003b7fefff] flags0x0memblock_alloc_base_nid+0x40/0x54memblock_reserve: [0x0000003b7fd000-0x0000003b7fdfff] flags0x0memblock_alloc_base_nid+0x40/0x54memblock_reserve: [0x0000003b7fc000-0x0000003b7fcfff] flags0x0memblock_alloc_base_nid+0x40/0x54
...So it looks like allocations which must come from lowmem aren't being limited to lowmem.
Try booting a machine with 2G of RAM with page offset set to 3GB and highmem enabled - it will fail as per the above.
In fact, if we look at
sanity_check_meminfo()post that patch, it's clearly wrong:
Quoted 13 lines
for_each_memblock(memory, reg) {
phys_addr_t block_start = reg->base;
phys_addr_t block_end = reg->base + reg->size;
phys_addr_t size_limit = reg->size;
if (reg->base >= vmalloc_limit)
highmem = 1;
else
size_limit = vmalloc_limit - reg->base;
...
if (!highmem) {
if (block_end > arm_lowmem_limit)
arm_lowmem_limit = block_end;In v3, above was
arm_lowmem_limit = reg->base + size_limit;
so, it has worked somehow, even arm_lowmem_limit can point on non existed address. It was changed because of my comment - sorry.
I think, it should be smth like:
if (!highmem) {
if (block_end > arm_lowmem_limit)
if (reg->size > size_limit)
arm_lowmem_limit = vmalloc_limit;
else
arm_lowmem_limit = block_end;I've created and attached the patch which allows me to boot on keystone.
Quoted 2 lines
...
}
regards,
-grygorii
Re: [PATCHv4 2/2] arm: Get rid of meminfo
Quoted 198 lines · Grygorii Strashko
Quoted 130 lines · Russell King - ARM Linux
Quoted 51 lines · Grygorii Strashko
Hi Russell,
Quoted 48 lines · Russell King - ARM Linux
Quoted 5 lines · Laura Abbott
memblock is now fully integrated into the kernel and is the prefered method for tracking memory. Rather than reinvent the wheel with meminfo, migrate to using memblock directly instead of meminfo as an intermediate.
Quoted 7 lines
Acked-by Jason Cooper <[email protected]>Acked-by Catalin Marinas <[email protected]>Acked-by Kukjin Kim <[email protected]>Tested-by Marek Szyprowski <[email protected]>Tested-by Leif Lindholm <[email protected]>Signed-off-by Laura Abbott <[email protected]>Laura,
This patch causes a bunch of platforms to no longer boot - imx6solo with 1GB of RAM boots, imx6q with 2GB of RAM doesn't. Versatile Express doesn't.
The early printk messages don't reveal anything too interesting:
Booting Linux on physical CPU
0x0
Linux version 3.14.0-rc6+ (rmk at rmk-PC.arm.linux.org.uk) (gcc version 4.6.4 (GCC) ) #630 SMP Wed Mar 12 01:13:36 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quad
cma: CMA: reserved 64 MiB at8c000000
Memory policy: Data cache writealloc
<hang>vs.
Booting Linux on physical CPU
0x0
Linux version 3.14.0-rc6+ (rmk at rmk-PC.arm.linux.org.uk) (gcc version 4.6.4 (GCC) ) #631 SMP Wed Mar 12 01:15:37 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quad
cma: CMA: reserved 64 MiB at3b800000
Memory policy: Data cache writealloc
On node 0 totalpages: 524288free_area_init_node: node 0, pgdatc09d0240,node_mem_mapea7d8000
Normal zone: 1520 pages used for memmap
Normal zone: 0 pages reserved
Normal zone: 194560 pages, LIFO batch:31
HighMem zone: 2576 pages used for memmap
HighMem zone: 329728 pages, LIFO batch:31
...Quoted 7 lines
Quoted 4 lines
The only obvious difference is the address of that CMA reservation, CMA shouldn't make a difference here - but I suspect that other allocations which need to be in lowmem probably aren't.
Could it be possible to enable memblock debug by adding "memblock=debug" in cmdline?
Here's with Laura's patch:
Uncompressing Linux... done, booting the kernel.
Booting Linux on physical CPU0x0
Linux version 3.14.0-rc6+ (rmk at rmk-PC.arm.linux.org.uk) (gcc version 4.6.4 (GCC) ) #633 SMP Wed Mar 12 12:56:15 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quadmemblock_reserve: [0x00000010008240-0x0000001112c1f7] flags0x0arm_memblock_init+0x28/0x1a8memblock_reserve: [0x00000020000040-0x000000201caa57] flags0x0arm_memblock_init+0x108/0x1a8memblock_reserve: [0x00000010004000-0x00000010007fff] flags0x0arm_mm_memblock_reserve+0x1c/0x24memblock_reserve: [0x00000018000000-0x0000001800b07f] flags0x0arm_dt_memblock_reserve+0x2c/0x70memblock_reserve: [0x00000018000000-0x0000001800afff] flags0x0arm_dt_memblock_reserve+0x68/0x70memblock_reserve: [0x00000020000040-0x000000201caa57] flags0x0arm_dt_memblock_reserve+0x68/0x70memblock_reserve: [0x0000008c000000-0x0000008fffffff] flags0x0memblock_alloc_base_nid+0x40/0x54
cma: CMA: reserved 64 MiB at8c000000
MEMBLOCK configuration:memory size = 0x80000000 reserved size = 0x52fda50 memory.cnt = 0x1 memory[0x0] [0x00000010000000-0x0000008fffffff], 0x80000000 bytes flags: 0x06 reserved.cnt = 0x5 reserved[0x0] [0x00000010004000-0x00000010007fff], 0x4000 bytes flags: 0x0 reserved[0x1] [0x00000010008240-0x0000001112c1f7], 0x1123fb8 bytes flags: 0x0 reserved[0x2] [0x00000018000000-0x0000001800b07f], 0xb080 bytes flags: 0x0 reserved[0x3] [0x00000020000040-0x000000201caa57], 0x1caa18 bytes flags: 0x0 reserved[0x4] [0x0000008c000000-0x0000008fffffff], 0x4000000 bytes flags: 0x0Memory policy: Data cache writealloc
memblock_reserve: [0x0000008bffffd8-0x0000008bffffff] flags0x0memblock_alloc_base_nid+0x40/0x54Here's without:
Booting Linux on physical CPU
0x0
Linux version 3.14.0-rc6+ (rmk at rmk-PC.arm.linux.org.uk) (gcc version 4.6.4 (GCC) ) #635 SMP Wed Mar 12 13:22:15 GMT 2014
CPU: ARMv7 Processor [412fc09a] revision 10 (ARMv7), cr=10c53c7d
CPU: PIPT / VIPT nonaliasing data cache, VIPT aliasing instruction cache
Machine model: SolidRun Cubox-i Dual/Quadmemblock_reserve: [0x00000010008240-0x0000001112c277] flags0x0arm_memblock_init+0x54/0x1d4memblock_reserve: [0x00000020000040-0x000000201caa57] flags0x0arm_memblock_init+0x134/0x1d4memblock_reserve: [0x00000010004000-0x00000010007fff] flags0x0arm_mm_memblock_reserve+0x1c/0x24memblock_reserve: [0x00000018000000-0x0000001800b07f] flags0x0arm_dt_memblock_reserve+0x2c/0x70memblock_reserve: [0x00000018000000-0x0000001800afff] flags0x0arm_dt_memblock_reserve+0x68/0x70memblock_reserve: [0x00000020000040-0x000000201caa57] flags0x0arm_dt_memblock_reserve+0x68/0x70memblock_reserve: [0x0000003b800000-0x0000003f7fffff] flags0x0memblock_alloc_base_nid+0x40/0x54
cma: CMA: reserved 64 MiB at3b800000
MEMBLOCK configuration:memory size = 0x80000000 reserved size = 0x52fdad0 memory.cnt = 0x1 memory[0x0] [0x00000010000000-0x0000008fffffff], 0x80000000 bytes flags: 0x0 reserved.cnt = 0x5 reserved[0x0] [0x00000010004000-0x00000010007fff], 0x4000 bytes flags: 0x0 reserved[0x1] [0x00000010008240-0x0000001112c277], 0x1124038 bytes flags: 0x0 reserved[0x2] [0x00000018000000-0x0000001800b07f], 0xb080 bytes flags: 0x0 reserved[0x3] [0x00000020000040-0x000000201caa57], 0x1caa18 bytes flags: 0x0 reserved[0x4] [0x0000003b800000-0x0000003f7fffff], 0x4000000 bytes flags: 0x0Memory policy: Data cache writealloc
memblock_reserve: [0x0000003b7fffd8-0x0000003b7fffff] flags0x0memblock_alloc_base_nid+0x40/0x54memblock_reserve: [0x0000003b7fe000-0x0000003b7fefff] flags0x0memblock_alloc_base_nid+0x40/0x54memblock_reserve: [0x0000003b7fd000-0x0000003b7fdfff] flags0x0memblock_alloc_base_nid+0x40/0x54memblock_reserve: [0x0000003b7fc000-0x0000003b7fcfff] flags0x0memblock_alloc_base_nid+0x40/0x54
...So it looks like allocations which must come from lowmem aren't being limited to lowmem.
Try booting a machine with 2G of RAM with page offset set to 3GB and highmem enabled - it will fail as per the above.
In fact, if we look at
sanity_check_meminfo()post that patch, it's clearly wrong:Quoted 13 lines
for_each_memblock(memory, reg) { phys_addr_t block_start = reg->base; phys_addr_t block_end = reg->base + reg->size; phys_addr_t size_limit = reg->size; if (reg->base >= vmalloc_limit) highmem = 1; else size_limit = vmalloc_limit - reg->base; ... if (!highmem) { if (block_end > arm_lowmem_limit) arm_lowmem_limit = block_end;In v3, above was
arm_lowmem_limit = reg->base + size_limit;so, it has worked somehow, even
arm_lowmem_limitcan point on non existed address. It was changed because of my comment - sorry.I think, it should be smth like:
if (!highmem) { if (block_end > arm_lowmem_limit) if (reg->size > size_limit) arm_lowmem_limit = vmalloc_limit; else arm_lowmem_limit = block_end;I've created and attached the patch which allows me to boot on keystone.
Quoted 2 lines
...
}regards,
-grygoriiFrom
3a210330f15c4cfc6728d83b28750c696d9eaefbMon Sep 17 00:00:00 2001
From: Grygorii Strashko <x0174654@uglx0174654.(none)>
Date: Wed, 12 Mar 2014 18:04:02 +0200
Subject: [PATCH] arm: get rid of meminfo: fixlowmem_limitcalculationSigned-off-by Grygorii Strashko <x0174654@uglx0174654.(none)>--- arch/arm/mm/mmu.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)arch/arm/mm/mmu.c +6
-2@@ -1096,8 +1096,12 @@ void __init sanity_check_meminfo(void) }if (!highmem) { -if (block_end > arm_lowmem_limit) - arm_lowmem_limit = block_end; +if (block_end > arm_lowmem_limit) { +if (reg->size > size_limit) + arm_lowmem_limit = vmalloc_limit; +else + arm_lowmem_limit = block_end; + }/*
arch/arm/mm/mmu.c void __init sanity_check_meminfo(void) · line 1127
Quoted 8 lines
arch/arm/mm/mmu.c +1
-1@@ -1117,7 +1121,7 @@ void __init sanity_check_meminfo(void)if (!IS_ALIGNED (block_start,SECTION_SIZE )) memblock_limit = block_start;else if (!IS_ALIGNED (block_end,SECTION_SIZE )) - memblock_limit = block_end; + memblock_limit = arm_lowmem_limit; } }
Thanks Grygorii and Russell. v5 is on my TODO list for either later this week or next.
Laura
Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Re: [PATCHv4 2/2] arm: Get rid of meminfo
In reply to Laura AbbottQuoted 135 lines · Laura Abbott
arch/arm/mm/mmu.c +31
-76@@ -1061,74 +1061,44 @@ phys_addr_t arm_lowmem_limit __initdata = 0;void __init sanity_check_meminfo (void ) {phys_addr_t memblock_limit =0 ; -int i, j, highmem =0 ; +int highmem =0 ;phys_addr_t vmalloc_limit =__pa (vmalloc_min -1 ) +1 ; +struct memblock_region *reg; -for (i =0 , j =0 ; i < meminfo.nr_banks; i++) { -struct membank *bank = &meminfo.bank[j]; -phys_addr_t size_limit; - - *bank = meminfo.bank[i]; - size_limit = bank->size; +for_each_memblock (memory, reg) { +phys_addr_t block_start = reg->base; +phys_addr_t block_end = reg->base + reg->size; +phys_addr_t size_limit = reg->size; -if (bank->start >= vmalloc_limit) +if (reg->base >= vmalloc_limit) highmem =1 ;else - size_limit = vmalloc_limit - bank->start; + size_limit = vmalloc_limit - reg->base; - bank->highmem = highmem; -#ifdef CONFIG_HIGHMEM -/* -* Split those memory banks which are partially overlapping -* the vmalloc area greatly simplifying things later. -*/ -if (!highmem && bank->size > size_limit) { -if (meminfo.nr_banks >=NR_BANKS ) { -printk (KERN_CRIT "NR_BANKS too low, " -"ignoring high memory\n" ); - }else { -memmove (bank +1 , bank, - (meminfo.nr_banks - i) *sizeof (*bank)); - meminfo.nr_banks++; - i++; - bank[1 ].size -= size_limit; - bank[1 ].start = vmalloc_limit; - bank[1 ].highmem = highmem =1 ; - j++; +if (!IS_ENABLED (CONFIG_HIGHMEM ) ||cache_is_vipt_aliasing ()) { + +if (highmem) { +pr_notice ("Ignoring RAM at %pa-%pa (!CONFIG_HIGHMEM)\n" , + &block_start, &block_end); +memblock_remove (reg->base, reg->size); +continue ; } - bank->size = size_limit; - } -#else -/* -* Highmem banks not allowed with !CONFIG_HIGHMEM. -*/ -if (highmem) { -printk (KERN_NOTICE "Ignoring RAM at %.8llx-%.8llx " -"(!CONFIG_HIGHMEM).\n" , - (unsigned long long )bank->start, - (unsigned long long )bank->start + bank->size -1 ); -continue ; - } -/* -* Check whether this memory bank would partially overlap -* the vmalloc area. -*/ -if (bank->size > size_limit) { -printk (KERN_NOTICE "Truncating RAM at %.8llx-%.8llx " -"to -%.8llx (vmalloc region overlap).\n" , - (unsigned long long )bank->start, - (unsigned long long )bank->start + bank->size -1 , - (unsigned long long )bank->start + size_limit -1 ); - bank->size = size_limit; +if (reg->size > size_limit) { +phys_addr_t overlap_size = reg->size - size_limit; + +pr_notice ("Truncating RAM at %pa-%pa to -%pa" , + &block_start, &block_end, &vmalloc_limit); +memblock_remove (vmalloc_limit, overlap_size); + block_end = vmalloc_limit; + } } -#endif -if (!bank->highmem) { -phys_addr_t bank_end = bank->start + bank->size; -if (bank_end > arm_lowmem_limit) - arm_lowmem_limit = bank_end; +if (!highmem) { +if (block_end > arm_lowmem_limit) + arm_lowmem_limit = block_end; +/* * Find the first non-section-aligned page, and point @@ -1144,35 +1114,16 @@ void __init sanity_check_meminfo(void)* occurs before any free memory is mapped. */ if (!memblock_limit) { -if (!IS_ALIGNED (bank->start,SECTION_SIZE )) - memblock_limit = bank->start; -else if (!IS_ALIGNED (bank_end,SECTION_SIZE )) - memblock_limit = bank_end; +if (!IS_ALIGNED (block_start,SECTION_SIZE )) + memblock_limit = block_start; +else if (!IS_ALIGNED (block_end,SECTION_SIZE )) + memblock_limit = block_end; } - } - j++; - } -#ifdef CONFIG_HIGHMEM -if (highmem) { -const char *reason =NULL ; -if (cache_is_vipt_aliasing ()) { -/* -* Interactions between kmap and other mappings -* make highmem support with aliasing VIPT caches -* rather difficult. -*/ - reason ="with VIPT aliasing cache" ; - } -if (reason) {
arch/arm/mm/mmu.c void __init sanity_check_meminfo(void) · line 1126
Quoted 10 lines
arch/arm/mm/mmu.c +2
-6-printk (KERN_CRIT "HIGHMEM is not supported %s, ignoring high memory\n" , - reason); -while (j >0 && meminfo.bank[j -1 ].highmem) - j--; } + } -#endif - meminfo.nr_banks = j; +
Adding here:
if (arm_lowmem_limit > vmalloc_limit) arm_lowmem_limit = vmalloc_limit;
fixes the booting problems, because we now properly calculate the end of lowmem rather than letting it overflow - previously, the code would set the end of lowmem to be the end of the first memblock which is quite obviously wrong when you could have any size of memory in that block.
BTW, for a v4 patch, please clean up the excess blank lines in this patch.
Thanks.
Signature · 2 lines
FTTC broadband for 0.8mile line: now at 9.7Mbps down 460kbps up... slowly improving, and getting towards what was expected from it.