Skip to contentSkip to conversation

more discontig fun

PATCH In review Jesse Barnes 3 participants 11 messages Jul 28, 2003 – Sep 8, 2003 EFI

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 more discontig fun

o fixed a bug with per-cpu init
o tried to abstract out per-cpu init a bit more
o fixed some warnings

Please try this one out. You'll need the bootmem patch I posted earlier as well as the Kconfig stuff, but it should work on non-sn2 platforms (I hope).

Thanks,
Jesse

arch/ia64/kernel/setup.c +39 -28
diff -Nru a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
@@ -138,7 +138,7 @@
 call_pernode_memory (unsigned long start, unsigned long end, void *arg)
 {
 	unsigned long rs, re;
-	void (*func)(unsigned long, unsigned long, int, int);
+	void (*func)(unsigned long, unsigned long, int);
 	int i;
 
 	start = PAGE_ALIGN(start);
@@ -149,22 +149,21 @@
 	func = arg;
 
 	if (!num_memblks) {
-		/*
-		 * This machine doesn't have SRAT, so call func with
-		 * nid=0, bank=0.
-		 */
+		/* No SRAT table, to assume one node (node 0) */
 		if (start < end)
-			(*func)(start, end - start, 0, 0);
+			(*func)(start, end, 0);
 		return;
 	}
 
 	for (i = 0; i < num_memblks; i++) {
-		rs = max(start, node_memblk[i].start_paddr);
-		re = min(end, node_memblk[i].start_paddr+node_memblk[i].size);
+		rs = max(__pa(start), node_memblk[i].start_paddr);
+		re = min(__pa(end), node_memblk[i].start_paddr+node_memblk[i].size);
 
 		if (rs < re)
-			(*func)(rs, re-rs, node_memblk[i].nid,
-				node_memblk[i].bank);
+			(*func)((unsigned long)__va(rs), (unsigned long)__va(re), node_memblk[i].nid);
+
+		if ((unsigned long)__va(re) = end)
+			break;
 	}
 }
 
@@ -180,7 +179,7 @@
 filter_rsvd_memory (unsigned long start, unsigned long end, void *arg)
 {
 	unsigned long range_start, range_end, prev_start;
-	void (*func)(unsigned long, unsigned long);
+	void (*func)(unsigned long, unsigned long, int);
 	int i;
 
 #if IGNORE_PFN0
@@ -202,9 +201,9 @@
 
 		if (range_start < range_end)
 #ifdef CONFIG_DISCONTIGMEM
-			call_pernode_memory(__pa(range_start), __pa(range_end), func);
+			call_pernode_memory(range_start, range_end, func);
 #else
-			(*func)(__pa(range_start), range_end - range_start);
+			(*func)(range_start, range_end, 0);
 #endif
 
 		/* nothing more available in this segment */
@@ -680,21 +679,11 @@
 		ia64_max_cacheline_size = max;
 }
 
-/*
- * cpu_init() initializes state that is per-CPU.  This function acts
- * as a 'CPU state barrier', nothing should get across.
- */
-void
-cpu_init (void)
+#ifndef CONFIG_DISCONTIGMEM
+static void *per_cpu_init(void)
 {
 	extern char __per_cpu_start[], __phys_per_cpu_start[];
-	extern void __init ia64_mmu_init (void *);
-	unsigned long num_phys_stacked;
-	pal_vm_info_2_u_t vmi;
-	unsigned int max_ctx;
-	struct cpuinfo_ia64 *cpu_info;
 	void *cpu_data;
-
 #ifdef CONFIG_SMP
 	extern char __per_cpu_end[];
 	int cpu;
@@ -703,6 +692,8 @@
 	 * get_free_pages() cannot be used before cpu_init() done.  BSP allocates
 	 * "NR_CPUS" pages for all CPUs to avoid that AP calls get_zeroed_page().
 	 */
+
+	/* for discontig machines, we do this in discontig.c */
 	if (smp_processor_id() = 0) {
 		cpu_data = __alloc_bootmem(PERCPU_PAGE_SIZE * NR_CPUS, PERCPU_PAGE_SIZE,
 					   __pa(MAX_DMA_ADDRESS));
@@ -710,14 +701,34 @@
 			memcpy(cpu_data, __phys_per_cpu_start, __per_cpu_end - __per_cpu_start);
 			__per_cpu_offset[cpu] = (char *) cpu_data - __per_cpu_start;
 			cpu_data += PERCPU_PAGE_SIZE;
-
 			per_cpu(local_per_cpu_offset, cpu) = __per_cpu_offset[cpu];
 		}
 	}
