LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/6] Introduce mechanism for registering active regions of memory
From: Mel Gorman @ 2006-04-11 10:40 UTC (permalink / raw)
  To: linuxppc-dev, ak, tony.luck, linux-kernel, davej; +Cc: Mel Gorman
In-Reply-To: <20060411103946.18153.83059.sendpatchset@skynet>


This patch defines the structure to represent an active range of page
frames within a node in an architecture independent manner. Architectures
are expected to register active ranges of PFNs using add_active_range(nid,
start_pfn, end_pfn) and call free_area_init_nodes() passing the PFNs of
the end of each zone.


 include/linux/mm.h     |   14 +
 include/linux/mmzone.h |   15 +
 mm/page_alloc.c        |  374 +++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 378 insertions(+), 25 deletions(-)

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc1-clean/include/linux/mm.h linux-2.6.17-rc1-101-add_free_area_init_nodes/include/linux/mm.h
--- linux-2.6.17-rc1-clean/include/linux/mm.h	2006-04-03 04:22:10.000000000 +0100
+++ linux-2.6.17-rc1-101-add_free_area_init_nodes/include/linux/mm.h	2006-04-10 10:52:14.000000000 +0100
@@ -867,6 +867,20 @@ extern void free_area_init(unsigned long
 extern void free_area_init_node(int nid, pg_data_t *pgdat,
 	unsigned long * zones_size, unsigned long zone_start_pfn, 
 	unsigned long *zholes_size);
+#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
+extern void free_area_init_nodes(unsigned long max_dma_pfn,
+					unsigned long max_dma32_pfn,
+					unsigned long max_low_pfn,
+					unsigned long max_high_pfn);
+extern void add_active_range(unsigned int nid, unsigned long start_pfn,
+					unsigned long end_pfn);
+extern void get_pfn_range_for_nid(unsigned int nid,
+			unsigned long *start_pfn, unsigned long *end_pfn);
+extern int early_pfn_to_nid(unsigned long pfn);
+extern void free_bootmem_with_active_regions(int nid,
+						unsigned long max_low_pfn);
+extern void memory_present_with_active_regions(int nid);
+#endif
 extern void memmap_init_zone(unsigned long, int, unsigned long, unsigned long);
 extern void setup_per_zone_pages_min(void);
 extern void mem_init(void);
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc1-clean/include/linux/mmzone.h linux-2.6.17-rc1-101-add_free_area_init_nodes/include/linux/mmzone.h
--- linux-2.6.17-rc1-clean/include/linux/mmzone.h	2006-04-03 04:22:10.000000000 +0100
+++ linux-2.6.17-rc1-101-add_free_area_init_nodes/include/linux/mmzone.h	2006-04-10 10:52:14.000000000 +0100
@@ -271,6 +271,18 @@ struct zonelist {
 	struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited
 };
 
+#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
+/*
+ * This represents an active range of physical memory. Architectures register
+ * a pfn range using add_active_range() and later initialise the nodes and
+ * free list with free_area_init_nodes()
+ */
+struct node_active_region {
+	unsigned long start_pfn;
+	unsigned long end_pfn;
+	int nid;
+};
+#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
 
 /*
  * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM
@@ -465,7 +477,8 @@ extern struct zone *next_zone(struct zon
 
 #endif
 
-#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
+#if !defined(CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID) && \
+	!defined(CONFIG_ARCH_POPULATES_NODE_MAP)
 #define early_pfn_to_nid(nid)  (0UL)
 #endif
 
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc1-clean/mm/page_alloc.c linux-2.6.17-rc1-101-add_free_area_init_nodes/mm/page_alloc.c
--- linux-2.6.17-rc1-clean/mm/page_alloc.c	2006-04-03 04:22:10.000000000 +0100
+++ linux-2.6.17-rc1-101-add_free_area_init_nodes/mm/page_alloc.c	2006-04-10 10:52:14.000000000 +0100
@@ -37,6 +37,8 @@
 #include <linux/nodemask.h>
 #include <linux/vmalloc.h>
 #include <linux/mempolicy.h>
+#include <linux/sort.h>
+#include <linux/pfn.h>
 
 #include <asm/tlbflush.h>
 #include "internal.h"
@@ -84,6 +86,18 @@ int min_free_kbytes = 1024;
 unsigned long __initdata nr_kernel_pages;
 unsigned long __initdata nr_all_pages;
 
+#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
+  #ifdef CONFIG_MAX_ACTIVE_REGIONS
+    #define MAX_ACTIVE_REGIONS CONFIG_MAX_ACTIVE_REGIONS
+  #else
+    #define MAX_ACTIVE_REGIONS (MAX_NR_ZONES * MAX_NUMNODES + 1)
+  #endif
+
+  struct node_active_region __initdata early_node_map[MAX_ACTIVE_REGIONS];
+  unsigned long __initdata arch_zone_lowest_possible_pfn[MAX_NR_ZONES];
+  unsigned long __initdata arch_zone_highest_possible_pfn[MAX_NR_ZONES];
+#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
+
 #ifdef CONFIG_DEBUG_VM
 static int page_outside_zone_boundaries(struct zone *zone, struct page *page)
 {
@@ -1743,25 +1757,6 @@ static inline unsigned long wait_table_b
 
 #define LONG_ALIGN(x) (((x)+(sizeof(long))-1)&~((sizeof(long))-1))
 
-static void __init calculate_zone_totalpages(struct pglist_data *pgdat,
-		unsigned long *zones_size, unsigned long *zholes_size)
-{
-	unsigned long realtotalpages, totalpages = 0;
-	int i;
-
-	for (i = 0; i < MAX_NR_ZONES; i++)
-		totalpages += zones_size[i];
-	pgdat->node_spanned_pages = totalpages;
-
-	realtotalpages = totalpages;
-	if (zholes_size)
-		for (i = 0; i < MAX_NR_ZONES; i++)
-			realtotalpages -= zholes_size[i];
-	pgdat->node_present_pages = realtotalpages;
-	printk(KERN_DEBUG "On node %d totalpages: %lu\n", pgdat->node_id, realtotalpages);
-}
-
-
 /*
  * Initially all pages are reserved - free ones are freed
  * up by free_all_bootmem() once the early boot process is
@@ -2048,6 +2043,214 @@ static __meminit void init_currently_emp
 	zone_init_free_lists(pgdat, zone, zone->spanned_pages);
 }
 
+#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
+static int __init first_active_region_index_in_nid(int nid)
+{
+	int i;
+	for (i = 0; early_node_map[i].end_pfn; i++) {
+		if (early_node_map[i].nid == nid)
+			return i;
+	}
+
+	return MAX_ACTIVE_REGIONS;
+}
+
+static int __init next_active_region_index_in_nid(unsigned int index, int nid)
+{
+	for (index = index + 1; early_node_map[index].end_pfn; index++) {
+		if (early_node_map[index].nid == nid)
+			return index;
+	}
+
+	return MAX_ACTIVE_REGIONS;
+}
+
+#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
+int __init early_pfn_to_nid(unsigned long pfn)
+{
+	int i;
+
+	for (i = 0; early_node_map[i].end_pfn; i++) {
+		unsigned long start_pfn = early_node_map[i].start_pfn;
+		unsigned long end_pfn = early_node_map[i].end_pfn;
+
+		if ((start_pfn <= pfn) && (pfn < end_pfn))
+			return early_node_map[i].nid;
+	}
+
+	return -1;
+}
+#endif /* CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID */
+
+#define for_each_active_range_index_in_nid(i, nid) \
+	for (i = first_active_region_index_in_nid(nid); \
+				i != MAX_ACTIVE_REGIONS; \
+				i = next_active_region_index_in_nid(i, nid))
+
+void __init free_bootmem_with_active_regions(int nid,
+						unsigned long max_low_pfn)
+{
+	unsigned int i;
+	for_each_active_range_index_in_nid(i, nid) {
+		unsigned long size_pages = 0;
+		unsigned long end_pfn = early_node_map[i].end_pfn;
+		if (early_node_map[i].start_pfn >= max_low_pfn)
+			continue;
+
+		if (end_pfn > max_low_pfn)
+			end_pfn = max_low_pfn;
+
+		size_pages = end_pfn - early_node_map[i].start_pfn;
+		free_bootmem_node(NODE_DATA(early_node_map[i].nid),
+				PFN_PHYS(early_node_map[i].start_pfn),
+				PFN_PHYS(size_pages));
+	}
+}
+
+void __init memory_present_with_active_regions(int nid)
+{
+	unsigned int i;
+	for_each_active_range_index_in_nid(i, nid)
+		memory_present(early_node_map[i].nid,
+				early_node_map[i].start_pfn,
+				early_node_map[i].end_pfn);
+}
+
+void __init get_pfn_range_for_nid(unsigned int nid,
+			unsigned long *start_pfn, unsigned long *end_pfn)
+{
+	unsigned int i;
+	*start_pfn = -1UL;
+	*end_pfn = 0;
+
+	for_each_active_range_index_in_nid(i, nid) {
+		if (early_node_map[i].start_pfn < *start_pfn)
+			*start_pfn = early_node_map[i].start_pfn;
+
+		if (early_node_map[i].end_pfn > *end_pfn)
+			*end_pfn = early_node_map[i].end_pfn;
+	}
+
+	if (*start_pfn == -1UL) {
+		printk(KERN_WARNING "Node %u active with no memory\n", nid);
+		*start_pfn = 0;
+	}
+}
+
+unsigned long __init zone_present_pages_in_node(int nid,
+					unsigned long zone_type,
+					unsigned long *ignored)
+{
+	unsigned long node_start_pfn, node_end_pfn;
+	unsigned long zone_start_pfn, zone_end_pfn;
+
+	/* Get the start and end of the node and zone */
+	get_pfn_range_for_nid(nid, &node_start_pfn, &node_end_pfn);
+	zone_start_pfn = arch_zone_lowest_possible_pfn[zone_type];
+	zone_end_pfn = arch_zone_highest_possible_pfn[zone_type];
+
+	/* Check that this node has pages within the zone's required range */
+	if (zone_end_pfn < node_start_pfn || zone_start_pfn > node_end_pfn)
+		return 0;
+
+	/* Move the zone boundaries inside the node if necessary */
+	if (zone_end_pfn > node_end_pfn)
+		zone_end_pfn = node_end_pfn;
+	if (zone_start_pfn < node_start_pfn)
+		zone_start_pfn = node_start_pfn;
+
+	/* Return the spanned pages */
+	return zone_end_pfn - zone_start_pfn;
+}
+
+static inline int __init pfn_range_in_zone(unsigned long start_pfn,
+		unsigned long end_pfn,
+		unsigned long zone_type)
+{
+	if (start_pfn < arch_zone_lowest_possible_pfn[zone_type])
+		return 0;
+
+	if (start_pfn >= arch_zone_highest_possible_pfn[zone_type])
+		return 0;
+
+	if (end_pfn < arch_zone_lowest_possible_pfn[zone_type])
+		return 0;
+
+	if (end_pfn >= arch_zone_highest_possible_pfn[zone_type])
+		return 0;
+
+	return 1;
+}
+
+unsigned long __init zone_absent_pages_in_node(int nid,
+					unsigned long zone_type,
+					unsigned long *ignored)
+{
+	int i = 0;
+	unsigned long prev_end_pfn = 0, hole_pages = 0;
+	unsigned long start_pfn;
+
+	/* Find the end_pfn of the first active range of pfns in the node */
+	i = first_active_region_index_in_nid(nid);
+	prev_end_pfn = early_node_map[i].start_pfn;
+
+	/* Find all holes for the node */
+	for (; i != MAX_ACTIVE_REGIONS;
+			i = next_active_region_index_in_nid(i, nid)) {
+
+		/* Increase the hole size if the hole is within the zone */
+		start_pfn = early_node_map[i].start_pfn;
+		if (pfn_range_in_zone(prev_end_pfn, start_pfn, zone_type)) {
+			BUG_ON(prev_end_pfn > start_pfn);
+			hole_pages += start_pfn - prev_end_pfn;
+		}
+
+		prev_end_pfn = early_node_map[i].end_pfn;
+	}
+
+	return hole_pages;
+}
+#else
+static inline unsigned long zone_present_pages_in_node(int nid,
+					unsigned long zone_type,
+					unsigned long *zones_size)
+{
+	return zones_size[zone_type];
+}
+
+static inline unsigned long zone_absent_pages_in_node(int nid,
+						unsigned long zone_type,
+						unsigned long *zholes_size)
+{
+	if (!zholes_size)
+		return 0;
+
+	return zholes_size[zone_type];
+}
+#endif
+
+static void __init calculate_node_totalpages(struct pglist_data *pgdat,
+		unsigned long *zones_size, unsigned long *zholes_size)
+{
+	unsigned long realtotalpages, totalpages = 0;
+	int i;
+
+	for (i = 0; i < MAX_NR_ZONES; i++) {
+		totalpages += zone_present_pages_in_node(pgdat->node_id, i,
+								zones_size);
+	}
+	pgdat->node_spanned_pages = totalpages;
+
+	realtotalpages = totalpages;
+	for (i = 0; i < MAX_NR_ZONES; i++) {
+		realtotalpages -=
+			zone_absent_pages_in_node(pgdat->node_id, i, zholes_size);
+	}
+	pgdat->node_present_pages = realtotalpages;
+	printk(KERN_DEBUG "On node %d totalpages: %lu\n", pgdat->node_id,
+							realtotalpages);
+}
+
 /*
  * Set up the zone data structures:
  *   - mark all pages reserved
@@ -2070,10 +2273,9 @@ static void __init free_area_init_core(s
 		struct zone *zone = pgdat->node_zones + j;
 		unsigned long size, realsize;
 
-		realsize = size = zones_size[j];
-		if (zholes_size)
-			realsize -= zholes_size[j];
-
+		size = zone_present_pages_in_node(nid, j, zones_size);
+		realsize = size - zone_absent_pages_in_node(nid, j,
+								zholes_size);
 		if (j < ZONE_HIGHMEM)
 			nr_kernel_pages += realsize;
 		nr_all_pages += realsize;
@@ -2140,13 +2342,137 @@ void __init free_area_init_node(int nid,
 {
 	pgdat->node_id = nid;
 	pgdat->node_start_pfn = node_start_pfn;
-	calculate_zone_totalpages(pgdat, zones_size, zholes_size);
+	calculate_node_totalpages(pgdat, zones_size, zholes_size);
 
 	alloc_node_mem_map(pgdat);
 
 	free_area_init_core(pgdat, zones_size, zholes_size);
 }
 
+#ifdef CONFIG_ARCH_POPULATES_NODE_MAP
+void __init add_active_range(unsigned int nid, unsigned long start_pfn,
+						unsigned long end_pfn)
+{
+	unsigned int i;
+	unsigned long pages = end_pfn - start_pfn;
+
+	/* Merge with existing active regions if possible */
+	for (i = 0; early_node_map[i].end_pfn; i++) {
+		if (early_node_map[i].nid != nid)
+			continue;
+
+		if (early_node_map[i].end_pfn == start_pfn) {
+			early_node_map[i].end_pfn += pages;
+			return;
+		}
+
+		if (early_node_map[i].start_pfn == (start_pfn + pages)) {
+			early_node_map[i].start_pfn -= pages;
+			return;
+		}
+	}
+
+	/*
+	 * Leave last entry NULL so we dont iterate off the end (we use
+	 * entry.end_pfn to terminate the walk).
+	 */
+	if (i >= MAX_ACTIVE_REGIONS - 1) {
+		printk(KERN_ERR "WARNING: too many memory regions in "
+				"numa code, truncating\n");
+		return;
+	}
+
+	early_node_map[i].nid = nid;
+	early_node_map[i].start_pfn = start_pfn;
+	early_node_map[i].end_pfn = end_pfn;
+}
+
+/* Compare two active node_active_regions */
+static int __init cmp_node_active_region(const void *a, const void *b)
+{
+	struct node_active_region *arange = (struct node_active_region *)a;
+	struct node_active_region *brange = (struct node_active_region *)b;
+
+	/* Done this way to avoid overflows */
+	if (arange->start_pfn > brange->start_pfn)
+		return 1;
+	if (arange->start_pfn < brange->start_pfn)
+		return -1;
+
+	return 0;
+}
+
+/* sort the node_map by start_pfn */
+static void __init sort_node_map(void)
+{
+	size_t num = 0;
+	while (early_node_map[num].end_pfn)
+		num++;
+
+	sort(early_node_map, num, sizeof(struct node_active_region),
+						cmp_node_active_region, NULL);
+}
+
+unsigned long __init find_min_pfn(void)
+{
+	int i;
+	unsigned long min_pfn = -1UL;
+
+	for (i = 0; early_node_map[i].end_pfn; i++) {
+		if (early_node_map[i].start_pfn < min_pfn)
+			min_pfn = early_node_map[i].start_pfn;
+	}
+
+	return min_pfn;
+}
+
+/* Find the lowest pfn in a node. This depends on a sorted early_node_map */
+unsigned long __init find_start_pfn_for_node(unsigned long nid)
+{
+	int i;
+
+	/* Assuming a sorted map, the first range found has the starting pfn */
+	for_each_active_range_index_in_nid(i, nid) {
+		return early_node_map[i].start_pfn;
+	}
+
+	/* nid does not exist in early_node_map */
+	printk(KERN_WARNING "Could not find start_pfn for node %lu\n", nid);
+	return 0;
+}
+
+void __init free_area_init_nodes(unsigned long arch_max_dma_pfn,
+				unsigned long arch_max_dma32_pfn,
+				unsigned long arch_max_low_pfn,
+				unsigned long arch_max_high_pfn)
+{
+	unsigned long nid;
+
+	/* Record where the zone boundaries are */
+	memset(arch_zone_lowest_possible_pfn, 0,
+				sizeof(arch_zone_lowest_possible_pfn));
+	memset(arch_zone_highest_possible_pfn, 0,
+				sizeof(arch_zone_highest_possible_pfn));
+	arch_zone_lowest_possible_pfn[ZONE_DMA] = find_min_pfn();
+	arch_zone_highest_possible_pfn[ZONE_DMA] = arch_max_dma_pfn;
+	arch_zone_lowest_possible_pfn[ZONE_DMA32] = arch_max_dma_pfn;
+	arch_zone_highest_possible_pfn[ZONE_DMA32] = arch_max_dma32_pfn;
+	arch_zone_lowest_possible_pfn[ZONE_NORMAL] = arch_max_dma32_pfn;
+	arch_zone_highest_possible_pfn[ZONE_NORMAL] = arch_max_low_pfn;
+	arch_zone_lowest_possible_pfn[ZONE_HIGHMEM] = arch_max_low_pfn;
+	arch_zone_highest_possible_pfn[ZONE_HIGHMEM] = arch_max_high_pfn;
+
+	/* Regions in the early_node_map can be in any order */
+	sort_node_map();
+
+	for_each_online_node(nid) {
+		pg_data_t *pgdat = NODE_DATA(nid);
+		free_area_init_node(nid, pgdat, NULL,
+				find_start_pfn_for_node(nid), NULL);
+	}
+}
+#endif /* CONFIG_ARCH_POPULATES_NODE_MAP */
+
 #ifndef CONFIG_NEED_MULTIPLE_NODES
 static bootmem_data_t contig_bootmem_data;
 struct pglist_data contig_page_data = { .bdata = &contig_bootmem_data };

