Skip to contentSkip to conversation

Remove ARM meminfo

PATCH In review Laura Abbott 3 participants 10 messages Apr 3, 2014 – Jun 27, 2014

Subsystems (9)
lore
Share & tools
lore
#0 lore raw

v5 cover Remove ARM meminfo

Hi,

This is v5 of the series to remove meminfo and use memblock directly. This has been validated with/without highmem although SPARSEMEM has not been validated. Reviews/testing welcome.

Thanks,
Laura

v5: Folded in patch from Nicolas, addressed several issues found by Russell with fixes suggested by Grygorii. Whitespace cleanup.

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/Kconfig                         |   5 --
 arch/arm/boot/compressed/atags_to_fdt.c  |   2 +
 arch/arm/include/asm/mach/arch.h         |   4 +-
 arch/arm/include/asm/memblock.h          |   3 +-
 arch/arm/include/asm/setup.h             |  28 --------
 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                       |  72 ++++++++-----------
 arch/arm/mm/mmu.c                        | 117 +++++++++----------------------
 arch/arm/mm/nommu.c                      |  66 +++++++++--------
 include/linux/memblock.h                 |   2 +
 mm/memblock.c                            |   5 ++
 38 files changed, 186 insertions(+), 333 deletions(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#1 lore raw

PATCH v5 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(+)
include/linux/memblock.h +2 -0
index 1ef6636..8a20a51 100644
@@ -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
index 39a31e7..7fe5354 100644
@@ -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 · 8 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>
#2 lore raw

PATCH v5 2/2 arm: Get rid of meminfo

In reply to 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.

---
 arch/arm/Kconfig                         |   5 --
 arch/arm/boot/compressed/atags_to_fdt.c  |   2 +
 arch/arm/include/asm/mach/arch.h         |   4 +-
 arch/arm/include/asm/memblock.h          |   3 +-
 arch/arm/include/asm/setup.h             |  28 --------
 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                       |  72 ++++++++-----------
 arch/arm/mm/mmu.c                        | 117 +++++++++----------------------
 arch/arm/mm/nommu.c                      |  66 +++++++++--------
 36 files changed, 179 insertions(+), 333 deletions(-)
arch/arm/Kconfig +0 -5
index afc751f..f59cc28 100644
@@ -1089,11 +1089,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
index d1153c8..9448aa0 100644
@@ -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/mach/arch.h +1 -3
index 17a3fa2..c43473a 100644
@@ -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
index c2f5102..bf47a6c 100644
@@ -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 -28
index 8d6a089..e0adb9f 100644
@@ -21,34 +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
-
-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
index 8c14de8..7807ef5 100644
@@ -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
index c7419a5..679a83d 100644
@@ -27,11 +27,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
index 50e198c..6d78ba4 100644
@@ -628,15 +628,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.
@@ -677,17 +670,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;
 }
 
@@ -695,6 +688,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;
@@ -709,7 +703,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;
@@ -854,13 +849,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
@@ -903,12 +891,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
index 221b9de..94a7add 100644
@@ -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
index 0776098..f9828f8 100644
@@ -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
index 67b7337..0cf0e51 100644
@@ -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
index 9669cc0..de86ab6 100644
@@ -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
index eb1fa5c..cdee08c 100644
@@ -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
index a775298..61bfe58 100644
@@ -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
index 7d9981c..873c3ca 100644
@@ -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
index 46de789..b621b23 100644
@@ -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
index 3276051..e509679 100644
@@ -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
index 015d544..58826cf 100644
@@ -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
index 3f1de11..6bbb7b5 100644
@@ -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
index f565f99..175ec4c 100644
@@ -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
index 584439bf..4d3588d 100644
@@ -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
index 57d60542..91dd1c7 100644
@@ -34,6 +34,7 @@
 #include <linux/input/matrix_keypad.h>
 #include <linux/gpio_keys.h>
 #include <linux/module.h>
+#include <linux/memblock.h>
 #include <video/w100fb.h>
 
 #include <asm/setup.h>
@@ -753,16 +754,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
index 8280ebca..cfb8641 100644
@@ -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
index aedf053..1319916 100644
@@ -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
index 0b11c1a..840c3a4 100644
@@ -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
index ef5557b..c158a6e 100644
@@ -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
index 1d5ee5c..c2fae3a 100644
@@ -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
index 602ca5e..844946d 100644
@@ -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
index c5eade7..6abf6a0 100644
@@ -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
index 9d75493..60d322a 100644
@@ -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
index a38f8a0..fb3b80e 100644
@@ -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
index 6b706c9..9104c2b 100644
@@ -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
index 8443a27..7dd894e 100644
@@ -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 +28 -44

151 lines not on this page · raw message

arch/arm/mm/mmu.c +35 -82

144 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
Tested-by on v5 2/2
#3 lore raw

Re: [PATCHv5 2/2] arm: Get rid of meminfo

Quoted 11 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.

Tiny nit-picking comment below, but this patch looks really good. What's the state on merging this?

Quoted 26 lines
arch/arm/mm/init.c +5 -7
index 97c293e..40e14a1 100644
@@ -415,54 +400,53 @@ free_memmap(unsigned long start_pfn, unsigned long end_pfn)
 /*
  * The mem_map array can get very big.  Free the unused area of the memory map.
  */