-	cpu_data = __per_cpu_start + __per_cpu_offset[smp_processor_id()];
+	return __per_cpu_start + __per_cpu_offset[smp_processor_id()];
 #else /* !CONFIG_SMP */
-	cpu_data = __phys_per_cpu_start;
+	return __phys_per_cpu_start;
 #endif /* !CONFIG_SMP */
+}
+#else
+extern void *per_cpu_init(void);
+#endif /* !CONFIG_DISCONTIGMEM */
+
+/*
+ * cpu_init() initializes state that is per-CPU.  This function acts
+ * as a 'CPU state barrier', nothing should get across.
+ */
+void
+cpu_init (void)
+{
+	extern char __per_cpu_start[];
+	extern void __init ia64_mmu_init (void *);
+	unsigned long num_phys_stacked;
+	pal_vm_info_2_u_t vmi;
+	unsigned int max_ctx;
+	struct cpuinfo_ia64 *cpu_info;
+	void *cpu_data;
+
+	cpu_data = per_cpu_init();
 
 	get_max_cacheline_size();
 
arch/ia64/mm/discontig.c +143 -160

414 lines not on this page · raw message

arch/ia64/mm/init.c +85 -86

248 lines not on this page · raw message

include/asm-ia64/mmzone.h +22 -122

179 lines not on this page · raw message

include/asm-ia64/nodedata.h +9 -30
diff -Nru a/include/asm-ia64/nodedata.h b/include/asm-ia64/nodedata.h
@@ -13,7 +13,7 @@
 #ifndef _ASM_IA64_NODEDATA_H
 #define _ASM_IA64_NODEDATA_H
 
-
+#include <asm/percpu.h>
 #include <asm/mmzone.h>
 
 /*
@@ -22,15 +22,17 @@
 
 struct pglist_data;
 struct ia64_node_data {
-	short			active_cpu_count;
 	short			node;
+	short			active_cpu_count;
+	/*
+	 * The fields are read-only (after boot). They contain pointers
+	 * to various structures located on other nodes. Ths data is
+	 * replicated on each node in order to reduce off-node references.
+	 */
         struct pglist_data	*pg_data_ptrs[NR_NODES];
-	struct page		*bank_mem_map_base[NR_BANKS];
 	struct ia64_node_data	*node_data_ptrs[NR_NODES];
-	short			node_id_map[NR_BANKS];
 };
 
-
 /*
  * Return a pointer to the node_data structure for the executing cpu.
  */
@@ -40,7 +42,8 @@
 /*
  * Return a pointer to the node_data structure for the specified node.
  */
-#define node_data(node)	(local_node_data->node_data_ptrs[node])
+#define node_data(node) (local_node_data->node_data_ptrs[node])
+#define NODE_DATA(nid) (local_node_data->pg_data_ptrs[nid])
 
 /*
  * Get a pointer to the node_id/node_data for the current cpu.
@@ -48,29 +51,5 @@
  */
 extern int boot_get_local_nodeid(void);
 extern struct ia64_node_data *get_node_data_ptr(void);
-
-/*
- * Given a node id, return a pointer to the pg_data_t for the node.
- * The following 2 macros are similar. 
- *
- * NODE_DATA 	- should be used in all code not related to system
- *		  initialization. It uses pernode data structures to minimize
- *		  offnode memory references. However, these structure are not 
- *		  present during boot. This macro can be used once cpu_init
- *		  completes.
- *
- * BOOT_NODE_DATA
- *		- should be used during system initialization 
- *		  prior to freeing __initdata. It does not depend on the percpu
- *		  area being present.
- *
- * NOTE:   The names of these macros are misleading but are difficult to change
- *	   since they are used in generic linux & on other architecures.
- */
-#define NODE_DATA(nid)		(local_node_data->pg_data_ptrs[nid])
-#define BOOT_NODE_DATA(nid)	boot_get_pg_data_ptr((long)(nid))
-
-struct pglist_data;
-extern struct pglist_data * __init boot_get_pg_data_ptr(long);
 
 #endif /* _ASM_IA64_NODEDATA_H */
include/asm-ia64/numa.h +15 -1
diff -Nru a/include/asm-ia64/numa.h b/include/asm-ia64/numa.h
@@ -15,13 +15,21 @@
 
 #ifdef CONFIG_DISCONTIGMEM
 # include <asm/mmzone.h>
-# define NR_MEMBLKS   (NR_BANKS)
 #else
 # define NR_NODES     (8)
 # define NR_MEMBLKS   (NR_NODES * 8)
 #endif
 
 #include <linux/cache.h>
+#include <linux/threads.h>
+#include <linux/smp.h>
+
+#define NODEMASK_WORDCOUNT       ((NR_NODES+(BITS_PER_LONG-1))/BITS_PER_LONG)
+
+#define NODE_MASK_NONE   { [0 ... ((NR_NODES+BITS_PER_LONG-1)/BITS_PER_LONG)-1] = 0 }
+
+typedef unsigned long   nodemask_t[NODEMASK_WORDCOUNT];
+                                                                                                                             
 extern volatile char cpu_to_node_map[NR_CPUS] __cacheline_aligned;
 extern volatile unsigned long node_to_cpu_mask[NR_NODES] __cacheline_aligned;
 
@@ -63,6 +71,12 @@
 extern int paddr_to_nid(unsigned long paddr);
 
 #define local_nodeid (cpu_to_node_map[smp_processor_id()])
+
+#else /* !CONFIG_NUMA */
+
+#define node_distance(from,to) 10
+#define paddr_to_nid(x) 0
+#define local_nodeid 0
 
 #endif /* CONFIG_NUMA */
 
include/asm-ia64/page.h +19 -11
diff -Nru a/include/asm-ia64/page.h b/include/asm-ia64/page.h
@@ -93,18 +93,26 @@
 
 #define virt_addr_valid(kaddr)	pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
 
-#ifndef CONFIG_DISCONTIGMEM
-# ifdef CONFIG_VIRTUAL_MEM_MAP
-   extern int ia64_pfn_valid (unsigned long pfn);
-#  define pfn_valid(pfn)	(((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
-# else
-#  define pfn_valid(pfn)	((pfn) < max_mapnr)
-# endif
-#define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
-#define page_to_pfn(page)	((unsigned long) (page - mem_map))
-#define pfn_to_page(pfn)	(mem_map + (pfn))
-#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
+#ifdef CONFIG_VIRTUAL_MEM_MAP
+extern int ia64_pfn_valid(unsigned long pfn);
+#else
+#define ia64_pfn_valid(pfn) (1)
+#endif
+
+extern unsigned long max_low_pfn;
+#define pfn_valid(pfn) (((pfn) < max_low_pfn) && ia64_pfn_valid(pfn))
+
+#if defined(CONFIG_VIRTUAL_MEM_MAP) && !defined(CONFIG_DISCONTIGMEM)
+#define vmem_map mem_map
+#else
+extern struct page *vmem_map;
 #endif
+
+#define pfn_to_page(pfn)	(vmem_map + (pfn))
+#define page_to_pfn(page)	((unsigned long) (page - vmem_map))
+
+#define virt_to_page(kaddr)	(pfn_to_page(__pa(kaddr) >> PAGE_SHIFT))
+#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
 
 typedef union ia64_va {
 	struct {
include/asm-ia64/pgtable.h +0 -1
diff -Nru a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
@@ -174,7 +174,6 @@
 	return (addr & (local_cpu_data->unimpl_pa_mask)) = 0;
 }
 
-#ifndef CONFIG_DISCONTIGMEM
 /*
  * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel
  * memory.  For the return value to be meaningful, ADDR must be >@@ -190,7 +189,6 @@

*/
#define kern_addr_valid(addr) (1)

-#endif

/*
* Now come the defines and routines to manage and access the three-level
@@ -241,10 +239,8 @@
#define pte_none(pte) (!pte_val(pte))
#define pte_present(pte) (pte_val(pte) & (_PAGE_P | _PAGE_PROTNONE))
#define pte_clear(pte) (pte_val(*(pte)) = 0UL)
-#ifndef CONFIG_DISCONTIGMEM
/* pte_page() returns the "struct page *" corresponding to the PTE: */
#define pte_page(pte) virt_to_page(((pte_val(pte) & _PFN_MASK) + PAGE_OFFSET))
-#endif

#define pmd_none(pmd) (!pmd_val(pmd))
#define pmd_bad(pmd) (!ia64_phys_addr_valid(pmd_val(pmd)))
@@ -416,6 +412,7 @@

extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
extern void paging_init (void);
+extern int filter_rsvd_memory(unsigned long start, unsigned long end, void *arg);

/*
* Note: The macros below rely on the fact that MAX_SWAPFILES_SHIFT <= number of

include/asm-ia64/processor.h +2 -0
diff -Nru a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
@@ -185,6 +185,8 @@
 #endif
 #ifdef CONFIG_NUMA
 	struct ia64_node_data *node_data;
+	struct cpuinfo_ia64 *cpu_data[NR_CPUS];
+	int nodeid;
 #endif
 };
 
#1 lore raw
Quoted 9 lines · David Mosberger

Hi Jesse,

Two quick comments:

arch/ia64/kernel/setup.c +2 -0
+
+	/* for discontig machines, we do this in discontig.c */
 	if (smp_processor_id() = 0) {
 		cpu_data = __alloc_bootmem(PERCPU_PAGE_SIZE * NR_CPUS, PERCPU_PAGE_SIZE,
Quoted 6 lines

This comment seems out of place. Isn't it trying to say that all of per_cpu_init() is done in discontig.c for NUMA? If so the comment should be in front of the #ifdef around CONFIG_DISCONTIGMEM. Also, I'm wondering whether we shouldn't split off the contig-mem case into a separate file. I don't like those #ifdef CONFIG_DISCONTIGMEM. It would be better to control that via the Makefile.

A quick grep shows quite a few #ifndef CONFIG_DISCONTIGMEMs, I'll see if I can clean some stuff up and put it into contig.c.

Quoted 10 lines

On to this one:

arch/ia64/mm/init.c +7 -0
+struct memmap_count_callback_data {
+	int node;
+	unsigned long num_physpages;
+	unsigned long num_dma_physpages;
+	unsigned long min_pfn;
+	unsigned long max_pfn;
+} cdata;
Quoted 5 lines

I don't like non-reentrant code. Can't you allocate the variable on the stack and pass a pointer to it via the callback interface? Yes, we may not be needing re-entrancy right now, but I just think it's bad design to have non-reentrant code (unless there are good reasons for it).

Ok, I'll fix this too. Thanks for looking at it.

Jesse

#2 lore raw
In reply to Jesse Barnes
Quoted 1 line · Jesse Barnes

Ok, I'll fix this too. Thanks for looking at it.

Does this look better? I'm sure there's more cleanup to do (and I'm not sure about how to do the Makefile thing for !CONFIG_DISCONTIGMEM), but it Works For Me (tm).

Thanks,
Jesse

arch/ia64/kernel/efi.c +3 -3
diff -Nru a/arch/ia64/kernel/efi.c b/arch/ia64/kernel/efi.c
@@ -290,7 +290,7 @@
  * has memory that is available for OS use.
  */
 void
-efi_memmap_walk (efi_freemem_callback_t callback, void *arg)
+efi_memmap_walk (efi_freemem_callback_t callback, void *arg, void *arg2)
 {
 	int prev_valid = 0;
 	struct range {
@@ -373,7 +373,7 @@
 				} else {
 					start = PAGE_ALIGN(prev.start);
 					end = prev.end & PAGE_MASK;
-					if ((end > start) && (*callback)(start, end, arg) < 0)
+					if ((end > start) && (*callback)(start, end, arg, arg2) < 0)
 						return;
 					prev = curr;
 				}
@@ -384,7 +384,7 @@
 		start = PAGE_ALIGN(prev.start);
 		end = prev.end & PAGE_MASK;
 		if (end > start)
-			(*callback)(start, end, arg);
+			(*callback)(start, end, arg, arg2);
 	}
 }
 
arch/ia64/kernel/setup.c +20 -41

133 lines not on this page · raw message

arch/ia64/mm/Makefile +3 -0
diff -Nru a/arch/ia64/mm/Makefile b/arch/ia64/mm/Makefile
@@ -7,3 +7,6 @@
 obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
 obj-$(CONFIG_NUMA)	   += numa.o
 obj-$(CONFIG_DISCONTIGMEM) += discontig.o
+ifndef CONFIG_DISCONTIGMEM
+obj-y += contig.c
+endif
arch/ia64/mm/contig.c new file +73 -0

73 lines not on this page · raw message

arch/ia64/mm/discontig.c +182 -160

453 lines not on this page · raw message

arch/ia64/mm/init.c +91 -143

329 lines not on this page · raw message

include/asm-ia64/mmzone.h +22 -122

179 lines not on this page · raw message

include/asm-ia64/nodedata.h +9 -30
diff -Nru a/include/asm-ia64/nodedata.h b/include/asm-ia64/nodedata.h
@@ -13,7 +13,7 @@
 #ifndef _ASM_IA64_NODEDATA_H
 #define _ASM_IA64_NODEDATA_H
 
-
+#include <asm/percpu.h>
 #include <asm/mmzone.h>
 
 /*
@@ -22,15 +22,17 @@
 
 struct pglist_data;
 struct ia64_node_data {
-	short			active_cpu_count;
 	short			node;
+	short			active_cpu_count;
+	/*
+	 * The fields are read-only (after boot). They contain pointers
+	 * to various structures located on other nodes. Ths data is
+	 * replicated on each node in order to reduce off-node references.
+	 */
         struct pglist_data	*pg_data_ptrs[NR_NODES];
-	struct page		*bank_mem_map_base[NR_BANKS];
 	struct ia64_node_data	*node_data_ptrs[NR_NODES];
-	short			node_id_map[NR_BANKS];
 };
 
-
 /*
  * Return a pointer to the node_data structure for the executing cpu.
  */
@@ -40,7 +42,8 @@
 /*
  * Return a pointer to the node_data structure for the specified node.
  */
-#define node_data(node)	(local_node_data->node_data_ptrs[node])
+#define node_data(node) (local_node_data->node_data_ptrs[node])
+#define NODE_DATA(nid) (local_node_data->pg_data_ptrs[nid])
 
 /*
  * Get a pointer to the node_id/node_data for the current cpu.
@@ -48,29 +51,5 @@
  */
 extern int boot_get_local_nodeid(void);
 extern struct ia64_node_data *get_node_data_ptr(void);
-
-/*
- * Given a node id, return a pointer to the pg_data_t for the node.
- * The following 2 macros are similar. 
- *
- * NODE_DATA 	- should be used in all code not related to system
- *		  initialization. It uses pernode data structures to minimize
- *		  offnode memory references. However, these structure are not 
- *		  present during boot. This macro can be used once cpu_init
- *		  completes.
- *
- * BOOT_NODE_DATA
- *		- should be used during system initialization 
- *		  prior to freeing __initdata. It does not depend on the percpu
- *		  area being present.
- *
- * NOTE:   The names of these macros are misleading but are difficult to change
- *	   since they are used in generic linux & on other architecures.
- */
-#define NODE_DATA(nid)		(local_node_data->pg_data_ptrs[nid])
-#define BOOT_NODE_DATA(nid)	boot_get_pg_data_ptr((long)(nid))
-
-struct pglist_data;
-extern struct pglist_data * __init boot_get_pg_data_ptr(long);
 
 #endif /* _ASM_IA64_NODEDATA_H */
include/asm-ia64/numa.h +16 -1
diff -Nru a/include/asm-ia64/numa.h b/include/asm-ia64/numa.h
@@ -15,15 +15,24 @@
 
 #ifdef CONFIG_DISCONTIGMEM
 # include <asm/mmzone.h>
-# define NR_MEMBLKS   (NR_BANKS)
 #else
 # define NR_NODES     (8)
 # define NR_MEMBLKS   (NR_NODES * 8)
 #endif
 
 #include <linux/cache.h>
+#include <linux/threads.h>
+#include <linux/smp.h>
+
+#define NODEMASK_WORDCOUNT       ((NR_NODES+(BITS_PER_LONG-1))/BITS_PER_LONG)
+
+#define NODE_MASK_NONE   { [0 ... ((NR_NODES+BITS_PER_LONG-1)/BITS_PER_LONG)-1] = 0 }
+
+typedef unsigned long   nodemask_t[NODEMASK_WORDCOUNT];
+                                                                                                                             
 extern volatile char cpu_to_node_map[NR_CPUS] __cacheline_aligned;
 extern volatile unsigned long node_to_cpu_mask[NR_NODES] __cacheline_aligned;
+extern volatile nodemask_t node_has_active_cpus __cacheline_aligned;
 
 /* Stuff below this line could be architecture independent */
 
@@ -63,6 +72,12 @@
 extern int paddr_to_nid(unsigned long paddr);
 
 #define local_nodeid (cpu_to_node_map[smp_processor_id()])
+
+#else /* !CONFIG_NUMA */
+
+#define node_distance(from,to) 10
+#define paddr_to_nid(x) 0
+#define local_nodeid 0
 
 #endif /* CONFIG_NUMA */
 
include/asm-ia64/page.h +19 -11
diff -Nru a/include/asm-ia64/page.h b/include/asm-ia64/page.h
@@ -93,18 +93,26 @@
 
 #define virt_addr_valid(kaddr)	pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
 
-#ifndef CONFIG_DISCONTIGMEM
-# ifdef CONFIG_VIRTUAL_MEM_MAP
-   extern int ia64_pfn_valid (unsigned long pfn);
-#  define pfn_valid(pfn)	(((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
-# else
-#  define pfn_valid(pfn)	((pfn) < max_mapnr)
-# endif
-#define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
-#define page_to_pfn(page)	((unsigned long) (page - mem_map))
-#define pfn_to_page(pfn)	(mem_map + (pfn))
-#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
+#ifdef CONFIG_VIRTUAL_MEM_MAP
+extern int ia64_pfn_valid(unsigned long pfn);
+#else
+#define ia64_pfn_valid(pfn) (1)
+#endif
+
+extern unsigned long max_low_pfn;
+#define pfn_valid(pfn) (((pfn) < max_low_pfn) && ia64_pfn_valid(pfn))
+
+#if defined(CONFIG_VIRTUAL_MEM_MAP) && !defined(CONFIG_DISCONTIGMEM)
+#define vmem_map mem_map
+#else
+extern struct page *vmem_map;
 #endif
+
+#define pfn_to_page(pfn)	(vmem_map + (pfn))
+#define page_to_pfn(page)	((unsigned long) (page - vmem_map))
+
+#define virt_to_page(kaddr)	(pfn_to_page(__pa(kaddr) >> PAGE_SHIFT))
+#define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
 
 typedef union ia64_va {
 	struct {
include/asm-ia64/percpu.h +1 -0
diff -Nru a/include/asm-ia64/percpu.h b/include/asm-ia64/percpu.h
@@ -59,6 +59,7 @@
 /* ia64-specific part: */
 
 extern void setup_per_cpu_areas (void);
+extern void *per_cpu_init(void);
 
 /*
  * Be extremely careful when taking the address of this variable!  Due to virtual
include/asm-ia64/pgtable.h +0 -1
diff -Nru a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
@@ -174,7 +174,6 @@
 	return (addr & (local_cpu_data->unimpl_pa_mask)) = 0;
 }
 
-#ifndef CONFIG_DISCONTIGMEM
 /*
  * kern_addr_valid(ADDR) tests if ADDR is pointing to valid kernel
  * memory.  For the return value to be meaningful, ADDR must be >@@ -190,7 +189,6 @@

*/
#define kern_addr_valid(addr) (1)

-#endif

/*
* Now come the defines and routines to manage and access the three-level
@@ -241,10 +239,8 @@
#define pte_none(pte) (!pte_val(pte))
#define pte_present(pte) (pte_val(pte) & (_PAGE_P | _PAGE_PROTNONE))
#define pte_clear(pte) (pte_val(*(pte)) = 0UL)
-#ifndef CONFIG_DISCONTIGMEM
/* pte_page() returns the "struct page *" corresponding to the PTE: */
#define pte_page(pte) virt_to_page(((pte_val(pte) & _PFN_MASK) + PAGE_OFFSET))
-#endif

#define pmd_none(pmd) (!pmd_val(pmd))
#define pmd_bad(pmd) (!ia64_phys_addr_valid(pmd_val(pmd)))
@@ -416,6 +412,7 @@

extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
extern void paging_init (void);
+extern int filter_rsvd_memory(unsigned long start, unsigned long end, void *arg, void *arg2);

/*
* Note: The macros below rely on the fact that MAX_SWAPFILES_SHIFT <= number of

include/asm-ia64/processor.h +2 -0
diff -Nru a/include/asm-ia64/processor.h b/include/asm-ia64/processor.h
@@ -185,6 +185,8 @@
 #endif
 #ifdef CONFIG_NUMA
 	struct ia64_node_data *node_data;
+	struct cpuinfo_ia64 *cpu_data[NR_CPUS];
+	int nodeid;
 #endif
 };
 
include/linux/efi.h +2 -2
diff -Nru a/include/linux/efi.h b/include/linux/efi.h
@@ -98,7 +98,7 @@
 	u64 attribute;
 } efi_memory_desc_t;
 
-typedef int efi_freemem_callback_t (u64 start, u64 end, void *arg);
+typedef int efi_freemem_callback_t (u64 start, u64 end, void *arg, void *arg2);
 
 /*
  * Types and defines for Time Services
@@ -259,7 +259,7 @@
 
 extern void efi_init (void);
 extern void efi_map_pal_code (void);
-extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg);
+extern void efi_memmap_walk (efi_freemem_callback_t callback, void *arg, void *arg2);
 extern void efi_gettimeofday (struct timespec *ts);
 extern void efi_enter_virtual_mode (void);	/* switch EFI to virtual mode, if possible */
 extern u64 efi_get_iobase (void);
#3 lore raw
In reply to Jesse Barnes

arch/ia64/mm/Makefile

Quoted 12 lines · On Wed, 30 Jul 2003 16:32:03 -0700, [email protected] (Jesse Barnes) wrote:

Does this look better? I'm sure there's more cleanup to do (and I'm not sure about how to do the Makefile thing for !CONFIG_DISCONTIGMEM), but it Works For Me (tm).

arch/ia64/mm/Makefile +0 -0
@@ -7,3 +7,6 @@

obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
obj-$(CONFIG_NUMA) += numa.o
obj-$(CONFIG_DISCONTIGMEM) += discontig.o

arch/ia64/mm/Makefile +3 -0
+ifndef CONFIG_DISCONTIGMEM
+obj-y += contig.c
+endif

# Include contig.c if CONFIG_DISCONTIGMEM is n or undefined obj-$(subst $(CONFIG_DISCONTIGMEM),n,,)y += contig.c

#4 lore raw
In reply to Jesse Barnes

Thanks. Fixed now.

Jesse

Quoted 23 lines · Keith Owens

arch/ia64/mm/Makefile

Quoted 12 lines · On Wed, 30 Jul 2003 16:32:03 -0700, [email protected] (Jesse Barnes) wrote:

Does this look better? I'm sure there's more cleanup to do (and I'm not sure about how to do the Makefile thing for !CONFIG_DISCONTIGMEM), but it Works For Me (tm).

arch/ia64/mm/Makefile +0 -0
@@ -7,3 +7,6 @@

obj-$(CONFIG_HUGETLB_PAGE) += hugetlbpage.o
obj-$(CONFIG_NUMA) += numa.o
obj-$(CONFIG_DISCONTIGMEM) += discontig.o

arch/ia64/mm/Makefile +3 -0
+ifndef CONFIG_DISCONTIGMEM
+obj-y += contig.c
+endif

# Include contig.c if CONFIG_DISCONTIGMEM is n or undefined obj-$(subst $(CONFIG_DISCONTIGMEM),n,,)y += contig.c

-
To unsubscribe from this list: send the line "unsubscribe linux-ia64" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#5 lore raw
In reply to Jesse Barnes
Quoted 1 line · Jesse Barnes
Quoted 1 line

Ok, I'll fix this too. Thanks for looking at it.

Jesse> Does this look better?

Not really.

Jesse> -efi_memmap_walk (efi_freemem_callback_t callback, void *arg) Jesse> +efi_memmap_walk (efi_freemem_callback_t callback, void *arg, void *arg2)

Why is this necessary? Why not just pack that extra argument into a structure and pass the whole thing to "arg"?

	--david
#6 lore raw
In reply to Jesse Barnes
Quoted 12 lines · jbarnes
Quoted 11 lines · David Mosberger
Quoted 1 line · Jesse Barnes
Quoted 1 line

Ok, I'll fix this too. Thanks for looking at it.

Jesse> Does this look better?

Not really.

Jesse> -efi_memmap_walk (efi_freemem_callback_t callback, void *arg) Jesse> +efi_memmap_walk (efi_freemem_callback_t callback, void *arg, void *arg2)

Quoted 6 lines
Quoted 2 lines

Why is this necessary? Why not just pack that extra argument into a structure and pass the whole thing to "arg"?

Duh. But now that I've gone through the exercise, it seems like the whole callback mechanism is a bit heavyweight (not to mention quite obtuse). But I guess that's another patch...

Now that I look at this, I'm not quite sure what you'd like. Would you like all efi_memmap_walk calls to take a struct args with a function pointer and argument or just filter_rsvd_memory? Or would you like to see it cleaned up in some other way?

Thanks,
Jesse

#7 lore raw
In reply to Jesse Barnes
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · On Thu, 31 Jul 2003 13:28:57 -0700, [email protected] (Jesse Barnes) said:

Jesse> Or would you like to see it cleaned up in some other way?

I'd like to see it done without changing the interface to efi_memmap_walk().

	--david
#8 lore raw
In reply to Jesse Barnes
Quoted 6 lines · David Mosberger
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · On Thu, 31 Jul 2003 13:28:57 -0700, [email protected] (Jesse Barnes) said:

Jesse> Or would you like to see it cleaned up in some other way?

I'd like to see it done without changing the interface to efi_memmap_walk().

Ok, any chance you can push your latest stuff out to bkbits.net (preferably with the two sn2 updates I recently sent) so that I can fix it up and rediff?

Thanks,
Jesse

#9 lore raw
In reply to Jesse Barnes
Quoted 6 lines · David Mosberger
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · On Thu, 31 Jul 2003 13:28:57 -0700, [email protected] (Jesse Barnes) said:

Jesse> Or would you like to see it cleaned up in some other way?

I'd like to see it done without changing the interface to efi_memmap_walk().

Rather than calling efi_memmap_walk(filter_rsvd_memory, ...), do you think it would be ok to move the call into the leaf functions? E.g. count_pages would do a if(rsvd_memory(start, end)) return; instead of getting called from filter_rsvd_memory()? That would make it easier to understand and also make it easier to pass the args around.

But maybe a more aggressive cleanup is called for?

Thanks,
Jesse

#10 lore raw
In reply to Jesse Barnes
Quoted 8 lines · Jesse Barnes
Quoted 6 lines · David Mosberger
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · On Thu, 31 Jul 2003 13:28:57 -0700, [email protected] (Jesse Barnes) said:

Jesse> Or would you like to see it cleaned up in some other way?

I'd like to see it done without changing the interface to efi_memmap_walk().

Quoted 7 lines

Rather than calling efi_memmap_walk(filter_rsvd_memory, ...), do you think it would be ok to move the call into the leaf functions? E.g. count_pages would do a if(rsvd_memory(start, end)) return; instead of getting called from filter_rsvd_memory()? That would make it easier to understand and also make it easier to pass the args around.

But maybe a more aggressive cleanup is called for?

Ugg, it looks like that's not possible since e.g. free_bootmem() gets called by filter_rsvd_memory.

Jesse