^ permalink raw reply

* [PATCH 5/6] Have ia64 use add_active_range() and free_area_init_nodes
From: Mel Gorman @ 2006-04-11 10:41 UTC (permalink / raw)
  To: linuxppc-dev, tony.luck, ak, linux-kernel, davej; +Cc: Mel Gorman
In-Reply-To: <20060411103946.18153.83059.sendpatchset@skynet>


Size zones and holes in an architecture independent manner for ia64.

This has only been compile-tested due to lack of a suitable test machine.


 arch/ia64/Kconfig          |    3 +
 arch/ia64/mm/contig.c      |   62 +++++-----------------------------------
 arch/ia64/mm/discontig.c   |   43 +++++----------------------
 arch/ia64/mm/init.c        |   10 ++++++
 include/asm-ia64/meminit.h |    1 
 5 files changed, 30 insertions(+), 89 deletions(-)

Signed-off-by: Mel Gorman <mel@csn.ul.ie>
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/Kconfig linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/Kconfig
--- linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/Kconfig	2006-04-03 04:22:10.000000000 +0100
+++ linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/Kconfig	2006-04-10 10:55:25.000000000 +0100
@@ -352,6 +352,9 @@ config NUMA
 	  Access).  This option is for configuring high-end multiprocessor
 	  server systems.  If in doubt, say N.
 
