Skip to contentSkip to conversation

clean up contig/discontig/virt_mem_map macros

PATCH In review Tony Luck 4 participants 4 messages Sep 27, 2004 – Sep 28, 2004

lore
Share & tools
lore

Tony Luck

author
#0 lore raw

PATCH 1/1 clean up contig/discontig/virt_mem_map macros

I got this patch from Zou Nan hai to resolve the problem that Andrew Morton has been having booting his ia64 system. The code is quite a bit cleaner as he has reduced the number of different definitions of pfn_valid/page_to_pfn/pfn_to_page, and left the only remaining ones next to each other in page.h ... so this should be easier to maintain going forward.

It has been tested on a variety of systems:

1G Tiger \ Tested by Zou Nan hai, I assume DIG=y, NUMA=n 8G Tiger / but I don't know for sure.
4G Tiger with generic_defconfig
4G Tiger with DIG kernel, NUMA, DISCONTIG and VIRTUAL_MEM_MAP on 4G Tiger with DIG kernel, NUMA/DISCONTIG off; VIRTUAL_MEM_MAP on HP zx2000 with zx1_defconfig

Can someone please check it on sn2 (sn2_defconfig compiles, but I haven't booted it) ... and any other systems or configurations that don't match any of the above. I'd like to stop carrying the BPB that Andrew gave me.

-Tony

arch/ia64/mm/contig.c +1 -3
diff -Nraup a/arch/ia64/mm/contig.c b/arch/ia64/mm/contig.c
@@ -269,7 +269,6 @@ paging_init (void)
 		vmem_map = (struct page *) 0;
 		free_area_init_node(0, &contig_page_data, zones_size, 0,
 				    zholes_size);
-		mem_map = contig_page_data.node_mem_map;
 	} else {
 		unsigned long map_size;
 
@@ -280,11 +279,10 @@ paging_init (void)
 		vmem_map = (struct page *) vmalloc_end;
 		efi_memmap_walk(create_mem_map_page_table, 0);
 
-		contig_page_data.node_mem_map = vmem_map;
+		mem_map = contig_page_data.node_mem_map = vmem_map;
 		free_area_init_node(0, &contig_page_data, zones_size,
 				    0, zholes_size);
 
-		mem_map = contig_page_data.node_mem_map;
 		printk("Virtual mem_map starts at 0x%p\n", mem_map);
 	}
 #else /* !CONFIG_VIRTUAL_MEM_MAP */
include/asm-ia64/mmzone.h +0 -6
diff -Nraup a/include/asm-ia64/mmzone.h b/include/asm-ia64/mmzone.h
@@ -27,12 +27,6 @@
 # define NR_NODE_MEMBLKS	(NR_NODES * 4)
 #endif
 
-extern unsigned long max_low_pfn;
-
-#define pfn_valid(pfn)		(((pfn) < max_low_pfn) && ia64_pfn_valid(pfn))
-#define page_to_pfn(page)	((unsigned long) (page - vmem_map))
-#define pfn_to_page(pfn)	(vmem_map + (pfn))
-
 #else /* CONFIG_DISCONTIGMEM */
 # define NR_NODE_MEMBLKS	4
 #endif /* CONFIG_DISCONTIGMEM */
include/asm-ia64/page.h +9 -10
diff -Nraup a/include/asm-ia64/page.h b/include/asm-ia64/page.h
@@ -84,17 +84,16 @@ extern int ia64_pfn_valid (unsigned long
 #endif
 
 #ifndef CONFIG_DISCONTIGMEM
-# ifdef CONFIG_VIRTUAL_MEM_MAP
+# define pfn_valid(pfn)		(((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
+# define page_to_pfn(page)	((unsigned long) (page - mem_map))
+# define pfn_to_page(pfn)	(mem_map + (pfn))
+#else
 extern struct page *vmem_map;
-#  define pfn_valid(pfn)	(((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
-#  define page_to_pfn(page)	((unsigned long) (page - vmem_map))
-#  define pfn_to_page(pfn)	(vmem_map + (pfn))
-# else
-#  define pfn_valid(pfn)	(((pfn) < max_mapnr) && ia64_pfn_valid(pfn))
-#  define page_to_pfn(page)	((unsigned long) (page - mem_map))
-#  define pfn_to_page(pfn)	(mem_map + (pfn))
-# endif
-#endif /* CONFIG_DISCONTIGMEM */
+extern unsigned long max_low_pfn;
+# define pfn_valid(pfn)		(((pfn) < max_low_pfn) && ia64_pfn_valid(pfn))
+# define page_to_pfn(page)	((unsigned long) (page - vmem_map))
+# define pfn_to_page(pfn)	(vmem_map + (pfn))
+#endif
 
 #define page_to_phys(page)	(page_to_pfn(page) << PAGE_SHIFT)
 #define virt_to_page(kaddr)	pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
#1 lore raw
Quoted 16 lines · Tony Luck

I got this patch from Zou Nan hai to resolve the problem that Andrew Morton has been having booting his ia64 system. The code is quite a bit cleaner as he has reduced the number of different definitions of pfn_valid/page_to_pfn/pfn_to_page, and left the only remaining ones next to each other in page.h ... so this should be easier to maintain going forward.

It has been tested on a variety of systems:

1G Tiger \ Tested by Zou Nan hai, I assume DIG=y, NUMA=n 8G Tiger / but I don't know for sure.
4G Tiger with generic_defconfig
4G Tiger with DIG kernel, NUMA, DISCONTIG and VIRTUAL_MEM_MAP on 4G Tiger with DIG kernel, NUMA/DISCONTIG off; VIRTUAL_MEM_MAP on HP zx2000 with zx1_defconfig

Quoted 4 lines

Can someone please check it on sn2 (sn2_defconfig compiles, but I haven't booted it) ... and any other systems or configurations that don't match any of the above. I'd like to stop carrying the BPB that Andrew gave me.

Boots on a small machine and the code looks identical, so I'm pretty sure it's fine.

Thanks,
Jesse

#2 lore raw
In reply to Tony Luck

On Mon, Sep 27, 2004 at 03:33:10PM -0700, Tony Luck wrote:
Hi Tony,
I tried booting tiger with DIG kernel and virtual_mem_map turned on and kernel
which used to reset earlier now boots fine after applying your patch.

thanks,
Anil

#3 lore raw
In reply to Tony Luck
Quoted 7 lines · Tony Luck

I got this patch from Zou Nan hai to resolve the problem that Andrew Morton has been having booting his ia64 system. The code is quite a bit cleaner as he has reduced the number of different definitions of pfn_valid/page_to_pfn/pfn_to_page, and left the only remaining ones next to each other in page.h ... so this should be easier to maintain going forward.

Quoted 8 lines

It has been tested on a variety of systems:

1G Tiger \ Tested by Zou Nan hai, I assume DIG=y, NUMA=n 8G Tiger / but I don't know for sure.
4G Tiger with generic_defconfig
4G Tiger with DIG kernel, NUMA, DISCONTIG and VIRTUAL_MEM_MAP on 4G Tiger with DIG kernel, NUMA/DISCONTIG off; VIRTUAL_MEM_MAP on HP zx2000 with zx1_defconfig

HP rx2600 with zx1_defconfig with/without VIRTUAL_MEM_MAP
compile and boot OK.

Darren

--------------------------------------------------
Darren Williams <dsw AT gelato.unsw.edu.au>
Gelato@UNSW <www.gelato.unsw.edu.au>
--------------------------------------------------