-static void __init free_unused_memmap(struct meminfo *mi)
+static void __init free_unused_memmap(void)
 {
-	unsigned long bank_start, prev_bank_end = 0;
-	unsigned int i;
+	unsigned long start, prev_end = 0;
+	struct memblock_region *reg;
 
 	/*
 	 * This relies on each bank being in address order.
 	 * The banks are sorted previously in bootmem_init().
 	 */
-	for_each_bank(i, mi) {
-		struct membank *bank = &mi->bank[i];
-
-		bank_start = bank_pfn_start(bank);
+	for_each_memblock(memory, reg) {
+		start = memblock_region_memory_base_pfn(reg);

arch/arm/mm/init.c free_memmap(unsigned long start_pfn, unsigned long end_pfn) · line 421

Quoted 10 lines
arch/arm/mm/init.c +2 -2
 
 #ifdef CONFIG_SPARSEMEM
 		/*
 		 * Take care not to free memmap entries that don't exist
 		 * due to SPARSEMEM sections which aren't present.
 		 */
-		bank_start = min(bank_start,
-				 ALIGN(prev_bank_end, PAGES_PER_SECTION));
+		start = min(start,
+				 ALIGN(prev_end, PAGES_PER_SECTION));

Nit: The line doesn't need to be split anymore.

Quoted 25 lines
arch/arm/mm/init.c +4 -4
 #else
 		/*
 		 * Align down here since the VM subsystem insists that the
 		 * memmap entries are valid from the bank start aligned to
 		 * MAX_ORDER_NR_PAGES.
 		 */
-		bank_start = round_down(bank_start, MAX_ORDER_NR_PAGES);
+		start = round_down(start, MAX_ORDER_NR_PAGES);
 #endif
 		/*
 		 * If we had a previous bank, and there is a space
 		 * between the current bank and the previous, free it.
 		 */
-		if (prev_bank_end && prev_bank_end < bank_start)
-			free_memmap(prev_bank_end, bank_start);
+		if (prev_end && prev_end < start)
+			free_memmap(prev_end, start);
 
 		/*
 		 * Align up here since the VM subsystem insists that the
 		 * memmap entries are valid from the bank end aligned to
 		 * MAX_ORDER_NR_PAGES.
 		 */
-		prev_bank_end = ALIGN(bank_pfn_end(bank), MAX_ORDER_NR_PAGES);
+		prev_end = ALIGN(memblock_region_memory_end_pfn(reg),

arch/arm/mm/init.c free_memmap(unsigned long start_pfn, unsigned long end_pfn) · line 449

Quoted 10 lines
arch/arm/mm/init.c +4 -3
+				 MAX_ORDER_NR_PAGES);
 	}
 
 #ifdef CONFIG_SPARSEMEM
-	if (!IS_ALIGNED(prev_bank_end, PAGES_PER_SECTION))
-		free_memmap(prev_bank_end,
-			    ALIGN(prev_bank_end, PAGES_PER_SECTION));
+	if (!IS_ALIGNED(prev_end, PAGES_PER_SECTION))
+		free_memmap(prev_end,
+			    ALIGN(prev_end, PAGES_PER_SECTION));

Ditto

#4 lore raw

Re: [PATCHv5 2/2] arm: Get rid of meminfo

Quoted 13 lines · Grant Likely
Quoted 11 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 5 lines

Tiny nit-picking comment below, but this patch looks really good. What's the state on merging this?

I put this into the patch system as 8025/1 a few weeks ago. I've been busy/on vacation so I haven't had a chance to follow up since then.

Laura

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation
#5 lore raw

Re: [PATCHv5 2/2] arm: Get rid of meminfo

In reply to Laura Abbott
Quoted 4 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.

This patch is in 3.16-rc1 as 1c2f87c22566cd057bc8cde10c37ae9da1a1bb76 now.

Unfortunately it makes my efm32 machine unbootable.

With earlyprintk enabled I get the following output:

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 3.15.0-rc1-00028-g1c2f87c22566-dirty (ukleinek at perseus) (gcc version 4.7.2 (OSELAS.Toolchain-2012.12.1) ) #280 PREEMPT Mon Jun 23 11:05:34 CEST 2014
[    0.000000] CPU: ARMv7-M [412fc231] revision 1 (ARMv7M), cr=00000000
[    0.000000] CPU: unknown data cache, unknown instruction cache
[    0.000000] Machine model: Energy Micro Giant Gecko Development Kit
[    0.000000] debug: ignoring loglevel setting.
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] On node 0 totalpages: 1024
[    0.000000] free_area_init_node: node 0, pgdat 880208f4, node_mem_map 00000000
[    0.000000]   Normal zone: 3840 pages exceeds freesize 1024
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 1024 pages, LIFO batch:0
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 1024
[    0.000000] Kernel command line: console=ttyefm4,115200 init=/linuxrc ignore_loglevel ihash_entries=64 dhash_entries=64 earlyprintk uclinux.physaddr=0x8c400000 root=/dev/mtdblock0
[    0.000000] PID hash table entries: 16 (order: -6, 64 bytes)
[    0.000000] Dentry cache hash table entries: 64 (order: -4, 256 bytes)
[    0.000000] Inode-cache hash table entries: 64 (order: -4, 256 bytes)
[    0.000000] Memory: 0K/4096K available (1156K kernel code, 83K rwdata, 316K rodata, 56K init, 43K bss, 212K reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0x00000000 - 0x00001000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
[    0.000000]     vmalloc : 0x00000000 - 0xffffffff   (4095 MB)
[    0.000000]     lowmem  : 0x88000000 - 0x88400000   (   4 MB)
[    0.000000]       .text : 0x8c000000 - 0x8c170360   (1473 kB)
[    0.000000]       .init : 0x8800a000 - 0x8800e000   (  16 kB)
[    0.000000]       .data : 0x88008000 - 0x88020f80   ( 100 kB)
[    0.000000]        .bss : 0x88020f8c - 0x8802bf5c   (  44 kB)
[    0.000000] swapper: page allocation failure: order:0, mode:0x200000
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.15.0-rc1-00028-g1c2f87c22566-dirty #280
[    0.000000] [<8c002b95>] (unwind_backtrace) from [<8c001f0b>] (show_stack+0xb/0xc)
[    0.000000] [<8c001f0b>] (show_stack) from [<8c02e997>] (warn_alloc_failed+0x95/0xba)
[    0.000000] [<8c02e997>] (warn_alloc_failed) from [<8c02ff6b>] (__alloc_pages_nodemask+0x437/0x484)
[    0.000000] [<8c02ff6b>] (__alloc_pages_nodemask) from [<8c03b7b5>] (new_slab+0x51/0x184)
[    0.000000] [<8c03b7b5>] (new_slab) from [<8c03c1b5>] (__kmem_cache_create+0x5d/0x12c)
[    0.000000] [<8c03c1b5>] (__kmem_cache_create) from [<8c174667>] (create_boot_cache+0x23/0x3c)
[    0.000000] [<8c174667>] (create_boot_cache) from [<8c1751af>] (kmem_cache_init+0x23/0x88)
[    0.000000] [<8c1751af>] (kmem_cache_init) from [<8c17078b>] (start_kernel+0xfb/0x210)
[    0.000000] [<8c17078b>] (start_kernel) from [<8c000023>] (0x8c000023)
[    0.000000] Mem-info:
[    0.000000] Normal per-cpu:
[    0.000000] CPU    0: hi:    0, btch:   1 usd:   0
[    0.000000] active_anon:0 inactive_anon:0 isolated_anon:0
[    0.000000]  active_file:0 inactive_file:0 isolated_file:0
[    0.000000]  unevictable:0 dirty:0 writeback:0 unstable:0
[    0.000000]  free:0 slab_reclaimable:0 slab_unreclaimable:0
[    0.000000]  mapped:0 shmem:0 pagetables:0 bounce:0
[    0.000000]  free_cma:0
[    0.000000] Normal free:0kB min:0kB low:0kB high:0kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:4096kB managed:2776kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes
[    0.000000] lowmem_reserve[]: 0 0
[    0.000000] Normal: 0*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB = 0kB
[    0.000000] 0 total pagecache pages
[    0.000000] 
[    0.000000] Unhandled exception: IPSR = 00000003 LR = fffffff1
[    0.000000] 
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.15.0-rc1-00028-g1c2f87c22566-dirty #280
[    0.000000] task: 88015950 ti: 88008000 task.ti: 88008000
[    0.000000] PC is at show_mem+0x96/0x150
[    0.000000] LR is at 0x880251e0
[    0.000000] pc : [<8c00359a>]    lr : [<880251e0>]    psr: 0100000b
[    0.000000] sp : 88009e68  ip : 00088000  fp : 4100f101
[    0.000000] r10: 00000080  r9 : f7ff0047  r8 : 00000001
[    0.000000] r7 : 00000001  r6 : d0fb0f3f  r5 : 00000000  r4 : 00000000
[    0.000000] r3 : 00000060  r2 : 88025238  r1 : 00000004  r0 : 8801a2e4
[    0.000000] xPSR: 0100000b
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.15.0-rc1-00028-g1c2f87c22566-dirty #280
[    0.000000] [<8c002b95>] (unwind_backtrace) from [<8c001f0b>] (show_stack+0xb/0xc)
[    0.000000] [<8c001f0b>] (show_stack) from [<8c002547>] (__invalid_entry+0x4b/0x4c)

(The -dirty is just:

arch/arm/include/asm/memory.h +1 -1
index 2b751464d6ff..9536c9ec6f43 100644
@@ -92,7 +92,7 @@
  * Fortunately, there is no reference for this in noMMU mode, for now.
  */
 #ifndef TASK_SIZE
-#define TASK_SIZE              (CONFIG_DRAM_SIZE)
+#define TASK_SIZE              UL(0xffffffff)
 #endif
 
 #ifndef TASK_UNMAPPED_BASE

which is needed to make nommu machines boot.)

Any idea?

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#6 lore raw

Re: [PATCHv5 2/2] arm: Get rid of meminfo

Quoted 11 lines · Uwe Kleine-K?nig
Quoted 4 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.

This patch is in 3.16-rc1 as 1c2f87c22566cd057bc8cde10c37ae9da1a1bb76 now.

Unfortunately it makes my efm32 machine unbootable.

With earlyprintk enabled I get the following output:

In case someone needs it, here is the bootlog with memblock_debug = 1 (I changed this in the source as this is the easier change than modifying the command line):

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 3.15.0-rc1-00028-g1c2f87c22566-dirty (ukleinek at perseus) (gcc version 4.7.2 (OSELAS.Toolchain-2012.12.1) ) #280 PREEMPT Mon Jun 23 11:05:34 CEST 2014
[    0.000000] CPU: ARMv7-M [412fc231] revision 1 (ARMv7M), cr=00000000
[    0.000000] CPU: unknown data cache, unknown instruction cache
[    0.000000] Machine model: Energy Micro Giant Gecko Development Kit
[    0.000000] debug: ignoring loglevel setting.
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] On node 0 totalpages: 1024
[    0.000000] free_area_init_node: node 0, pgdat 880208f4, node_mem_map 00000000
[    0.000000]   Normal zone: 3840 pages exceeds freesize 1024
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 1024 pages, LIFO batch:0
Gecko
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 3.15.0-rc1-00028-g1c2f87c22566-dirty (ukleinek at perseus) (gcc version 4.7.2 (OSELAS.Toolchain-2012.12.1) ) #281 PREEMPT Mon Jun 23 11:21:49 CEST 2014
[    0.000000] CPU: ARMv7-M [412fc231] revision 1 (ARMv7M), cr=00000000
[    0.000000] CPU: unknown data cache, unknown instruction cache
[    0.000000] Machine model: Energy Micro Giant Gecko Development Kit
[    0.000000] debug: ignoring loglevel setting.
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] memblock_reserve: [0x00000088008000-0x0000008802bf3b] flags 0x0 arm_memblock_init+0xf/0x48
[    0.000000] memblock_reserve: [0x00000010000000-0x000000100010fd] flags 0x0 arm_dt_memblock_reserve+0x11/0x40
[    0.000000] MEMBLOCK configuration:
[    0.000000]  memory size = 0x400000 reserved size = 0x2503a
[    0.000000]  memory.cnt  = 0x1
[    0.000000]  memory[0x0]	[0x00000088000000-0x000000883fffff], 0x400000 bytes flags: 0x0
[    0.000000]  reserved.cnt  = 0x2
[    0.000000]  reserved[0x0]	[0x00000010000000-0x000000100010fd], 0x10fe bytes flags: 0x0
[    0.000000]  reserved[0x1]	[0x00000088008000-0x0000008802bf3b], 0x23f3c bytes flags: 0x0
[    0.000000] On node 0 totalpages: 1024
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 15728640 bytes align=0x0 nid=0 from=0x0 max_addr=0x0 alloc_node_mem_map.constprop.78+0x33/0x54
[    0.000000] free_area_init_node: node 0, pgdat 880208f4, node_mem_map 00000000
[    0.000000]   Normal zone: 3840 pages exceeds freesize 1024
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 1024 pages, LIFO batch:0
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 720 bytes align=0x0 nid=0 from=0x0 max_addr=0x0 free_area_init_node+0x1b9/0x23a
[    0.000000] memblock_reserve: [0x000000883ffd20-0x000000883fffef] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 16384 bytes align=0x0 nid=0 from=0x0 max_addr=0x0 zone_wait_table_init+0x53/0x94
[    0.000000] memblock_reserve: [0x000000883fbd20-0x000000883ffd1f] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 28 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 setup_arch+0x295/0x3a6
[    0.000000] memblock_reserve: [0x000000883fbd00-0x000000883fbd1b] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 12832 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f8ae0-0x000000883fbcff] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 24 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f8ac8-0x000000883f8adf] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 24 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f8ab0-0x000000883f8ac7] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 27 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f8a94-0x000000883f8aae] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 27 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f8a78-0x000000883f8a92] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 27 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f8a5c-0x000000883f8a76] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 27 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f8a40-0x000000883f8a5a] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 27 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f8a24-0x000000883f8a3e] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 24 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f8a0c-0x000000883f8a23] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 24 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f89f4-0x000000883f8a0b] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 24 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f89dc-0x000000883f89f3] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 147 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 start_kernel+0x63/0x210
[    0.000000] memblock_reserve: [0x000000883f8940-0x000000883f89d2] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 147 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 start_kernel+0x7b/0x210
[    0.000000] memblock_reserve: [0x000000883f88a0-0x000000883f8932] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 147 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 start_kernel+0x91/0x210
[    0.000000] memblock_reserve: [0x000000883f8800-0x000000883f8892] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 4096 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 pcpu_alloc_alloc_info+0x2f/0x4c
[    0.000000] memblock_reserve: [0x000000883f7800-0x000000883f87ff] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 32768 bytes align=0x1000 nid=-1 from=0xffffffff max_addr=0x0 setup_per_cpu_areas+0x21/0x5c
[    0.000000] memblock_reserve: [0x000000883ef000-0x000000883f6fff] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 4 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 pcpu_setup_first_chunk+0x3b7/0x42a
[    0.000000] memblock_reserve: [0x000000883f77e0-0x000000883f77e3] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 4 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 pcpu_setup_first_chunk+0x3c9/0x42a
[    0.000000] memblock_reserve: [0x000000883f77c0-0x000000883f77c3] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 4 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 pcpu_setup_first_chunk+0x3d9/0x42a
[    0.000000] memblock_reserve: [0x000000883f77a0-0x000000883f77a3] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 4 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 pcpu_setup_first_chunk+0x3e9/0x42a
[    0.000000] memblock_reserve: [0x000000883f7780-0x000000883f7783] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] memblock_virt_alloc_try_nid: 120 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 pcpu_setup_first_chunk+0x1c5/0x42a
[    0.000000] memblock_reserve: [0x000000883f7700-0x000000883f7777] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 48 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 pcpu_setup_first_chunk+0x1f5/0x42a
[    0.000000] memblock_reserve: [0x000000883f76c0-0x000000883f76ef] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 1024
[    0.000000] Kernel command line: console=ttyefm4,115200 init=/linuxrc ignore_loglevel ihash_entries=64 dhash_entries=64 earlyprintk uclinux.physaddr=0x8c400000 root=/dev/mtdblock0
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 64 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 alloc_large_system_hash+0xe9/0x180
[    0.000000] memblock_reserve: [0x000000883f7680-0x000000883f76bf] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] PID hash table entries: 16 (order: -6, 64 bytes)
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 256 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 alloc_large_system_hash+0xe9/0x180
[    0.000000] memblock_reserve: [0x000000883f7580-0x000000883f767f] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] Dentry cache hash table entries: 64 (order: -4, 256 bytes)
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 256 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 alloc_large_system_hash+0xe9/0x180
[    0.000000] memblock_reserve: [0x000000883f7480-0x000000883f757f] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] Inode-cache hash table entries: 64 (order: -4, 256 bytes)
[    0.000000] Memory: 0K/4096K available (1156K kernel code, 83K rwdata, 316K rodata, 56K init, 43K bss, 212K reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0x00000000 - 0x00001000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
[    0.000000]     vmalloc : 0x00000000 - 0xffffffff   (4095 MB)
[    0.000000]     lowmem  : 0x88000000 - 0x88400000   (   4 MB)
[    0.000000]       .text : 0x8c000000 - 0x8c170360   (1473 kB)
[    0.000000]       .init : 0x8800a000 - 0x8800e000   (  16 kB)
[    0.000000]       .data : 0x88008000 - 0x88020f80   ( 100 kB)
[    0.000000]        .bss : 0x88020f8c - 0x8802bf3c   (  44 kB)
[    0.000000] swapper: page allocation failure: order:0, mode:0x200000
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.15.0-rc1-00028-g1c2f87c22566-dirty #281
[    0.000000] [<8c002b95>] (unwind_backtrace) from [<8c001f0b>] (show_stack+0xb/0xc)
[    0.000000] [<8c001f0b>] (show_stack) from [<8c02e997>] (warn_alloc_failed+0x95/0xba)
[    0.000000] [<8c02e997>] (warn_alloc_failed) from [<8c02ff6b>] (__alloc_pages_nodemask+0x437/0x484)
[    0.000000] [<8c02ff6b>] (__alloc_pages_nodemask) from [<8c03b7c5>] (new_slab+0x51/0x184)
[    0.000000] [<8c03b7c5>] (new_slab) from [<8c03c1c5>] (__kmem_cache_create+0x5d/0x12c)
[    0.000000] [<8c03c1c5>] (__kmem_cache_create) from [<8c174667>] (create_boot_cache+0x23/0x3c)
[    0.000000] [<8c174667>] (create_boot_cache) from [<8c1751af>] (kmem_cache_init+0x23/0x88)
[    0.000000] [<8c1751af>] (kmem_cache_init) from [<8c17078b>] (start_kernel+0xfb/0x210)
[    0.000000] [<8c17078b>] (start_kernel) from [<8c000023>] (0x8c000023)
[    0.000000] Mem-info:
[    0.000000] Normal per-cpu:
[    0.000000] CPU    0: hi:    0, btch:   1 usd:   0
[    0.000000] active_anon:0 inactive_anon:0 isolated_anon:0
[    0.000000]  active_file:0 inactive_file:0 isolated_file:0
[    0.000000]  unevictable:0 dirty:0 writeback:0 unstable:0
[    0.000000]  free:0 slab_reclaimable:0 slab_unreclaimable:0
[    0.000000]  mapped:0 shmem:0 pagetables:0 bounce:0
[    0.000000]  free_cma:0
[    0.000000] Normal free:0kB min:0kB low:0kB high:0kB active_anon:0kB inactive_anon:0kB active_file:0kB inactive_file:0kB unevictable:0kB isolated(anon):0kB isolated(file):0kB present:4096kB managed:2776kB mlocked:0kB dirty:0kB writeback:0kB mapped:0kB shmem:0kB slab_reclaimable:0kB slab_unreclaimable:0kB kernel_stack:0kB pagetables:0kB unstable:0kB bounce:0kB free_cma:0kB writeback_tmp:0kB pages_scanned:0 all_unreclaimable? yes
[    0.000000] lowmem_reserve[]: 0 0
[    0.000000] Normal: 0*4kB 0*8kB 0*16kB 0*32kB 0*64kB 0*128kB 0*256kB 0*512kB 0*1024kB = 0kB
[    0.000000] 0 total pagecache pages
[    0.000000] 
[    0.000000] Unhandled exception: IPSR = 00000003 LR = fffffff1
[    0.000000] 
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.15.0-rc1-00028-g1c2f87c22566-dirty #281
[    0.000000] task: 88015950 ti: 88008000 task.ti: 88008000
[    0.000000] PC is at show_mem+0x96/0x150
[    0.000000] LR is at 0x880251e0
[    0.000000] pc : [<8c00359a>]    lr : [<880251e0>]    psr: 0100000b
[    0.000000] sp : 88009e68  ip : 00088000  fp : 4100f101
[    0.000000] r10: 00000080  r9 : f7ff0047  r8 : 00000001
[    0.000000] r7 : 00000001  r6 : d0fb0f3f  r5 : 00000000  r4 : 00000000
[    0.000000] r3 : 00000060  r2 : 88025234  r1 : 00000004  r0 : 8801a2e8
[    0.000000] xPSR: 0100000b
[    0.000000] CPU: 0 PID: 0 Comm: swapper Not tainted 3.15.0-rc1-00028-g1c2f87c22566-dirty #281
[    0.000000] [<8c002b95>] (unwind_backtrace) from [<8c001f0b>] (show_stack+0xb/0xc)
[    0.000000] [<8c001f0b>] (show_stack) from [<8c002547>] (__invalid_entry+0x4b/0x4c)

Best regards
Uwe

Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#7 lore raw

Re: [PATCHv5 2/2] arm: Get rid of meminfo

In reply to Uwe Kleine-König

Thanks for the report.

Quoted 7 lines · Uwe Kleine-K?nig

This patch is in 3.16-rc1 as 1c2f87c22566cd057bc8cde10c37ae9da1a1bb76 now.

Unfortunately it makes my efm32 machine unbootable.

With earlyprintk enabled I get the following output:

Quoted 10 lines
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 3.15.0-rc1-00028-g1c2f87c22566-dirty (ukleinek at perseus) (gcc version 4.7.2 (OSELAS.Toolchain-2012.12.1) ) #280 PREEMPT Mon Jun 23 11:05:34 CEST 2014
[    0.000000] CPU: ARMv7-M [412fc231] revision 1 (ARMv7M), cr=00000000
[    0.000000] CPU: unknown data cache, unknown instruction cache
[    0.000000] Machine model: Energy Micro Giant Gecko Development Kit
[    0.000000] debug: ignoring loglevel setting.
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] On node 0 totalpages: 1024
[    0.000000] free_area_init_node: node 0, pgdat 880208f4, node_mem_map 00000000
[    0.000000]   Normal zone: 3840 pages exceeds freesize 1024