+config ARCH_POPULATES_NODE_MAP
+	def_bool y
+
 # VIRTUAL_MEM_MAP and FLAT_NODE_MEM_MAP are functionally equivalent.
 # VIRTUAL_MEM_MAP has been retained for historical reasons.
 config VIRTUAL_MEM_MAP
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/mm/contig.c linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/mm/contig.c
--- linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/mm/contig.c	2006-04-03 04:22:10.000000000 +0100
+++ linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/mm/contig.c	2006-04-10 10:55:25.000000000 +0100
@@ -26,10 +26,6 @@
 #include <asm/sections.h>
 #include <asm/mca.h>
 
-#ifdef CONFIG_VIRTUAL_MEM_MAP
-static unsigned long num_dma_physpages;
-#endif
-
 /**
  * show_mem - display a memory statistics summary
  *
@@ -212,18 +208,6 @@ count_pages (u64 start, u64 end, void *a
 	return 0;
 }
 
-#ifdef CONFIG_VIRTUAL_MEM_MAP
-static int
-count_dma_pages (u64 start, u64 end, void *arg)
-{
-	unsigned long *count = arg;
-
-	if (start < MAX_DMA_ADDRESS)
-		*count += (min(end, MAX_DMA_ADDRESS) - start) >> PAGE_SHIFT;
-	return 0;
-}
-#endif
-
 /*
  * Set up the page tables.
  */
@@ -232,71 +216,41 @@ void __init
 paging_init (void)
 {
 	unsigned long max_dma;
-	unsigned long zones_size[MAX_NR_ZONES];
 #ifdef CONFIG_VIRTUAL_MEM_MAP
-	unsigned long zholes_size[MAX_NR_ZONES];
+	unsigned long nid = 0;
 	unsigned long max_gap;
 #endif
 
-	/* initialize mem_map[] */
-
-	memset(zones_size, 0, sizeof(zones_size));
-
 	num_physpages = 0;
 	efi_memmap_walk(count_pages, &num_physpages);
 
 	max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
 
 #ifdef CONFIG_VIRTUAL_MEM_MAP
-	memset(zholes_size, 0, sizeof(zholes_size));
-
-	num_dma_physpages = 0;
-	efi_memmap_walk(count_dma_pages, &num_dma_physpages);
-
-	if (max_low_pfn < max_dma) {
-		zones_size[ZONE_DMA] = max_low_pfn;
-		zholes_size[ZONE_DMA] = max_low_pfn - num_dma_physpages;
-	} else {
-		zones_size[ZONE_DMA] = max_dma;
-		zholes_size[ZONE_DMA] = max_dma - num_dma_physpages;
-		if (num_physpages > num_dma_physpages) {
-			zones_size[ZONE_NORMAL] = max_low_pfn - max_dma;
-			zholes_size[ZONE_NORMAL] =
-				((max_low_pfn - max_dma) -
-				 (num_physpages - num_dma_physpages));
-		}
-	}
-
 	max_gap = 0;
+	efi_memmap_walk(register_active_ranges, &nid);
 	efi_memmap_walk(find_largest_hole, (u64 *)&max_gap);
 	if (max_gap < LARGE_GAP) {
-		vmem_map = (struct page *) 0;
-		free_area_init_node(0, NODE_DATA(0), zones_size, 0,
-				    zholes_size);
+		free_area_init_nodes(max_dma, max_dma,
+				max_low_pfn, max_low_pfn);
 	} else {
 		unsigned long map_size;
 
 		/* allocate virtual_mem_map */
-
 		map_size = PAGE_ALIGN(max_low_pfn * sizeof(struct page));
 		vmalloc_end -= map_size;
 		vmem_map = (struct page *) vmalloc_end;
 		efi_memmap_walk(create_mem_map_page_table, NULL);
 
 		NODE_DATA(0)->node_mem_map = vmem_map;
-		free_area_init_node(0, NODE_DATA(0), zones_size,
-				    0, zholes_size);
+		free_area_init_nodes(max_dma, max_dma,
+				max_low_pfn, max_low_pfn);
 
 		printk("Virtual mem_map starts at 0x%p\n", mem_map);
 	}
 #else /* !CONFIG_VIRTUAL_MEM_MAP */
-	if (max_low_pfn < max_dma)
-		zones_size[ZONE_DMA] = max_low_pfn;
-	else {
-		zones_size[ZONE_DMA] = max_dma;
-		zones_size[ZONE_NORMAL] = max_low_pfn - max_dma;
-	}
-	free_area_init(zones_size);
+	add_active_range(0, 0, max_low_pfn);
+	free_area_init_nodes(max_dma, max_dma, max_low_pfn, max_low_pfn);
 #endif /* !CONFIG_VIRTUAL_MEM_MAP */
 	zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
 }
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/mm/discontig.c linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/mm/discontig.c
--- linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/mm/discontig.c	2006-04-03 04:22:10.000000000 +0100
+++ linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/mm/discontig.c	2006-04-10 10:55:25.000000000 +0100
@@ -88,6 +88,9 @@ static int __init build_node_maps(unsign
 	min_low_pfn = min(min_low_pfn, bdp->node_boot_start>>PAGE_SHIFT);
 	max_low_pfn = max(max_low_pfn, bdp->node_low_pfn);
 
+	/* Add a known active range */
+	add_active_range(node, start, end);
+
 	return 0;
 }
 
