latest discontig
Here's the latest discontig patch. It seems to be working for everybody, but could always use more testing.
Unfortunately, I haven't been able to come up with a good way to make the functions reentrant wrt the new cdata structure. Everything I come up with is much uglier than what's there, and even more obtuse, so I'd really appreciate suggestions. Personally, I'd like to see David merge this patch to make an intrusive cleanup of the memory initialization code easier :).
arch/ia64/Kconfig | 16 - arch/ia64/Makefile | 2 arch/ia64/kernel/acpi.c | 8 arch/ia64/kernel/setup.c | 167 +------------------ arch/ia64/mm/Makefile | 3 arch/ia64/mm/contig.c | 131 +++++++++++++++ arch/ia64/mm/discontig.c | 375 +++++++++++++++++++++++++------------------ arch/ia64/mm/init.c | 223 +++++++++---------------- include/asm-ia64/mmzone.h | 144 ++-------------- include/asm-ia64/nodedata.h | 39 +--- include/asm-ia64/numa.h | 16 + include/asm-ia64/page.h | 28 ++- include/asm-ia64/percpu.h | 1 include/asm-ia64/pgtable.h | 32 +++ include/asm-ia64/processor.h | 2
Thanks,
Jesse
arch/ia64/Kconfig +0 -16
@@ -217,22 +217,6 @@ Access). This option is for configuring high-end multiprocessor server systems. If in doubt, say N. -choice - prompt "Maximum Memory per NUMA Node" if NUMA && IA64_DIG - depends on NUMA && IA64_DIG - default IA64_NODESIZE_16GB - -config IA64_NODESIZE_16GB - bool "16GB" - -config IA64_NODESIZE_64GB - bool "64GB" - -config IA64_NODESIZE_256GB - bool "256GB" - -endchoice - config DISCONTIGMEM bool "Discontiguous memory support" if (IA64_DIG || IA64_SGI_SN2 || IA64_GENERIC) && NUMA default y if (IA64_SGI_SN2 || IA64_GENERIC) && NUMA
arch/ia64/Makefile +1 -1
@@ -64,7 +64,7 @@ drivers-$(CONFIG_PCI) += arch/ia64/pci/ drivers-$(CONFIG_IA64_HP_SIM) += arch/ia64/hp/sim/ drivers-$(CONFIG_IA64_HP_ZX1) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ -drivers-$(CONFIG_IA64_GENERIC) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ arch/ia64/hp/sim/ +drivers-$(CONFIG_IA64_GENERIC) += arch/ia64/hp/common/ arch/ia64/hp/zx1/ arch/ia64/hp/sim/ arch/ia64/sn/ boot := arch/ia64/hp/sim/boot
arch/ia64/kernel/acpi.c +0 -8
@@ -421,14 +421,6 @@ min_hole_size = hole_size; } -if (min_hole_size) { -if (min_hole_size > size) { -printk (KERN_ERR "Too huge memory hole. Ignoring %ld MBytes at %lx\n" , - size/(1024 *1024 ), paddr); -return ; - } - } -/* record this node in proximity bitmap */ pxm_bit_set (pxm);
arch/ia64/kernel/setup.c +10 -157
218 lines not on this page · raw message
arch/ia64/mm/Makefile +3 -0
@@ -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.o +endif
arch/ia64/mm/contig.c new file +131 -0
131 lines not on this page · raw message
arch/ia64/mm/discontig.c +219 -156
490 lines not on this page · raw message
arch/ia64/mm/init.c +86 -137
294 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
@@ -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
@@ -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 +18 -10
@@ -94,18 +94,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)) +#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 ) +extern struct page *vmem_map; +#define pfn_to_page (pfn) (vmem_map + (pfn)) +#define page_to_pfn (page) ((unsigned long) (page - vmem_map)) +#else #define pfn_to_page (pfn) (mem_map + (pfn)) -#define page_to_phys (page) (page_to_pfn(page) << PAGE_SHIFT) +#define page_to_pfn (page) ((unsigned long) (page - mem_map))#endif + +#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
@@ -46,6 +46,7 @@extern void percpu_modcopy (void *pcpudst,const void *src,unsigned long size);extern void setup_per_cpu_areas (void ); +extern void *per_cpu_init (void );#else /* ! SMP */
include/asm-ia64/pgtable.h +0 -1
@@ -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)))
@@ -415,7 +411,35 @@
}
extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
+extern unsigned long MAX_DMA_ADDRESS;
+
+/*
+ * Entries defined so far:
+ * - boot param structure itself
+ * - memory map
+ * - initrd (optional)
+ * - command line string
+ * - kernel code & data
+ *
+ * More could be added if necessary
+ */
+struct rsvd_region {
+ unsigned long start; /* virtual address of beginning of element */
+ unsigned long end; /* virtual address of end of element + 1 */
+};
+#define IA64_MAX_RSVD_REGIONS 5
+extern struct rsvd_region rsvd_region[IA64_MAX_RSVD_REGIONS + 1]; +extern int num_rsvd_regions;
extern void paging_init (void);
+extern int filter_rsvd_memory(unsigned long start, unsigned long end, void *arg); +#ifdef CONFIG_DISCONTIGMEM
+extern void discontig_mem_init(void);
+extern void call_pernode_memory(unsigned long start, unsigned long end, void *arg); +#else
+extern unsigned long bootmap_start;
+extern int find_max_pfn(unsigned long start, unsigned long end, void *arg); +extern int find_bootmap_location(unsigned long start, unsigned long end, void *arg); +#endif
/*
* Note: The macros below rely on the fact that MAX_SWAPFILES_SHIFT <= number of
include/asm-ia64/processor.h +2 -0
@@ -186,6 +186,8 @@#endif #ifdef CONFIG_NUMA struct ia64_node_data *node_data; +struct cpuinfo_ia64 *cpu_data[NR_CPUS ]; +int nodeid;#endif };
Jesse> Here's the latest discontig patch. It seems to be working Jesse> for everybody, but could always use more testing.
Jesse> Unfortunately, I haven't been able to come up with a good way Jesse> to make the functions reentrant wrt the new cdata structure. Jesse> Everything I come up with is much uglier than what's there, Jesse> and even more obtuse, so I'd really appreciate suggestions. Jesse> Personally, I'd like to see David merge this patch to make an Jesse> intrusive cleanup of the memory initialization code easier Jesse> :).
You know, you'd greatly increase the chance of my applying the patch if the patch:
- were broken up into reasonably small, self-contained pieces
- doesn't actually BREAK the existing ia64 platforms
- looks like the author(s) actually cared about they were doing
I'm sorry, but until some of these criteria are met, there is no way I'm going to apply this patch. As for the breakage: as far as I can see, the patch moves the bootmem initialization back to the old place, which means that drivers/acpi/tables.c will fail to allocate memory for the SDT again.
Some other comments:
- in acpi.c, it looks like there is no reason for min_hole_size anymore, yet the patch doesn't clean up this variable
- MAX_RSVD_REGIONS et al got moved to pgtable.h; why in the world would that be the right place? Just because "it compiled"??
- why is there both vmem_map and mem_map in the NUMA case?
--david
Quoted 4 lines · David Mosberger
You know, you'd greatly increase the chance of my applying the patch if the patch:
- were broken up into reasonably small, self-contained pieces
Um.. I can try to break it up.
Quoted 1 line
- doesn't actually BREAK the existing ia64 platforms
Does it? We've tested it on quite a few...
Quoted 5 lines
I'm sorry, but until some of these criteria are met, there is no way I'm going to apply this patch. As for the breakage: as far as I can see, the patch moves the bootmem initialization back to the old place, which means that
drivers/acpi/tables.cwill fail to allocate memory for the SDT again.
Len Brown already took the change to fix tables.c.
Quoted 4 lines
Some other comments:
- in
acpi.c, it looks like there is no reason formin_hole_sizeanymore, yet the patch doesn't clean up this variable
Ok.
Quoted 2 lines
-
MAX_RSVD_REGIONSet al got moved topgtable.h; why in the world would that be the right place? Just because "it compiled"??
I'll have to look at that again. I think I needed to move some of that stuff to a header because I created contig.c to seperate things a little.
Quoted 1 line
- why is there both
vmem_mapandmem_mapin the NUMA case?
Because it compiled :/. I'll try to fix that up too.
Thanks,
Jesse
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line · On Mon, 22 Sep 2003 13:31:15 -0700, [email protected] (Jesse Barnes) said:
I'm sorry, but until some of these criteria are met, there is no way I'm going to apply this patch. As for the breakage: as far as I can see, the patch moves the bootmem initialization back to the old place, which means that
drivers/acpi/tables.cwill fail to allocate memory for the SDT again.
Jesse> Len Brown already took the change to fix tables.c.
Perhaps I'm missing something, but I see this in Linus' tree:
Age Author Rev Comments
7 weeks len.brown 1.15 match 2.4 -- more info in RSDT, nix some build warnings
11 weeks agrover 1.14 ACPI: Dynamically allocate SDT list (suggested by Andi Kleen)
No SDT fixes are far as I can see.
--david
Quoted 10 lines · David Mosberger
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line · On Mon, 22 Sep 2003 13:31:15 -0700, [email protected] (Jesse Barnes) said:
I'm sorry, but until some of these criteria are met, there is no way I'm going to apply this patch. As for the breakage: as far as I can see, the patch moves the bootmem initialization back to the old place, which means that
drivers/acpi/tables.cwill fail to allocate memory for the SDT again.Jesse> Len Brown already took the change to fix
tables.c.
Quoted 7 lines
Perhaps I'm missing something, but I see this in Linus' tree:
Age Author Rev Comments
7 weeks len.brown 1.15 match 2.4 -- more info in RSDT, nix some build warnings
11 weeks agrover 1.14 ACPI: Dynamically allocate SDT list (suggested by Andi Kleen)No SDT fixes are far as I can see.
See
http://linux-acpi.bkbits.net:8080/linux-acpi-test-2.6.0/[email protected]?nav=index.html|ChangeSet@-4d.
It'll be part of Len's next push. Sorry I should have kept that in the patch so as not to confuse people. I've been working hard to get all of the non-ia64 specific code out into Linus' tree already, including some bootmem allocator fixes and such, this one just took a little longer because Andy stepped down as maintainer at around the same time I sent my (trivial) patch out to fix this.
Btw, which piece(s) of the patch would you like first? Is seperating the contig and discontig functions into seperate files worthwhile? I can comment things a bit more too while I'm at it...
Thanks,
Jesse
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line · On Mon, 22 Sep 2003 14:04:46 -0700, [email protected] (Jesse Barnes) said:
Jesse> See
Jesse> http://linux-acpi.bkbits.net:8080/linux-acpi-test-2.6.0/[email protected]?nav=index.html|ChangeSet@-4d.
Jesse> It'll be part of Len's next push.
Please hold back that patch until Len pushes his changes. I really don't want to break things that are already working.
Jesse> Sorry I should have kept that in the patch so as not to Jesse> confuse people. I've been working hard to get all of the Jesse> non-ia64 specific code out into Linus' tree already, Jesse> including some bootmem allocator fixes and such, this one Jesse> just took a little longer because Andy stepped down as Jesse> maintainer at around the same time I sent my (trivial) patch Jesse> out to fix this.
OK.
Jesse> Btw, which piece(s) of the patch would you like first? Is Jesse> seperating the contig and discontig functions into seperate Jesse> files worthwhile? I can comment things a bit more too while Jesse> I'm at it...
Sure, that sounds good.
--david