This looks off. The number of pages for the memmap exceeds the available free size. Working backwards, I think the wrong bounds are being calculated in find_limits in arch/arm/mm/init.c . max_low is now calculated via the current limit but nommu never sets a limit unlike the mmu case. Can you try the following patch and see if it fixes the issue? If this doesn't work, can you share working bootup logs so I can do a bit more compare and contrast?

Thanks,
Laura

---8<----

Quoted 1 line

From 9b19241d577caf91928e26e55413047d1be90feb Mon Sep 17 00:00:00 2001

From: Laura Abbott <[email protected]>
Date: Mon, 23 Jun 2014 13:26:56 -0700
Subject: [PATCH] arm: Set memblock limit for nommu

Commit 1c2f87c (ARM: 8025/1: Get rid of meminfo) changed find_limits to use memblock_get_current_limit for calculating the max_low pfn. nommu targets never actually set a limit on memblock though which means memblock_get_current_limit will just return the default value. Set the memblock_limit to be the end of DDR to make sure bounds are calculated correctly.

---
 arch/arm/mm/nommu.c | 1 +
 1 file changed, 1 insertion(+)
arch/arm/mm/nommu.c +1 -0
index da1874f..a014dfa 100644
@@ -300,6 +300,7 @@ void __init sanity_check_meminfo(void)
        sanity_check_meminfo_mpu();
        end = memblock_end_of_DRAM();
        high_memory = __va(end - 1) + 1;
+       memblock_set_current_limit(end);
 }
 
 /*
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
hosted by The Linux Foundation
#8 lore raw

Re: [PATCHv5 2/2] arm: Get rid of meminfo

Hi Laura,

Quoted 1 line · Laura Abbott

Thanks for the report.

Thanks for your reply to address it :-)
Are you already aware of the mail with Message-Id:
CAGa+x85H510fNGTXJHGYfQybRa2FGgg2NyCgJ8rmjJ6TE7GNbA at mail.gmail.com ? Seems to be another fall-out but I think you were not on Cc.

Quoted 35 lines · Uwe Kleine-K?nig
Quoted 7 lines

This patch is in 3.16-rc1 as 1c2f87c22566cd057bc8cde10c37ae9da1a1bb76 now.

Unfortunately it makes my efm32 machine unbootable.

With earlyprintk enabled I get the following output:

Quoted 10 lines
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 3.15.0-rc1-00028-g1c2f87c22566-dirty (ukleinek at perseus) (gcc version 4.7.2 (OSELAS.Toolchain-2012.12.1) ) #280 PREEMPT Mon Jun 23 11:05:34 CEST 2014
[    0.000000] CPU: ARMv7-M [412fc231] revision 1 (ARMv7M), cr=00000000
[    0.000000] CPU: unknown data cache, unknown instruction cache
[    0.000000] Machine model: Energy Micro Giant Gecko Development Kit
[    0.000000] debug: ignoring loglevel setting.
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] On node 0 totalpages: 1024
[    0.000000] free_area_init_node: node 0, pgdat 880208f4, node_mem_map 00000000
[    0.000000]   Normal zone: 3840 pages exceeds freesize 1024

This looks off. The number of pages for the memmap exceeds the available free size. Working backwards, I think the wrong bounds are being calculated in find_limits in arch/arm/mm/init.c . max_low is now calculated via the current limit but nommu never sets a limit unlike the mmu case. Can you try the following patch and see if it fixes the issue? If this doesn't work, can you share working bootup logs so I can do a bit more compare and contrast?

Thanks,
Laura

---8<----
From 9b19241d577caf91928e26e55413047d1be90feb Mon Sep 17 00:00:00 2001
From: Laura Abbott <[email protected]>
Date: Mon, 23 Jun 2014 13:26:56 -0700
Subject: [PATCH] arm: Set memblock limit for nommu

Quoted 5 lines

Commit 1c2f87c (ARM: 8025/1: Get rid of meminfo) changed find_limits to use memblock_get_current_limit for calculating the max_low pfn. nommu targets never actually set a limit on memblock though which means memblock_get_current_limit will just return the default value. Set the memblock_limit to be the end of DDR to make sure

s/DDR/RAM/ ?

Quoted 1 line

bounds are calculated correctly.

This patch makes my machine boot. Full boot log appended below. (Side note: I place my dtb in the SRAM at 0x10000000 but don't add this to the available memory because it's only 128 KiB in size and so too small to be worth to track. Not sure this is allowed?!)

Thanks
Uwe

[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 3.15.0-rc1-00028-g1c2f87c22566-dirty (ukleinek at perseus) (gcc version 4.7.2 (OSELAS.Toolchain-2012.12.1) ) #285 PREEMPT Tue Jun 24 10:30:01 CEST 2014
[    0.000000] CPU: ARMv7-M [412fc231] revision 1 (ARMv7M), cr=00000000
[    0.000000] CPU: unknown data cache, unknown instruction cache
[    0.000000] Machine model: Energy Micro Giant Gecko Development Kit
[    0.000000] debug: ignoring loglevel setting.
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] set currentlimit to 88400000 (old: ffffffff)
[    0.000000] memblock_reserve: [0x00000088008000-0x0000008802bf3b] flags 0x0 arm_memblock_init+0xf/0x48
[    0.000000] memblock_reserve: [0x00000010000000-0x000000100010fd] flags 0x0 arm_dt_memblock_reserve+0x11/0x40
[    0.000000] MEMBLOCK configuration:
[    0.000000]  memory size = 0x400000 reserved size = 0x2503a
[    0.000000]  memory.cnt  = 0x1
[    0.000000]  memory[0x0]	[0x00000088000000-0x000000883fffff], 0x400000 bytes flags: 0x0
[    0.000000]  reserved.cnt  = 0x2
[    0.000000]  reserved[0x0]	[0x00000010000000-0x000000100010fd], 0x10fe bytes flags: 0x0
[    0.000000]  reserved[0x1]	[0x00000088008000-0x0000008802bf3b], 0x23f3c bytes flags: 0x0
[    0.000000] On node 0 totalpages: 1024
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 32768 bytes align=0x0 nid=0 from=0x0 max_addr=0x0 alloc_node_mem_map.constprop.78+0x33/0x54
[    0.000000] memblock_reserve: [0x000000883f8000-0x000000883fffff] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] free_area_init_node: node 0, pgdat 880208f4, node_mem_map 883f8000
[    0.000000]   Normal zone: 8 pages used for memmap
[    0.000000]   Normal zone: 0 pages reserved
[    0.000000]   Normal zone: 1024 pages, LIFO batch:0
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 4 bytes align=0x0 nid=0 from=0x0 max_addr=0x0 free_area_init_node+0x1b9/0x23a
[    0.000000] memblock_reserve: [0x000000883f7fe0-0x000000883f7fe3] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 32 bytes align=0x0 nid=0 from=0x0 max_addr=0x0 zone_wait_table_init+0x53/0x94
[    0.000000] memblock_reserve: [0x000000883f7fc0-0x000000883f7fdf] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 28 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 setup_arch+0x295/0x3a6
[    0.000000] memblock_reserve: [0x000000883f7fa0-0x000000883f7fbb] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 12832 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f4d80-0x000000883f7f9f] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 24 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f7fe8-0x000000883f7fff] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 24 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f4d68-0x000000883f4d7f] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 27 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f4d4c-0x000000883f4d66] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 27 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f4d30-0x000000883f4d4a] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 27 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f4d14-0x000000883f4d2e] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 27 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f4cf8-0x000000883f4d12] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 27 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f4cdc-0x000000883f4cf6] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 24 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f4cc4-0x000000883f4cdb] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 24 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f4cac-0x000000883f4cc3] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 24 bytes align=0x4 nid=-1 from=0x0 max_addr=0x0 early_init_dt_alloc_memory_arch+0x13/0x14
[    0.000000] memblock_reserve: [0x000000883f4c94-0x000000883f4cab] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 147 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 start_kernel+0x63/0x210
[    0.000000] memblock_reserve: [0x000000883f4c00-0x000000883f4c92] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 147 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 start_kernel+0x7b/0x210
[    0.000000] memblock_reserve: [0x000000883f4b60-0x000000883f4bf2] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 147 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 start_kernel+0x91/0x210
[    0.000000] memblock_reserve: [0x000000883f4ac0-0x000000883f4b52] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 4096 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 pcpu_alloc_alloc_info+0x2f/0x4c
[    0.000000] memblock_reserve: [0x000000883f3ac0-0x000000883f4abf] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 32768 bytes align=0x1000 nid=-1 from=0xffffffff max_addr=0x0 setup_per_cpu_areas+0x21/0x5c
[    0.000000] memblock_reserve: [0x000000883eb000-0x000000883f2fff] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 4 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 pcpu_setup_first_chunk+0x3b7/0x42a
[    0.000000] memblock_reserve: [0x000000883f3aa0-0x000000883f3aa3] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 4 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 pcpu_setup_first_chunk+0x3c9/0x42a
[    0.000000] memblock_reserve: [0x000000883f3a80-0x000000883f3a83] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 4 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 pcpu_setup_first_chunk+0x3d9/0x42a
[    0.000000] memblock_reserve: [0x000000883f3a60-0x000000883f3a63] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 4 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 pcpu_setup_first_chunk+0x3e9/0x42a
[    0.000000] memblock_reserve: [0x000000883f3a40-0x000000883f3a43] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] pcpu-alloc: s0 r0 d32768 u32768 alloc=1*32768
[    0.000000] pcpu-alloc: [0] 0 
[    0.000000] memblock_virt_alloc_try_nid: 120 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 pcpu_setup_first_chunk+0x1c5/0x42a
[    0.000000] memblock_reserve: [0x000000883f39c0-0x000000883f3a37] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] memblock_virt_alloc_try_nid: 48 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 pcpu_setup_first_chunk+0x1f5/0x42a
[    0.000000] memblock_reserve: [0x000000883f3980-0x000000883f39af] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 1016
[    0.000000] Kernel command line: console=ttyefm4,115200 init=/linuxrc ignore_loglevel ihash_entries=64 dhash_entries=64 earlyprintk uclinux.physaddr=0x8c400000 root=/dev/mtdblock0
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 64 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 alloc_large_system_hash+0xe9/0x180
[    0.000000] memblock_reserve: [0x000000883f3940-0x000000883f397f] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] PID hash table entries: 16 (order: -6, 64 bytes)
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 256 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 alloc_large_system_hash+0xe9/0x180
[    0.000000] memblock_reserve: [0x000000883f3840-0x000000883f393f] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] Dentry cache hash table entries: 64 (order: -4, 256 bytes)
[    0.000000] memblock_virt_alloc_try_nid_nopanic: 256 bytes align=0x0 nid=-1 from=0x0 max_addr=0x0 alloc_large_system_hash+0xe9/0x180
[    0.000000] memblock_reserve: [0x000000883f3740-0x000000883f383f] flags 0x0 memblock_virt_alloc_internal+0x8d/0xe0
[    0.000000] Inode-cache hash table entries: 64 (order: -4, 256 bytes)
[    0.000000] Memory: 3868K/4096K available (1156K kernel code, 83K rwdata, 316K rodata, 56K init, 43K bss, 228K reserved)
[    0.000000] Virtual kernel memory layout:
[    0.000000]     vector  : 0x00000000 - 0x00001000   (   4 kB)
[    0.000000]     fixmap  : 0xffc00000 - 0xffe00000   (2048 kB)
[    0.000000]     vmalloc : 0x00000000 - 0xffffffff   (4095 MB)
[    0.000000]     lowmem  : 0x88000000 - 0x88400000   (   4 MB)
[    0.000000]       .text : 0x8c000000 - 0x8c170368   (1473 kB)
[    0.000000]       .init : 0x8800a000 - 0x8800e000   (  16 kB)
[    0.000000]       .data : 0x88008000 - 0x88020f80   ( 100 kB)
[    0.000000]        .bss : 0x88020f8c - 0x8802bf3c   (  44 kB)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] NR_IRQS:16 nr_irqs:16 16
[    0.000000] sched_clock: 32 bits at 100 Hz, resolution 10000000ns, wraps every 21474836480000000ns
[    0.010000] Calibrating delay loop... 1.38 BogoMIPS (lpj=6912)
[    0.160000] pid_max: default: 4096 minimum: 301
[    0.180000] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.190000] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.470000] devtmpfs: initialized
[    0.850000] NET: Registered protocol family 16
[    1.820000] Switched to clocksource efm32 timer
[    2.050000] NET: Registered protocol family 2
[    2.180000] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    2.200000] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    2.220000] TCP: Hash tables configured (established 1024 bind 1024)
[    2.240000] TCP: reno registered
[    2.240000] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    2.260000] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    2.300000] NET: Registered protocol family 1
[    4.210000] ROMFS MTD (C) 2007 Red Hat, Inc.
[    4.270000] io scheduler noop registered (default)
[    4.300000] 4000e400.uart: ttyefm4 at MMIO 0x4000e400 (irq = 25, base_baud = 0) is a efm32-uart
[    4.320000] console [ttyefm4] enabled
[    4.320000] console [ttyefm4] enabled
[    4.330000] bootconsole [earlycon0] disabled
[    4.330000] bootconsole [earlycon0] disabled
[    4.430000] EFM32 UART/USART driver
[    4.530000] uclinux[mtd]: probe address=0x8c400000 size=0x60000
[    4.540000] Creating 1 MTD partitions on "rom":
[    4.550000] 0x000000000000-0x000000060000 : "ROMfs"
[    4.790000] efm32-spi 4000c000.spi: failed to get csgpio#0 (-517)
[    4.810000] platform 4000c000.spi: Driver efm32-spi requests probe deferral
[    4.830000] efm32-spi 4000c400.spi: failed to get csgpio#0 (-517)
[    4.840000] platform 4000c400.spi: Driver efm32-spi requests probe deferral
[    4.950000] TCP: cubic registered
[    4.960000] NET: Registered protocol family 17
[    5.120000] efm32-spi 4000c000.spi: failed to get csgpio#0 (-517)
[    5.130000] platform 4000c000.spi: Driver efm32-spi requests probe deferral
[    5.150000] efm32-spi 4000c400.spi: failed to get csgpio#0 (-517)
[    5.170000] platform 4000c400.spi: Driver efm32-spi requests probe deferral
[    5.280000] VFS: Mounted root (romfs filesystem) readonly on device 31:0.
[    5.300000] devtmpfs: mounted
[    5.330000] Freeing unused kernel memory: 16K (8800a000 - 8800e000)
Signature · 2 lines
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
#9 lore raw

Re: [PATCHv5 2/2] arm: Get rid of meminfo

Quoted 51 lines · Uwe Kleine-K?nig

Hi Laura,

Quoted 1 line · Laura Abbott

Thanks for the report.

Thanks for your reply to address it :-)
Are you already aware of the mail with Message-Id:
CAGa+x85H510fNGTXJHGYfQybRa2FGgg2NyCgJ8rmjJ6TE7GNbA at mail.gmail.com ? Seems to be another fall-out but I think you were not on Cc.

Quoted 35 lines · Uwe Kleine-K?nig
Quoted 7 lines

This patch is in 3.16-rc1 as 1c2f87c22566cd057bc8cde10c37ae9da1a1bb76 now.

Unfortunately it makes my efm32 machine unbootable.

With earlyprintk enabled I get the following output:

Quoted 10 lines
[    0.000000] Booting Linux on physical CPU 0x0
[    0.000000] Linux version 3.15.0-rc1-00028-g1c2f87c22566-dirty (ukleinek at perseus) (gcc version 4.7.2 (OSELAS.Toolchain-2012.12.1) ) #280 PREEMPT Mon Jun 23 11:05:34 CEST 2014
[    0.000000] CPU: ARMv7-M [412fc231] revision 1 (ARMv7M), cr=00000000
[    0.000000] CPU: unknown data cache, unknown instruction cache
[    0.000000] Machine model: Energy Micro Giant Gecko Development Kit
[    0.000000] debug: ignoring loglevel setting.
[    0.000000] bootconsole [earlycon0] enabled
[    0.000000] On node 0 totalpages: 1024
[    0.000000] free_area_init_node: node 0, pgdat 880208f4, node_mem_map 00000000
[    0.000000]   Normal zone: 3840 pages exceeds freesize 1024

This looks off. The number of pages for the memmap exceeds the available free size. Working backwards, I think the wrong bounds are being calculated in find_limits in arch/arm/mm/init.c . max_low is now calculated via the current limit but nommu never sets a limit unlike the mmu case. Can you try the following patch and see if it fixes the issue? If this doesn't work, can you share working bootup logs so I can do a bit more compare and contrast?

Thanks,
Laura

---8<----
From 9b19241d577caf91928e26e55413047d1be90feb Mon Sep 17 00:00:00 2001
From: Laura Abbott <[email protected]>
Date: Mon, 23 Jun 2014 13:26:56 -0700
Subject: [PATCH] arm: Set memblock limit for nommu

Quoted 5 lines

Commit 1c2f87c (ARM: 8025/1: Get rid of meminfo) changed find_limits to use memblock_get_current_limit for calculating the max_low pfn. nommu targets never actually set a limit on memblock though which means memblock_get_current_limit will just return the default value. Set the memblock_limit to be the end of DDR to make sure

s/DDR/RAM/ ?

Quoted 9 lines
Quoted 1 line

bounds are calculated correctly.

This patch makes my machine boot. Full boot log appended below. (Side note: I place my dtb in the SRAM at 0x10000000 but don't add this to the available memory because it's only 128 KiB in size and so too small to be worth to track. Not sure this is allowed?!)

Thanks
Uwe

I put this in the patch tracker as 8086/1

Thanks,
Laura

Signature · 2 lines
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
hosted by The Linux Foundation