@@ -660,8 +663,7 @@ static __init int count_node_pages(unsig
 void __init paging_init(void)
 {
 	unsigned long max_dma;
-	unsigned long zones_size[MAX_NR_ZONES];
-	unsigned long zholes_size[MAX_NR_ZONES];
+	unsigned long max_pfn = 0;
 	unsigned long pfn_offset = 0;
 	int node;
 
@@ -679,46 +681,17 @@ void __init paging_init(void)
 #endif
 
 	for_each_online_node(node) {
-		memset(zones_size, 0, sizeof(zones_size));
-		memset(zholes_size, 0, sizeof(zholes_size));
-
 		num_physpages += mem_data[node].num_physpages;
-
-		if (mem_data[node].min_pfn >= max_dma) {
-			/* All of this node's memory is above ZONE_DMA */
-			zones_size[ZONE_NORMAL] = mem_data[node].max_pfn -
-				mem_data[node].min_pfn;
-			zholes_size[ZONE_NORMAL] = mem_data[node].max_pfn -
-				mem_data[node].min_pfn -
-				mem_data[node].num_physpages;
-		} else if (mem_data[node].max_pfn < max_dma) {
-			/* All of this node's memory is in ZONE_DMA */
-			zones_size[ZONE_DMA] = mem_data[node].max_pfn -
-				mem_data[node].min_pfn;
-			zholes_size[ZONE_DMA] = mem_data[node].max_pfn -
-				mem_data[node].min_pfn -
-				mem_data[node].num_dma_physpages;
-		} else {
-			/* This node has memory in both zones */
-			zones_size[ZONE_DMA] = max_dma -
-				mem_data[node].min_pfn;
-			zholes_size[ZONE_DMA] = zones_size[ZONE_DMA] -
-				mem_data[node].num_dma_physpages;
-			zones_size[ZONE_NORMAL] = mem_data[node].max_pfn -
-				max_dma;
-			zholes_size[ZONE_NORMAL] = zones_size[ZONE_NORMAL] -
-				(mem_data[node].num_physpages -
-				 mem_data[node].num_dma_physpages);
-		}
-
 		pfn_offset = mem_data[node].min_pfn;
 
 #ifdef CONFIG_VIRTUAL_MEM_MAP
 		NODE_DATA(node)->node_mem_map = vmem_map + pfn_offset;
 #endif
-		free_area_init_node(node, NODE_DATA(node), zones_size,
-				    pfn_offset, zholes_size);
+		if (mem_data[node].max_pfn > max_pfn)
+			max_pfn = mem_data[node].max_pfn;
 	}
 
+	free_area_init_nodes(max_dma, max_dma, max_pfn, max_pfn);
+
 	zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
 }
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/mm/init.c linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/mm/init.c
--- linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/mm/init.c	2006-04-03 04:22:10.000000000 +0100
+++ linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/mm/init.c	2006-04-10 10:55:25.000000000 +0100
@@ -526,6 +526,16 @@ ia64_pfn_valid (unsigned long pfn)
 EXPORT_SYMBOL(ia64_pfn_valid);
 
 int __init
+register_active_ranges(u64 start, u64 end, void *nid)
+{
+	BUG_ON(nid == NULL);
+	BUG_ON(*(unsigned long *)nid >= MAX_NUMNODES);
+
+	add_active_range(*(unsigned long *)nid, start, end);
+	return 0;
+}
+
+int __init
 find_largest_hole (u64 start, u64 end, void *arg)
 {
 	u64 *max_gap = arg;
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc1-104-x86_64_use_init_nodes/include/asm-ia64/meminit.h linux-2.6.17-rc1-105-ia64_use_init_nodes/include/asm-ia64/meminit.h
--- linux-2.6.17-rc1-104-x86_64_use_init_nodes/include/asm-ia64/meminit.h	2006-04-03 04:22:10.000000000 +0100
+++ linux-2.6.17-rc1-105-ia64_use_init_nodes/include/asm-ia64/meminit.h	2006-04-10 10:55:25.000000000 +0100
@@ -56,6 +56,7 @@ extern void efi_memmap_init(unsigned lon
   extern unsigned long vmalloc_end;
   extern struct page *vmem_map;
   extern int find_largest_hole (u64 start, u64 end, void *arg);
+  extern int register_active_ranges (u64 start, u64 end, void *arg);
   extern int create_mem_map_page_table (u64 start, u64 end, void *arg);
 #endif
 

^ permalink raw reply

* checking posting: ignore please
From: Stefan Meyer @ 2006-04-11 11:34 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 45 bytes --]

Just verifying that the posting is working 

[-- Attachment #2: Type: text/html, Size: 377 bytes --]

^ permalink raw reply

* Linux kernel for MPC834X platform
From: Stefan Meyer @ 2006-04-11 10:30 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 1663 bytes --]

Hi All
Pardon the intrusion if this is not the correct way to get the relevant information, but I am relatively new to kernel hacking.
Anyway here goes my question:
I am getting a Freescale MPC8343 based board up and running and have been using the BSP (with patched 2.6.11 kernel) release by Freescale with great success.
However when I tried to use the USB ISO transactions it seems to be non functional. I have connected a known good working codec (tested on my PC's usb) and tried to access it via the low level sound driver (/dev/dsp) but it only creates garbled noise. 
In the meanwhile, I have noticed that the official kernel release 2.6.17 also start supporting the MPC834X platform and would rather like to persue that avenue to get my problems addressed (hopefully). 
I have downloaded the latest 2.6.17 kernel and got it going  with the configuration for MPC834x_sys, with relation to booting and ethernet comms. 
However there are clearly no provision in the USB driver for setting up the usb clocks and ports (which is of course MPC834x specific). 
I have tried to hack it by inserting approriate code form the 2.6.11 freescale kernel but with very little success. 
On inspection of the 2.6.11 kernel from Freescale I have also noticed that the USB core drivers were heavily modified around DMA buffer management, although the 2.6.17 had no such hacks in place.    
My question simply relates to the status of the MPC834x implementation on the 2.6.17 kernel in so far that it is operational and being tested on hardware platforms. Could you please direct me to the persons(s) who have experience with this platform ?

Regards
Stefan


[-- Attachment #2: Type: text/html, Size: 2730 bytes --]

^ permalink raw reply

* Re: Create permanent mapping from PCI bus to region of physical memory
From: Mark Chambers @ 2006-04-11 12:03 UTC (permalink / raw)
  To: Howard, Marc; +Cc: linuxppc-embedded
In-Reply-To: <443B27E6.8070607@ovro.caltech.edu>

> You always have the hack of reserving a block of memory
> at the top of SDRAM, i.e., lie to Linux and tell it it
> has less memory. It sounds like that might be the least
> effort. Rubini has an example of how to do that.
> 

I've done this with a bus-master PCI peripheral and it works
nicely.  The other point about this is that the mmap() call
will work rationally with memory above the linux pool, so
it's easy to go straight to/from user land with this approach.
(and you can set caching and the guard bit and all that so
that PPC access works the way you want it to)

Mark Chambers

^ permalink raw reply

* Xilinx Virtex-2 PRO FPGA ppc 405 on ML310 board
From: Vincent Winstead @ 2006-04-11 12:55 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 591 bytes --]

I'm having a real difficulty trying to get linux onto this board.  So I'm finally turning to the community for help.  The only people that have documented their approach to putting open source linux onto the ML310 board have used bitkeeper to download the kernel for the project, but bitkeeper isn't used any more is it?  I've been going straight to kernel.org and getting kernels from there and crosscompiling them on my machine to be transported to the ppc core on the ML310.  Is this wrong?  Is there a patch or some kernel source that I don't know about for PPC?  Thanks!
   
  -Vincent

[-- Attachment #2: Type: text/html, Size: 656 bytes --]

^ permalink raw reply

* Re: Linux kernel for MPC834X platform
From: Kumar Gala @ 2006-04-11 13:03 UTC (permalink / raw)
  To: Stefan Meyer; +Cc: linuxppc-embedded
In-Reply-To: <002301c65d52$fd7c6fd0$1100a8c0@stefanlaptop>


On Apr 11, 2006, at 5:30 AM, Stefan Meyer wrote:

> Hi All
> Pardon the intrusion if this is not the correct way to get the  
> relevant information, but I am relatively new to kernel hacking.
> Anyway here goes my question:
> I am getting a Freescale MPC8343 based board up and running and  
> have been using the BSP (with patched 2.6.11 kernel) release by  
> Freescale with great success.
> However when I tried to use the USB ISO transactions it seems to be  
> non functional. I have connected a known good working codec (tested  
> on my PC's usb) and tried to access it via the low level sound  
> driver (/dev/dsp) but it only creates garbled noise.
> In the meanwhile, I have noticed that the official kernel release  
> 2.6.17 also start supporting the MPC834X platform and would rather  
> like to persue that avenue to get my problems addressed (hopefully).
> I have downloaded the latest 2.6.17 kernel and got it going  with  
> the configuration for MPC834x_sys, with relation to booting and  
> ethernet comms.
> However there are clearly no provision in the USB driver for  
> setting up the usb clocks and ports (which is of course MPC834x  
> specific).
> I have tried to hack it by inserting approriate code form the  
> 2.6.11 freescale kernel but with very little success.
> On inspection of the 2.6.11 kernel from Freescale I have also  
> noticed that the USB core drivers were heavily modified around DMA  
> buffer management, although the 2.6.17 had no such hacks in place.
> My question simply relates to the status of the MPC834x  
> implementation on the 2.6.17 kernel in so far that it is  
> operational and being tested on hardware platforms. Could you  
> please direct me to the persons(s) who have experience with this  
> platform ?

The USB support for MPC834x only exists if you build it for  
ARCH=powerpc.  There is a patch on the list archives for adding  
support to ARCH=ppc.  I don't know if there is any issue with ISO  
transactions in those version, but they been shown to work with USB  
ethernet and USB HD devices.

- kumar

^ permalink raw reply

* Re: [PATCH 6/6] Break out memory initialisation code from page_alloc.c to mem_init.c
From: Nick Piggin @ 2006-04-11 11:07 UTC (permalink / raw)
  To: Mel Gorman; +Cc: davej, tony.luck, ak, linux-kernel, linuxppc-dev
In-Reply-To: <20060411104147.18153.64342.sendpatchset@skynet>

Mel Gorman wrote:
> page_alloc.c contains a large amount of memory initialisation code. This patch
> breaks out the initialisation code to a separate file to make page_alloc.c
> a bit easier to read.
> 

Seems like a very good idea to me.

> +/*
> + * mm/mem_init.c
> + * Initialises the architecture independant view of memory. pgdats, zones, etc
> + *
> + *  Copyright (C) 1991, 1992, 1993, 1994  Linus Torvalds
> + *  Swap reorganised 29.12.95, Stephen Tweedie
> + *  Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
> + *  Reshaped it to be a zoned allocator, Ingo Molnar, Red Hat, 1999
> + *  Discontiguous memory support, Kanoj Sarcar, SGI, Nov 1999
> + *  Zone balancing, Kanoj Sarcar, SGI, Jan 2000
> + *  Per cpu hot/cold page lists, bulk allocation, Martin J. Bligh, Sept 2002
> + *	(lots of bits borrowed from Ingo Molnar & Andrew Morton)
> + *  Arch-independant zone size and hole calculation, Mel Gorman, IBM, Apr 2006
> + *	(lots of bits taken from architecture code)
> + */

Maybe drop the duplicated changelog? (just retain copyrights I guess)

-- 
SUSE Labs, Novell Inc.
Send instant messages to your online friends http://au.messenger.yahoo.com 

^ permalink raw reply

* RTC/I2C problems
From: Kenneth Poole @ 2006-04-11 14:25 UTC (permalink / raw)
  To: linuxppc-embedded

[-- Attachment #1: Type: text/plain, Size: 1269 bytes --]

We had a similar problem with our 8xx implementation. The problem was
decrementer underflow. In the kernel initialization, calibrate_decr()
was called before set_dec(), so the decrementer can count down through 0
before the decrementer exception gets enabled. To fix this, we moved the
call to set_dec() from time_init() to calibrate_decr() before the
exception is enabled in the tbcsr.

Ken Poole


>Hi everybody.

>I have a problem with my RTC, i work on a MEN A12 board with MPC8245
and 
>when my kernel start it takes 8 min to run. I have find the problem but
i 
>don't know how to solve it. In time.c the function time_init execute
the 
>following lines :

>if (__USE_RTC()) {
>    /* 601 processor: dec counts down by 128 every 128ns */
>    tb_ticks_per_jiffy = DECREMENTER_COUNT_601;
>    /* mulhwu_scale_factor(1000000000, 1000000) is 0x418937 */
>    tb_to_us = 0x0x418937;
>}  else {
>    ppc_md.calibrate_decr();
>    tb_to_ns_scale = mulhwu(tb_to_us, 1000 << 10);
>}

>this is the ppc_md.calibrate_decr() function that takes a lot of time
and i 
>don't know how to solve the problem. USE_RTC is fixed at 0 for 6xx
config 
>maybe it must be at 1 ? My RTC run with SMBus (I2C). I work with ELDK
4.0 
>and linux 2.6.15.


[-- Attachment #2: Type: text/html, Size: 4986 bytes --]

^ permalink raw reply

* Oops: kernel access of bad area, sig: 11  ( mpc852t)
From: gautam borad @ 2006-04-11 14:06 UTC (permalink / raw)
  To: linuxppc-embedded

Hi,
    Im having problem porting linux kernel 2.4.21 to our mpc852T custom 
board.The kernel
panics randomly with sig 11.
The board boots up fine and we also get to the prompt.When we open 3-4 
telnet sessions
and try to run some command the kernel panics.This is completely 
random.Sometimes it
even panics before opening the telnet session.

One of the oops dump is:

-----------------------------------------------------------------------------------------------------------------------------
Oops: kernel access of bad area, sig: 11
NIP: C0019FD0 XER: 00000000 LR: C001A06C SP: C1C33AD0 REGS: c1c33a20 
TRAP: 0300    Not tainted
MSR: 00009032 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
DAR: 725F6578, DSISR: 0000000B
TASK = c1c32000[48] 'insmod' Last syscall: 5
last math 00000000 last altivec 00000000
GPR00: 7361726D C1C33AD0 C1C32000 00000000 C0113678 C0150000 C0150000 
C014B210
GPR08: C014B210 C012D060 00000000 725F6578 04000024 00000000 00000000 
00000000
GPR16: 00000000 00000000 00000000 00000000 00001032 01C33BA0 00000000 
C0000000
GPR24: C014BE38 C0150000 C0110000 C0110000 C0140000 00000001 00000000 
00000001
Call backtrace:
C001A0C8 C0016174 C0015FEC C0015CC0 C0005E38 C0004668 C1C33D10
C0004670 C004A380 C003FFD4 C00404D8 C0040AD4 C0040FF8 C00330D8
C00334AC C000443C 1006EF48 1001FCF0 1002023C 10003A18 100036A0
300591AC 00000000
-----------------------------------------------------------------------------------------------------------------------------

The call trace back is of not much help because it is different on all oops.
We are using u-boot 1-1-3.

Thanks in advance.

^ permalink raw reply

* Re: kernel access of bad area, sig: 11  ( mpc852t)
From: Mark Chambers @ 2006-04-11 14:39 UTC (permalink / raw)
  To: gautam borad, linuxppc-embedded
In-Reply-To: <443BB7E2.9040903@eisodus.com>

> Hi,
>    Im having problem porting linux kernel 2.4.21 to our mpc852T custom
> board.The kernel
> panics randomly with sig 11.
> The board boots up fine and we also get to the prompt.When we open 3-4
> telnet sessions
> and try to run some command the kernel panics.This is completely
> random.Sometimes it
> even panics before opening the telnet session.
>
> One of the oops dump is:
>
> -----------------------------------------------------------------------------------------------------------------------------
> Oops: kernel access of bad area, sig: 11
> NIP: C0019FD0 XER: 00000000 LR: C001A06C SP: C1C33AD0 REGS: c1c33a20
> TRAP: 0300    Not tainted
> MSR: 00009032 EE: 1 PR: 0 FP: 0 ME: 1 IR/DR: 11
> DAR: 725F6578, DSISR: 0000000B
> TASK = c1c32000[48] 'insmod' Last syscall: 5
> last math 00000000 last altivec 00000000
> GPR00: 7361726D C1C33AD0 C1C32000 00000000 C0113678 C0150000 C0150000
> C014B210
> GPR08: C014B210 C012D060 00000000 725F6578 04000024 00000000 00000000
> 00000000
> GPR16: 00000000 00000000 00000000 00000000 00001032 01C33BA0 00000000
> C0000000
> GPR24: C014BE38 C0150000 C0110000 C0110000 C0140000 00000001 00000000
> 00000001
> Call backtrace:
> C001A0C8 C0016174 C0015FEC C0015CC0 C0005E38 C0004668 C1C33D10
> C0004670 C004A380 C003FFD4 C00404D8 C0040AD4 C0040FF8 C00330D8
> C00334AC C000443C 1006EF48 1001FCF0 1002023C 10003A18 100036A0
> 300591AC 00000000
> -----------------------------------------------------------------------------------------------------------------------------
>
> The call trace back is of not much help because it is different on all 
> oops.
> We are using u-boot 1-1-3.
>
> Thanks in advance.
>

You almost certainly have SDRAM problems.  If you have thoroughly checked 
out the
complete address range statically, remember that burst accesses will not 
occur until the
cache is turned on, so your problem may be with bursting.  But you can also 
have severe
problems like a missing address line and linux still run for a few seconds.

Mark Chambers 

^ permalink raw reply

* Re: Linux kernel for MPC834X platform
From: Stefan Meyer @ 2006-04-11 15:15 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-embedded
In-Reply-To: <2A229EEE-36CF-4E1D-B94C-D4EB6AB5F5B3@kernel.crashing.org>

Hi Kumar
Thanks for the advice. I will rebuild for powerpc and report back.
B.t.w. what is the story behind the ppc and powerpc branches anyway ?

Regards
Stefan

----- Original Message ----- 
From: "Kumar Gala" <galak@kernel.crashing.org>
To: "Stefan Meyer" <reyems@telkomsa.net>
Cc: <linuxppc-embedded@ozlabs.org>
Sent: Tuesday, April 11, 2006 3:03 PM
Subject: Re: Linux kernel for MPC834X platform


> 
> On Apr 11, 2006, at 5:30 AM, Stefan Meyer wrote:
> 
>> Hi All
>> Pardon the intrusion if this is not the correct way to get the  
>> relevant information, but I am relatively new to kernel hacking.
>> Anyway here goes my question:
>> I am getting a Freescale MPC8343 based board up and running and  
>> have been using the BSP (with patched 2.6.11 kernel) release by  
>> Freescale with great success.
>> However when I tried to use the USB ISO transactions it seems to be  
>> non functional. I have connected a known good working codec (tested  
>> on my PC's usb) and tried to access it via the low level sound  
>> driver (/dev/dsp) but it only creates garbled noise.
>> In the meanwhile, I have noticed that the official kernel release  
>> 2.6.17 also start supporting the MPC834X platform and would rather  
>> like to persue that avenue to get my problems addressed (hopefully).
>> I have downloaded the latest 2.6.17 kernel and got it going  with  
>> the configuration for MPC834x_sys, with relation to booting and  
>> ethernet comms.
>> However there are clearly no provision in the USB driver for  
>> setting up the usb clocks and ports (which is of course MPC834x  
>> specific).
>> I have tried to hack it by inserting approriate code form the  
>> 2.6.11 freescale kernel but with very little success.
>> On inspection of the 2.6.11 kernel from Freescale I have also  
>> noticed that the USB core drivers were heavily modified around DMA  
>> buffer management, although the 2.6.17 had no such hacks in place.
>> My question simply relates to the status of the MPC834x  
>> implementation on the 2.6.17 kernel in so far that it is  
>> operational and being tested on hardware platforms. Could you  
>> please direct me to the persons(s) who have experience with this  
>> platform ?
> 
> The USB support for MPC834x only exists if you build it for  
> ARCH=powerpc.  There is a patch on the list archives for adding  
> support to ARCH=ppc.  I don't know if there is any issue with ISO  
> transactions in those version, but they been shown to work with USB  
> ethernet and USB HD devices.
> 
> - kumar
>

^ permalink raw reply

* Re: Linux kernel for MPC834X platform
From: Kumar Gala @ 2006-04-11 15:14 UTC (permalink / raw)
  To: Stefan Meyer; +Cc: linuxppc-embedded
In-Reply-To: <003101c65d7a$c68fbd60$1100a8c0@stefanlaptop>

On Tue, 11 Apr 2006, Stefan Meyer wrote:

> Hi Kumar
> Thanks for the advice. I will rebuild for powerpc and report back.
> B.t.w. what is the story behind the ppc and powerpc branches anyway ?

The powerpc tree is a merge of the ppc32/64 trees into one arch.  It 
requires a flat device tree to boot.  You will need a new u-boot for this 
that produces a flat device tree.

- kumar

^ permalink raw reply

* Re: Linux kernel for MPC834X platform
From: Stefan Meyer @ 2006-04-11 15:24 UTC (permalink / raw)
  To: Kumar Gala; +Cc: linuxppc-embedded
In-Reply-To: <Pine.LNX.4.44.0604111013580.25404-100000@gate.crashing.org>

Hi Kumar
Pardon my ignorance, but  I am not with you on the flat device tree and the 
new u-boot ??
Regards
Stefan


----- Original Message ----- 
From: "Kumar Gala" <galak@kernel.crashing.org>
To: "Stefan Meyer" <reyems@telkomsa.net>
Cc: <linuxppc-embedded@ozlabs.org>
Sent: Tuesday, April 11, 2006 5:14 PM
Subject: Re: Linux kernel for MPC834X platform


> On Tue, 11 Apr 2006, Stefan Meyer wrote:
>
>> Hi Kumar
>> Thanks for the advice. I will rebuild for powerpc and report back.
>> B.t.w. what is the story behind the ppc and powerpc branches anyway ?
>
> The powerpc tree is a merge of the ppc32/64 trees into one arch.  It
> requires a flat device tree to boot.  You will need a new u-boot for this
> that produces a flat device tree.
>
> - kumar
>
> 

^ permalink raw reply

* Re: Linux kernel for MPC834X platform
From: Kumar Gala @ 2006-04-11 15:23 UTC (permalink / raw)
  To: Stefan Meyer; +Cc: linuxppc-embedded
In-Reply-To: <003d01c65d7b$f88a6da0$1100a8c0@stefanlaptop>

On Tue, 11 Apr 2006, Stefan Meyer wrote:

> Hi Kumar
> Pardon my ignorance, but  I am not with you on the flat device tree and the 
> new u-boot ??
> Regards
> Stefan

Look at Documentation/powerpc/booting-without-of.txt in the kernel tree.  
I have a u-boot tree @ git.kernel.org/pub/scm/boot/u-boot/u-boot.git which 
has support for booting the MPC834x ADS/MDS/SYS board from Freescale with 
a flat device tree for use with the arch/powerpc port.

- kumar

^ permalink raw reply

* NAND and JFFS2 supports in Linux 2.4
From: Laurent Lagrange @ 2006-04-11 16:31 UTC (permalink / raw)
  To: linuxppc-embedded


Hello,

I work on a custom 82xx board with a NAND flash :
NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V
8-bit)

I have to KEEP a Linux 2.4 and can't migrate to a Linux 2.6 for this board.

This type of NAND flash and JFFS2 work fine with a Linux 2.6 but with a
Linux 2.4,
this is a little tricky :
Linux 2.4.18 or 2.4.25 do not support this device,
Linux 2.4.31 seems supporting this device but JFFS2 is not adapted,
Linux 2.4.32 does not support this device anymore.

On www.linux-mtd.infradead.org, it seems that Linux 2.4 is no more
supported.

Any help would be welcome
Thanks
Laurent

^ permalink raw reply

* Re: [PATCH 6/6] Break out memory initialisation code from page_alloc.c to mem_init.c
From: Mel Gorman @ 2006-04-11 16:59 UTC (permalink / raw)
  To: Nick Piggin; +Cc: davej, tony.luck, ak, Linux Kernel Mailing List, linuxppc-dev
In-Reply-To: <443B8DE7.4000900@yahoo.com.au>

On Tue, 11 Apr 2006, Nick Piggin wrote:

> Mel Gorman wrote:
>> page_alloc.c contains a large amount of memory initialisation code. This 
>> patch
>> breaks out the initialisation code to a separate file to make page_alloc.c
>> a bit easier to read.
>> 
>
> Seems like a very good idea to me.
>

If there is interest in treating this separetly, it can be broken out as a 
standalone patch. In this form, it depends on the first patch from the 
set.

>> +/*
>> + * mm/mem_init.c
>> + * Initialises the architecture independant view of memory. pgdats, zones, 
>> etc
>> + *
>> + *  Copyright (C) 1991, 1992, 1993, 1994  Linus Torvalds
>> + *  Swap reorganised 29.12.95, Stephen Tweedie
>> + *  Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
>> + *  Reshaped it to be a zoned allocator, Ingo Molnar, Red Hat, 1999
>> + *  Discontiguous memory support, Kanoj Sarcar, SGI, Nov 1999
>> + *  Zone balancing, Kanoj Sarcar, SGI, Jan 2000
>> + *  Per cpu hot/cold page lists, bulk allocation, Martin J. Bligh, Sept 
>> 2002
>> + *	(lots of bits borrowed from Ingo Molnar & Andrew Morton)
>> + *  Arch-independant zone size and hole calculation, Mel Gorman, IBM, Apr 
>> 2006
>> + *	(lots of bits taken from architecture code)
>> + */
>
> Maybe drop the duplicated changelog? (just retain copyrights I guess)
>

Makes sense.

+ *  Copyright (C) 1991, 1992, 1993, 1994  Linus Torvalds
+ *  Copyright (C) 1995, Stephen Tweedie
+ *  Copyright (C) July 1999, Gerhard Wichert, Siemens AG
+ *  Copyright (C) 1999, Ingo Molnar, Red Hat
+ *  Copyright (C) 1999, 2000, Kanoj Sarcar, SGI
+ *  Copyright (C) Sept 2000, Martin J. Bligh
+ *     (lots of bits borrowed from Ingo Molnar & Andrew Morton)
+ *  Copyright (C) Apr 2006, Mel Gorman, IBM
+ *     (lots of bits taken from architecture-specific code)


-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

^ permalink raw reply

* Re: [PATCH 1/2] tickless idle cpus: core patch - v2
From: Paul Mackerras @ 2006-04-11 17:35 UTC (permalink / raw)
  To: vatsa; +Cc: linuxppc-dev
In-Reply-To: <20060410121847.GB5564@in.ibm.com>

Srivatsa Vaddagiri writes:

> This is the v2 of the core patch to skip ticks when a CPU is idle.
> Changes since v1:
> 
> 	-  fix the buggy call to stop_hz_timer in idle_power4.S (hopefully it 
> 	   is correct now!).

It would be nice if we could arrange to call stop_hz_timer from the
top-level cpu_idle() function rather than having to call it from the
individual power_save() functions such as power4_idle().  Can you see
a problem with doing that?

Paul.

^ permalink raw reply

* Re: [PATCH] Set cpu explicitly in kernel compiles
From: Olaf Hering @ 2006-04-11 18:42 UTC (permalink / raw)
  To: Paul Mackerras; +Cc: linuxppc-dev, trini
In-Reply-To: <17460.39696.910677.444426@cargo.ozlabs.ibm.com>

 On Thu, Apr 06, Paul Mackeras wrote:

> Olaf Hering writes:
> 
> > --- linux-2.6.16-olh.orig/arch/powerpc/Makefile
> > +++ linux-2.6.16-olh/arch/powerpc/Makefile
> > @@ -107,6 +107,7 @@ endif
> >  cpu-as-$(CONFIG_PPC64BRIDGE)	+= -Wa,-mppc64bridge
> >  cpu-as-$(CONFIG_4xx)		+= -Wa,-m405
> >  cpu-as-$(CONFIG_6xx)		+= -Wa,-maltivec
> > +cpu-as-$(CONFIG_6xx)		+= -mcpu=powerpc
> 
> Is this really the right place for this?  The cpu-as- thing is really
> for assembler options.



Compile the 32bit kernel with -mcpu=powerpc. This reduces the imagesize
when a compiler is used that defaults to -mtune=power4. It inserts lots 
of nops to please the 64bit cpu instruction scheduling. But all these nops
are not needed for 32bit kernels.

Example with SLES10 gcc 4.1.0 and arch/powerpc/configs/pmac32_defconfig:

                    vmlinux  vmlinux.strip  vmlinux.gz
 -O2                4980515     4187528      1846829
 -Os                4618801     3827084      1673333
 -O2 -mcpu=powerpc  4738851     3945868      1816253
 -Os -mcpu=powerpc  4532785     3741068      1664688


Signed-off-by: Olaf Hering <olh@suse.de>

---
 arch/powerpc/Makefile |    4 ++++
 1 file changed, 4 insertions(+)

Index: linux-2.6.16-olh/arch/powerpc/Makefile
===================================================================
--- linux-2.6.16-olh.orig/arch/powerpc/Makefile
+++ linux-2.6.16-olh/arch/powerpc/Makefile
@@ -104,6 +104,10 @@ ifndef CONFIG_FSL_BOOKE
 CFLAGS		+= -mstring
 endif
 
+ifeq ($(CONFIG_6xx),y)
+CFLAGS		+= -mcpu=powerpc
+endif
+
 cpu-as-$(CONFIG_PPC64BRIDGE)	+= -Wa,-mppc64bridge
 cpu-as-$(CONFIG_4xx)		+= -Wa,-m405
 cpu-as-$(CONFIG_6xx)		+= -Wa,-maltivec

^ permalink raw reply

* Re: Xilinx Virtex-2 PRO FPGA ppc 405 on ML310 board
From: Grant Likely @ 2006-04-11 19:46 UTC (permalink / raw)
  To: Vincent Winstead; +Cc: linuxppc-embedded
In-Reply-To: <20060411125550.52660.qmail@web52002.mail.yahoo.com>

On 4/11/06, Vincent Winstead <vwinstead@yahoo.com> wrote:
>
> I'm having a real difficulty trying to get linux onto this board.  So I'm
> finally turning to the community for help.  The only people that have
> documented their approach to putting open source linux onto the ML310 boa=
rd
> have used bitkeeper to download the kernel for the project, but bitkeeper
> isn't used any more is it?  I've been going straight to kernel.org and
> getting kernels from there and crosscompiling them on my machine to be
> transported to the ppc core on the ML310.  Is this wrong?  Is there a pat=
ch
> or some kernel source that I don't know about for PPC?  Thanks!

Are you using 2.4 or 2.6?

Support for the ML300 & ML403 is in the mainline 2.6 git tree.  As
long as you've got an xparameters.h file for your FPGA bitstream,  you
should be able to port a 2.6 kernel really easily.

If you want to use 2.4, you can pull the linuxppc rsync mirror which
has ML300 support in it.

http://www.penguinppc.org/kernel/  (Look at the very bottom of the
page for the RSYNC mirror)

Cheers,
g.

--
Grant Likely, B.Sc. P.Eng.
Secret Lab Technologies Ltd.
(403) 399-0195

^ permalink raw reply

* Re: NAND and JFFS2 supports in Linux 2.4
From: Jaap-Jan Boor @ 2006-04-11 20:06 UTC (permalink / raw)
  To: Laurent Lagrange; +Cc: linuxppc-embedded
In-Reply-To: <000001c65d85$5e699890$5201a8c0@GEG2400>

Laurent,

Take a look at the 2.4 http://www.denx.de kernel, it has NAND and jffs2
support.

Jaap-Jan

On 11-apr-2006, at 18:31, Laurent Lagrange wrote:

>
> Hello,
>
> I work on a custom 82xx board with a NAND flash :
> NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND  
> 128MiB 3,3V
> 8-bit)
>
> I have to KEEP a Linux 2.4 and can't migrate to a Linux 2.6 for  
> this board.
>
> This type of NAND flash and JFFS2 work fine with a Linux 2.6 but  
> with a
> Linux 2.4,
> this is a little tricky :
> Linux 2.4.18 or 2.4.25 do not support this device,
> Linux 2.4.31 seems supporting this device but JFFS2 is not adapted,
> Linux 2.4.32 does not support this device anymore.
>
> On www.linux-mtd.infradead.org, it seems that Linux 2.4 is no more
> supported.
>
> Any help would be welcome
> Thanks
> Laurent
>
>
> _______________________________________________
> Linuxppc-embedded mailing list
> Linuxppc-embedded@ozlabs.org
> https://ozlabs.org/mailman/listinfo/linuxppc-embedded
>
> -- 
> This message has been scanned for viruses and is believed to be clean
>

____
J.G.J. Boor                       Anton Philipsweg 1
Software Engineer                 1223 KZ Hilversum
AimSys bv                         tel. +31 35 689 1941
Postbus 2194, 1200 CD Hilversum   jjboor at aimsys dot nl

^ permalink raw reply

* Re: [PATCH 2/2] Base pSeries PCIe support
From: Benjamin Herrenschmidt @ 2006-04-11 21:31 UTC (permalink / raw)
  To: Jake Moilanen; +Cc: linuxppc-dev, paulus
In-Reply-To: <20060410103929.9664238d.moilanen@austin.ibm.com>


> I was able to validate that these patches do work, and we are receiving
> MSI interrupts correctly.
> 
> Is it too late to get into 2.6.17?

Yes and it's totally broken anyway. The whole idea of "hiding" MSIs as
if they were LSIs is totally irrealistic in practice. Our firmware might
do it but we have to undo it.

Linux defines the semantics of a driver probe() routine to be called
with MSIs disabled by default.

This is very important as for a lot of devices (I'd say the vast
majority of the devices that claim to be MSI capable), enabling MSI is
either broken (various HW bugs related to using them, mostly ordering
issues) or requires all sort of additional tweaking on the device side
in addition to the standard config space stuffs.

Thus, we need to help whoever is currently ripping off the
drivers/pci/msi.c code which is way too Intel-centric (there's an SGI
guy working on it already) and implement an arch specific implementation
that undoes what the firmware did, and then re-assign MSIs as requested
by drviers.

Some of the Boeblingen folks have already been looking into it as part
of some bare-metal/bringup effort, but that doesn't include PAPR
implementation.

Ben.

^ permalink raw reply

* Re: NAND and JFFS2 supports in Linux 2.4
From: Josh Boyer @ 2006-04-11 21:19 UTC (permalink / raw)
  To: Laurent Lagrange; +Cc: linuxppc-embedded
In-Reply-To: <000001c65d85$5e699890$5201a8c0@GEG2400>

On Tue, 2006-04-11 at 18:31 +0200, Laurent Lagrange wrote:
> Hello,
> 
> I work on a custom 82xx board with a NAND flash :
> NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V
> 8-bit)
> 
> I have to KEEP a Linux 2.4 and can't migrate to a Linux 2.6 for this board.
> 
> This type of NAND flash and JFFS2 work fine with a Linux 2.6 but with a
> Linux 2.4,
> this is a little tricky :
> Linux 2.4.18 or 2.4.25 do not support this device,

Those are entire too old.

> Linux 2.4.31 seems supporting this device but JFFS2 is not adapted,

NAND + JFFS2 + 2.4 is not a supported combination.
 
> Linux 2.4.32 does not support this device anymore.

Odd.  Do you have a diff from .31 to .32?

> On www.linux-mtd.infradead.org, it seems that Linux 2.4 is no more
> supported.

Well, 2.4 is supported but no new features go in that tree.  Including
NAND support in JFFS2.  If there is a bug in the 2.4 code that is
present in MTD/JFFS2 it can certainly still be fixed.

> 
> Any help would be welcome

You might try your luck with patching the latest 2.4 kernel with MTD
CVS.  But be warned that quite a few things have changed, so you'd have
to essentially backport.

And keep in mind that it's not supported.

josh

^ permalink raw reply

* Re: [PATCH 0/6] [RFC] Sizing zones and holes in an architecture independent manner
From: Luck, Tony @ 2006-04-11 22:20 UTC (permalink / raw)
  To: Mel Gorman; +Cc: linuxppc-dev, ak, linux-kernel, davej
In-Reply-To: <20060411103946.18153.83059.sendpatchset@skynet>

On Tue, Apr 11, 2006 at 11:39:46AM +0100, Mel Gorman wrote:

> The patches have only been *compile tested* for ia64 with a flatmem
> configuration. At attempt was made to boot test on an ancient RS/6000
> but the vanilla kernel does not boot so I have to investigate there.

The good news: Compilation is clean on the ia64 config variants that
I usually build (all 10 of them).

The bad (or at least consistent) news: It doesn't boot on an Intel
Tiger either (oops at kmem_cache_alloc+0x41).

-Tony

^ permalink raw reply

* Re: [PATCH 0/6] [RFC] Sizing zones and holes in an architecture independent manner
From: Mel Gorman @ 2006-04-11 23:23 UTC (permalink / raw)
  To: Luck, Tony; +Cc: linuxppc-dev, ak, Linux Kernel Mailing List, davej
In-Reply-To: <20060411222029.GA7743@agluck-lia64.sc.intel.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1754 bytes --]

On Tue, 11 Apr 2006, Luck, Tony wrote:

> On Tue, Apr 11, 2006 at 11:39:46AM +0100, Mel Gorman wrote:
>
>> The patches have only been *compile tested* for ia64 with a flatmem
>> configuration. At attempt was made to boot test on an ancient RS/6000
>> but the vanilla kernel does not boot so I have to investigate there.
>
> The good news: Compilation is clean on the ia64 config variants that
> I usually build (all 10 of them).
>

One plus at least.

> The bad (or at least consistent) news: It doesn't boot on an Intel
> Tiger either (oops at kmem_cache_alloc+0x41).
>

Darn.

o Did it boot on other IA64 machines or was the Tiger the first boot failure?
o Possibly a stupid question but does the Tiger configuration use the
   flatmem memory model, sparsemem or discontig?

If it's flatmem, I noticed I made a stupid mistake where vmem_map is not 
getting set to (void *)0 for machines with small memory holes. Nothing 
else really obvious jumped out at me.

I've attached a patch called "105-ia64_use_init_nodes.patch". Can you 
reverse Patch 5/6 and apply this one instead please? I've also attached 
107-debug.diff that applies on top of patch 6/6. It just prints out 
debugging information during startup that may tell me where I went wrong 
in arch/ia64. I'd really appreciate it if you could use both patches, let 
me know if it still fails to boot and send me the console log of the 
machine starting up if it fails so I can make guesses as to what is going 
wrong.

Thanks a lot for trying the patches out on ia64. It was the one arch of 
the set I had no chance to test with at all :/

-- 
Mel Gorman
Part-time Phd Student                          Linux Technology Center
University of Limerick                         IBM Dublin Software Lab

[-- Attachment #2: 105-ia64_use_init_nodes.patch --]
[-- Type: TEXT/PLAIN, Size: 8361 bytes --]

diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/Kconfig linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/Kconfig
--- linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/Kconfig	2006-04-03 04:22:10.000000000 +0100
+++ linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/Kconfig	2006-04-11 23:31:38.000000000 +0100
@@ -352,6 +352,9 @@ config NUMA
 	  Access).  This option is for configuring high-end multiprocessor
 	  server systems.  If in doubt, say N.
 
+config ARCH_POPULATES_NODE_MAP
+	def_bool y
+
 # VIRTUAL_MEM_MAP and FLAT_NODE_MEM_MAP are functionally equivalent.
 # VIRTUAL_MEM_MAP has been retained for historical reasons.
 config VIRTUAL_MEM_MAP
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/mm/contig.c linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/mm/contig.c
--- linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/mm/contig.c	2006-04-03 04:22:10.000000000 +0100
+++ linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/mm/contig.c	2006-04-11 23:56:45.000000000 +0100
@@ -26,10 +26,6 @@
 #include <asm/sections.h>
 #include <asm/mca.h>
 
-#ifdef CONFIG_VIRTUAL_MEM_MAP
-static unsigned long num_dma_physpages;
-#endif
-
 /**
  * show_mem - display a memory statistics summary
  *
@@ -212,18 +208,6 @@ count_pages (u64 start, u64 end, void *a
 	return 0;
 }
 
-#ifdef CONFIG_VIRTUAL_MEM_MAP
-static int
-count_dma_pages (u64 start, u64 end, void *arg)
-{
-	unsigned long *count = arg;
-
-	if (start < MAX_DMA_ADDRESS)
-		*count += (min(end, MAX_DMA_ADDRESS) - start) >> PAGE_SHIFT;
-	return 0;
-}
-#endif
-
 /*
  * Set up the page tables.
  */
@@ -232,47 +216,24 @@ void __init
 paging_init (void)
 {
 	unsigned long max_dma;
-	unsigned long zones_size[MAX_NR_ZONES];
 #ifdef CONFIG_VIRTUAL_MEM_MAP
-	unsigned long zholes_size[MAX_NR_ZONES];
+	unsigned long nid = 0;
 	unsigned long max_gap;
 #endif
 
-	/* initialize mem_map[] */
-
-	memset(zones_size, 0, sizeof(zones_size));
-
 	num_physpages = 0;
 	efi_memmap_walk(count_pages, &num_physpages);
 
 	max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
 
 #ifdef CONFIG_VIRTUAL_MEM_MAP
-	memset(zholes_size, 0, sizeof(zholes_size));
-
-	num_dma_physpages = 0;
-	efi_memmap_walk(count_dma_pages, &num_dma_physpages);
-
-	if (max_low_pfn < max_dma) {
-		zones_size[ZONE_DMA] = max_low_pfn;
-		zholes_size[ZONE_DMA] = max_low_pfn - num_dma_physpages;
-	} else {
-		zones_size[ZONE_DMA] = max_dma;
-		zholes_size[ZONE_DMA] = max_dma - num_dma_physpages;
-		if (num_physpages > num_dma_physpages) {
-			zones_size[ZONE_NORMAL] = max_low_pfn - max_dma;
-			zholes_size[ZONE_NORMAL] =
-				((max_low_pfn - max_dma) -
-				 (num_physpages - num_dma_physpages));
-		}
-	}
-
 	max_gap = 0;
+	efi_memmap_walk(register_active_ranges, &nid);
 	efi_memmap_walk(find_largest_hole, (u64 *)&max_gap);
 	if (max_gap < LARGE_GAP) {
 		vmem_map = (struct page *) 0;
-		free_area_init_node(0, NODE_DATA(0), zones_size, 0,
-				    zholes_size);
+		free_area_init_nodes(max_dma, max_dma,
+				max_low_pfn, max_low_pfn);
 	} else {
 		unsigned long map_size;
 
@@ -284,19 +245,14 @@ paging_init (void)
 		efi_memmap_walk(create_mem_map_page_table, NULL);
 
 		NODE_DATA(0)->node_mem_map = vmem_map;
-		free_area_init_node(0, NODE_DATA(0), zones_size,
-				    0, zholes_size);
+		free_area_init_nodes(max_dma, max_dma,
+				max_low_pfn, max_low_pfn);
 
 		printk("Virtual mem_map starts at 0x%p\n", mem_map);
 	}
 #else /* !CONFIG_VIRTUAL_MEM_MAP */
-	if (max_low_pfn < max_dma)
-		zones_size[ZONE_DMA] = max_low_pfn;
-	else {
-		zones_size[ZONE_DMA] = max_dma;
-		zones_size[ZONE_NORMAL] = max_low_pfn - max_dma;
-	}
-	free_area_init(zones_size);
+	add_active_range(0, 0, max_low_pfn);
+	free_area_init_nodes(max_dma, max_dma, max_low_pfn, max_low_pfn);
 #endif /* !CONFIG_VIRTUAL_MEM_MAP */
 	zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
 }
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/mm/discontig.c linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/mm/discontig.c
--- linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/mm/discontig.c	2006-04-03 04:22:10.000000000 +0100
+++ linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/mm/discontig.c	2006-04-11 23:54:06.000000000 +0100
@@ -87,6 +87,7 @@ static int __init build_node_maps(unsign
 
 	min_low_pfn = min(min_low_pfn, bdp->node_boot_start>>PAGE_SHIFT);
 	max_low_pfn = max(max_low_pfn, bdp->node_low_pfn);
+	add_active_range(node, start, end);
 
 	return 0;
 }
@@ -660,9 +661,8 @@ static __init int count_node_pages(unsig
 void __init paging_init(void)
 {
 	unsigned long max_dma;
-	unsigned long zones_size[MAX_NR_ZONES];
-	unsigned long zholes_size[MAX_NR_ZONES];
 	unsigned long pfn_offset = 0;
+	unsigned long max_pfn = 0;
 	int node;
 
 	max_dma = virt_to_phys((void *) MAX_DMA_ADDRESS) >> PAGE_SHIFT;
@@ -679,46 +679,17 @@ void __init paging_init(void)
 #endif
 
 	for_each_online_node(node) {
-		memset(zones_size, 0, sizeof(zones_size));
-		memset(zholes_size, 0, sizeof(zholes_size));
-
 		num_physpages += mem_data[node].num_physpages;
-
-		if (mem_data[node].min_pfn >= max_dma) {
-			/* All of this node's memory is above ZONE_DMA */
-			zones_size[ZONE_NORMAL] = mem_data[node].max_pfn -
-				mem_data[node].min_pfn;
-			zholes_size[ZONE_NORMAL] = mem_data[node].max_pfn -
-				mem_data[node].min_pfn -
-				mem_data[node].num_physpages;
-		} else if (mem_data[node].max_pfn < max_dma) {
-			/* All of this node's memory is in ZONE_DMA */
-			zones_size[ZONE_DMA] = mem_data[node].max_pfn -
-				mem_data[node].min_pfn;
-			zholes_size[ZONE_DMA] = mem_data[node].max_pfn -
-				mem_data[node].min_pfn -
-				mem_data[node].num_dma_physpages;
-		} else {
-			/* This node has memory in both zones */
-			zones_size[ZONE_DMA] = max_dma -
-				mem_data[node].min_pfn;
-			zholes_size[ZONE_DMA] = zones_size[ZONE_DMA] -
-				mem_data[node].num_dma_physpages;
-			zones_size[ZONE_NORMAL] = mem_data[node].max_pfn -
-				max_dma;
-			zholes_size[ZONE_NORMAL] = zones_size[ZONE_NORMAL] -
-				(mem_data[node].num_physpages -
-				 mem_data[node].num_dma_physpages);
-		}
-
 		pfn_offset = mem_data[node].min_pfn;
 
 #ifdef CONFIG_VIRTUAL_MEM_MAP
 		NODE_DATA(node)->node_mem_map = vmem_map + pfn_offset;
 #endif
-		free_area_init_node(node, NODE_DATA(node), zones_size,
-				    pfn_offset, zholes_size);
+		if (mem_data[node].max_pfn > max_pfn)
+			max_pfn = mem_data[node].max_pfn;
 	}
 
+	free_area_init_nodes(max_dma, max_dma, max_pfn, max_pfn);
+	
 	zero_page_memmap_ptr = virt_to_page(ia64_imva(empty_zero_page));
 }
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/mm/init.c linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/mm/init.c
--- linux-2.6.17-rc1-104-x86_64_use_init_nodes/arch/ia64/mm/init.c	2006-04-03 04:22:10.000000000 +0100
+++ linux-2.6.17-rc1-105-ia64_use_init_nodes/arch/ia64/mm/init.c	2006-04-11 23:40:15.000000000 +0100
@@ -539,6 +539,16 @@ find_largest_hole (u64 start, u64 end, v
 	last_end = end;
 	return 0;
 }
+
+int __init
+register_active_ranges(u64 start, u64 end, void *nid)
+{
+	BUG_ON(nid == NULL);
+	BUG_ON(*(unsigned long *)nid >= MAX_NUMNODES);
+
+	add_active_range(*(unsigned long *)nid, start, end);
+	return 0;
+}
 #endif /* CONFIG_VIRTUAL_MEM_MAP */
 
 static int __init
diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc1-104-x86_64_use_init_nodes/include/asm-ia64/meminit.h linux-2.6.17-rc1-105-ia64_use_init_nodes/include/asm-ia64/meminit.h
--- linux-2.6.17-rc1-104-x86_64_use_init_nodes/include/asm-ia64/meminit.h	2006-04-03 04:22:10.000000000 +0100
+++ linux-2.6.17-rc1-105-ia64_use_init_nodes/include/asm-ia64/meminit.h	2006-04-11 23:34:58.000000000 +0100
@@ -56,6 +56,7 @@ extern void efi_memmap_init(unsigned lon
   extern unsigned long vmalloc_end;
   extern struct page *vmem_map;
   extern int find_largest_hole (u64 start, u64 end, void *arg);
+  extern int register_active_ranges (u64 start, u64 end, void *arg);
   extern int create_mem_map_page_table (u64 start, u64 end, void *arg);
 #endif
 

[-- Attachment #3: 107-debug.diff --]
[-- Type: TEXT/PLAIN, Size: 3852 bytes --]

diff -rup -X /usr/src/patchset-0.5/bin//dontdiff linux-2.6.17-rc1-106-breakout_mem_init/mm/mem_init.c linux-2.6.17-rc1-107-debug/mm/mem_init.c
--- linux-2.6.17-rc1-106-breakout_mem_init/mm/mem_init.c	2006-04-11 23:49:52.000000000 +0100
+++ linux-2.6.17-rc1-107-debug/mm/mem_init.c	2006-04-11 23:52:00.000000000 +0100
@@ -645,13 +645,23 @@ void __init free_bootmem_with_active_reg
 	for_each_active_range_index_in_nid(i, nid) {
 		unsigned long size_pages = 0;
 		unsigned long end_pfn = early_node_map[i].end_pfn;
-		if (early_node_map[i].start_pfn >= max_low_pfn)
+		if (early_node_map[i].start_pfn >= max_low_pfn) {
+			printk("start_pfn %lu >= %lu\n", early_node_map[i].start_pfn,
+								max_low_pfn);
 			continue;
+		}
 
-		if (end_pfn > max_low_pfn)
+		if (end_pfn > max_low_pfn) {
+			printk("end_pfn %lu going back to %lu\n", early_node_map[i].end_pfn,
+									max_low_pfn);
 			end_pfn = max_low_pfn;
+		}
 
 		size_pages = end_pfn - early_node_map[i].start_pfn;
+		printk("free_bootmem_node(%d, %lu, %lu)\n",
+				early_node_map[i].nid,
+				PFN_PHYS(early_node_map[i].start_pfn),
+				PFN_PHYS(size_pages));
 		free_bootmem_node(NODE_DATA(early_node_map[i].nid),
 				PFN_PHYS(early_node_map[i].start_pfn),
 				PFN_PHYS(size_pages));
@@ -661,10 +671,15 @@ void __init free_bootmem_with_active_reg
 void __init memory_present_with_active_regions(int nid)
 {
 	unsigned int i;
-	for_each_active_range_index_in_nid(i, nid)
+	for_each_active_range_index_in_nid(i, nid) {
+		printk("memory_present(%d, %lu, %lu)\n",
+			early_node_map[i].nid,
+			early_node_map[i].start_pfn,
+			early_node_map[i].end_pfn);
 		memory_present(early_node_map[i].nid,
 				early_node_map[i].start_pfn,
 				early_node_map[i].end_pfn);
+	}
 }
 
 void __init get_pfn_range_for_nid(unsigned int nid,
@@ -752,8 +767,16 @@ unsigned long __init zone_absent_pages_i
 		/* Increase the hole size if the hole is within the zone */
 		start_pfn = early_node_map[i].start_pfn;
 		if (pfn_range_in_zone(prev_end_pfn, start_pfn, zone_type)) {
-			BUG_ON(prev_end_pfn > start_pfn);
+			if (prev_end_pfn > start_pfn) {
+				printk("prev_end > start_pfn : %lu > %lu\n",
+						prev_end_pfn,
+						start_pfn);
+				BUG();
+			}
+			//BUG_ON(prev_end_pfn > start_pfn);
 			hole_pages += start_pfn - prev_end_pfn;
+			printk("Hole found index %d: %lu -> %lu\n",
+					i, prev_end_pfn, start_pfn);
 		}
 
 		prev_end_pfn = early_node_map[i].end_pfn;
@@ -907,17 +930,21 @@ void __init add_active_range(unsigned in
 	unsigned int i;
 	unsigned long pages = end_pfn - start_pfn;
 
+	printk("add_active_range(%d, %lu, %lu): ",
+			nid, start_pfn, end_pfn);
 	/* Merge with existing active regions if possible */
 	for (i = 0; early_node_map[i].end_pfn; i++) {
 		if (early_node_map[i].nid != nid)
 			continue;
 
 		if (early_node_map[i].end_pfn == start_pfn) {
+			printk("Merging forward\n");
 			early_node_map[i].end_pfn += pages;
 			return;
 		}
 
 		if (early_node_map[i].start_pfn == (start_pfn + pages)) {
+			printk("Merging backwards\n");
 			early_node_map[i].start_pfn -= pages;
 			return;
 		}
@@ -933,6 +960,7 @@ void __init add_active_range(unsigned in
 		return;
 	}
 
+	printk("New\n");
 	early_node_map[i].nid = nid;
 	early_node_map[i].start_pfn = start_pfn;
 	early_node_map[i].end_pfn = end_pfn;
@@ -962,6 +990,14 @@ static void __init sort_node_map(void)
 
 	sort(early_node_map, num, sizeof(struct node_active_region),
 						cmp_node_active_region, NULL);
+
+	printk("Dumping sorted node map\n");
+	for (num = 0; early_node_map[num].end_pfn; num++) {
+		printk("entry %lu: %d  %lu -> %lu\n", num,
+				early_node_map[num].nid,
+				early_node_map[num].start_pfn,
+				early_node_map[num].end_pfn);
+	}
 }
 
 unsigned long __init find_min_pfn(void)

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox