Skip to contentSkip to conversation

Require NUMA testing linux-2.6.0-test6

TESTING Darren Williams 1 participant 1 message Oct 3, 2003 Kbuild

lore
Share & tools
lore
#0 lore raw

Hi
If anybody is interested we require a patch to be testing on an ia64 NUMA enabled machine. The patch makes use of the long format VHPT offered on ia64 machines. I have tested that it will compile with NUMA enabled, however I do not have a NUMA machine to run any tests on. Any help would be appreciated. There has been a small discussion about this patch on the ia64-linux list:
http://marc.theaimsgroup.com/?t=106453919500005&r=1&w=2

Thanks

--------------------------------------------------
Darren Williams <[email protected]> Gelato@UNSW <www.gelato.unsw.edu.au>
--------------------------------------------------

# This is a BitKeeper generated patch for the following project:
# Project Name: Linux kernel tree
# This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas:
# ChangeSet v2.6.0-test6 -> 1.1376
# include/asm-ia64/mmu_context.h 1.15 -> 1.17
# include/asm-ia64/page.h 1.21 -> 1.22
# arch/ia64/kernel/setup.c 1.59 -> 1.61
# arch/ia64/kernel/ivt.S 1.23 -> 1.24
# include/asm-ia64/kregs.h 1.6 -> 1.7
# include/asm-ia64/asmmacro.h 1.12 -> 1.13
# arch/ia64/kernel/smpboot.c 1.39 -> 1.40
# include/asm-ia64/pgtable.h 1.28 -> 1.29
# include/asm-ia64/tlb.h 1.16 -> 1.17
# arch/ia64/mm/init.c 1.48 -> 1.50
# Makefile 1.432 -> 1.433
# arch/ia64/kernel/patch.c 1.5 -> 1.6
# arch/ia64/mm/tlb.c 1.19 -> 1.20
# include/asm-ia64/tlbflush.h 1.9 -> 1.10
# arch/ia64/Kconfig 1.46 -> 1.47
# arch/ia64/kernel/traps.c 1.39 -> 1.40
#
# The following is the BitKeeper ChangeSet Log
# --------------------------------------------
# 03/09/27 [email protected] 1.1375
# Linux 2.6.0-test6
# --------------------------------------------
# 03/10/03 dsw@quasar.(none) 1.1376
# Clean up compiler warnings and add comments
# --------------------------------------------
#

Makefile +1 -1
diff -Nru a/Makefile b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 0
-EXTRAVERSION = -test6
+EXTRAVERSION = -test6-vhpt
 
 # *DOCUMENTATION*
 # To see a list of typical targets execute "make help"
arch/ia64/Kconfig +4 -1
diff -Nru a/arch/ia64/Kconfig b/arch/ia64/Kconfig
@@ -685,7 +685,10 @@
 	  debugging info resulting in a larger kernel image.
 	  Say Y here only if you plan to use gdb to debug the kernel.
 	  If you don't debug the kernel, you can say N.
-	  
+
+config IA64_LONG_FORMAT_VHPT
+	bool "Long format VHPT"
+
 endmenu
 
 source "security/Kconfig"
arch/ia64/kernel/ivt.S +48 -80

287 lines not on this page · raw message

arch/ia64/kernel/patch.c +0 -2
diff -Nru a/arch/ia64/kernel/patch.c b/arch/ia64/kernel/patch.c
@@ -145,7 +145,6 @@
 	extern unsigned long fsyscall_table[NR_syscalls];
 	s32 *offp = (s32 *) start;
 	u64 ip;
-
 	while (offp < (s32 *) end) {
 		ip = (u64) ia64_imva((char *) offp + *offp);
 		ia64_patch_imm64(ip, (u64) fsyscall_table);
@@ -179,7 +178,6 @@
 {
 #	define START(name)	((unsigned long) __start_gate_##name##_patchlist)
 #	define END(name)	((unsigned long)__end_gate_##name##_patchlist)
-
 	patch_fsyscall_table(START(fsyscall), END(fsyscall));
 	patch_brl_fsys_bubble_down(START(brl_fsys_bubble_down), END(brl_fsys_bubble_down));
 	ia64_patch_vtop(START(vtop), END(vtop));
arch/ia64/kernel/setup.c +13 -0
diff -Nru a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
@@ -225,6 +225,15 @@
 #endif
 }
 
+#ifdef CONFIG_IA64_LONG_FORMAT_VHPT
+void __init
+compute_vhpt_size(void)
+{
+	long_vhpt_bits = 22;
+	long_vhpt_size = 1 << long_vhpt_bits;
+}
+#endif
+
 void __init
 setup_arch (char **cmdline_p)
 {
@@ -240,6 +249,10 @@
 
 	efi_init();
 	find_memory();
+
+#ifdef CONFIG_IA64_LONG_FORMAT_VHPT
+	compute_vhpt_size();
+#endif
 
 #ifdef CONFIG_ACPI_BOOT
 	/* Initialize the ACPI boot-time table parser */
arch/ia64/kernel/smpboot.c +7 -1
diff -Nru a/arch/ia64/kernel/smpboot.c b/arch/ia64/kernel/smpboot.c
@@ -381,7 +381,13 @@
 	unhash_process(idle);
 
 	task_for_booting_cpu = idle;
-
+#ifdef CONFIG_IA64_LONG_FORMAT_VHPT
+	if (alloc_vhpt(cpu)) {
+		panic("Couldn't allocate VHPT on CPU%d, size: %lx\n", cpu, long_vhpt_size);
+	}
+	printk(KERN_INFO "Allocated long format VHPT for CPU%d at: %lx, size: 0x%lx\n", cpu, vhpt_base[cpu], long_vhpt_size);
+#endif /* CONFIG_IA64_LONG_FORMAT_VHPT */
+	
 	Dprintk("Sending wakeup vector %lu to AP 0x%x/0x%x.\n", ap_wakeup_vector, cpu, sapicid);
 
 	platform_send_ipi(cpu, ap_wakeup_vector, IA64_IPI_DM_INT, 0);
arch/ia64/kernel/traps.c +1 -1
diff -Nru a/arch/ia64/kernel/traps.c b/arch/ia64/kernel/traps.c
@@ -454,7 +454,7 @@
 		"Unknown fault 9", "Unknown fault 10", "Unknown fault 11", "Unknown fault 12",
 		"Unknown fault 13", "Unknown fault 14", "Unknown fault 15"
 	};
-
+	
 	if ((isr & IA64_ISR_NA) && ((isr & IA64_ISR_CODE_MASK) == IA64_ISR_CODE_LFETCH)) {
 		/*
 		 * This fault was due to lfetch.fault, set "ed" bit in the psr to cancel
arch/ia64/mm/init.c +65 -4

131 lines not on this page · raw message

arch/ia64/mm/tlb.c +47 -0

65 lines not on this page · raw message

include/asm-ia64/asmmacro.h +131 -0

142 lines not on this page · raw message

include/asm-ia64/kregs.h +1 -0
diff -Nru a/include/asm-ia64/kregs.h b/include/asm-ia64/kregs.h
@@ -30,6 +30,7 @@
 #define IA64_TR_PALCODE		1	/* itr1: maps PALcode as required by EFI */
 #define IA64_TR_PERCPU_DATA	1	/* dtr1: percpu data */
 #define IA64_TR_CURRENT_STACK	2	/* dtr2: maps kernel's memory- & register-stacks */
+#define IA64_TR_LONG_VHPT	3	/* dtr3: maps long format VHPT */
 
 /* Processor status register bits: */
 #define IA64_PSR_BE_BIT		1
include/asm-ia64/mmu_context.h +24 -1
diff -Nru a/include/asm-ia64/mmu_context.h b/include/asm-ia64/mmu_context.h
@@ -17,7 +17,21 @@
 
 #define IA64_REGION_ID_KERNEL	0 /* the kernel's region id (tlb.c depends on this being 0) */
 
-#define ia64_rid(ctx,addr)	(((ctx) << 3) | (addr >> 61))
+#ifdef CONFIG_IA64_LONG_FORMAT_VHPT
+/*
+ * Due to a high number of collisions in the long format VHPT walker hash function
+ * when RIDs and similar address space layout occur "eg. fork()". The following is
+ * used to space out the RIDs we present to the hardware without messing with Linux's 
+ * sequential allocation scheme. 
+ * Refer to 'Intel Itanium Processor Reference Manual for Software Development' 
+ * http://www.intel.com/design/itanium/manuals.htm 
+ */
+#define redistribute_rid(rid)	(((rid) & ~0xffff) | (((rid) << 8) & 0xff00) | (((rid) >> 8) & 0xff))
+#else
+#define redistribute_rid(rid)	(rid)
+#endif
+
+#define ia64_rid(ctx,addr)	redistribute_rid(((ctx) << 3) | (addr >> 61))
 
 # ifndef __ASSEMBLY__
 
@@ -141,7 +155,12 @@
 	unsigned long rr0, rr1, rr2, rr3, rr4;
 
 	rid = context << 3;	/* make space for encoding the region number */
+#ifdef CONFIG_IA64_LONG_FORMAT_VHPT
+	rid = redistribute_rid(rid);
+	rid_incr = 1 << 16;
+#else
 	rid_incr = 1 << 8;
+#endif
 
 	/* encode the region id, preferred page size, and VHPT enable bit: */
 	rr0 = (rid << 8) | (PAGE_SHIFT << 2) | 1;
@@ -173,6 +192,10 @@
 		MMU_TRACE('a', smp_processor_id(), mm, context);
 		/* in the unlikely event of a TLB-flush by another thread, redo the load: */
 	} while (unlikely(context != mm->context));
+	
+#if defined(CONFIG_IA64_LONG_FORMAT_VHPT) && defined(CONFIG_SMP)
+	set_bit(smp_processor_id(), &mm->cpu_vm_mask);
+#endif
 }
 
 #define deactivate_mm(tsk,mm)					\
include/asm-ia64/page.h +3 -0
diff -Nru a/include/asm-ia64/page.h b/include/asm-ia64/page.h
@@ -151,6 +151,9 @@
 	return order;
 }
 
+/* Long format VHPT entry */
+typedef struct { unsigned long pte, itir, tag, ig; } long_pte_t;
+
 # endif /* __KERNEL__ */
 #endif /* !__ASSEMBLY__ */
 
include/asm-ia64/pgtable.h +11 -0
diff -Nru a/include/asm-ia64/pgtable.h b/include/asm-ia64/pgtable.h
@@ -474,6 +474,12 @@
     extern void memmap_init (struct page *start, unsigned long size, int nid, unsigned long zone,
 			     unsigned long start_pfn);
 #  endif /* CONFIG_VIRTUAL_MEM_MAP */
+
+#ifdef CONFIG_IA64_LONG_FORMAT_VHPT
+extern unsigned long vhpt_base[NR_CPUS];
+extern unsigned long long_vhpt_bits, long_vhpt_size;
+#endif
+
 # endif /* !__ASSEMBLY__ */
 
 /*
@@ -492,6 +498,11 @@
  */
 #define KERNEL_TR_PAGE_SHIFT	_PAGE_SIZE_64M
 #define KERNEL_TR_PAGE_SIZE	(1 << KERNEL_TR_PAGE_SHIFT)
+
+ /*
+ * Long format VHPT
+ */
+#define LONG_VHPT_BASE		(0xc000000000000000 - long_vhpt_size)
 
 /*
  * No page table caches to initialise
include/asm-ia64/tlb.h +2 -0
diff -Nru a/include/asm-ia64/tlb.h b/include/asm-ia64/tlb.h
@@ -105,8 +105,10 @@
 		vma.vm_mm = tlb->mm;
 		/* flush the address range from the tlb: */
 		flush_tlb_range(&vma, start, end);
+#ifndef CONFIG_IA64_LONG_FORMAT_VHPT
 		/* now flush the virt. page-table area mapping the address range: */
 		flush_tlb_range(&vma, ia64_thash(start), ia64_thash(end));
+#endif
 	}
 
 	/* lastly, release the freed pages */
include/asm-ia64/tlbflush.h +19 -0
diff -Nru a/include/asm-ia64/tlbflush.h b/include/asm-ia64/tlbflush.h
@@ -19,6 +19,21 @@
  * can be very expensive, so try to avoid them whenever possible.
  */
 
+/* Flushing a translation from the long format VHPT */
+#ifdef CONFIG_IA64_LONG_FORMAT_VHPT
+# define INVALID_TAG (1UL << 63)
+
+static inline void
+flush_vhpt_page(unsigned long addr)
+{
+	long_pte_t *hpte;
+	hpte = (long_pte_t *)ia64_thash(addr);
+	hpte->tag = INVALID_TAG;
+}
+#else
+# define flush_vhpt_page(addr)	do { } while (0)
+#endif
+
 /*
  * Flush everything (kernel mapping may also have changed due to
  * vmalloc/vfree).
@@ -53,6 +68,7 @@
 		goto out;
 
 	mm->context = 0;
+	mm->cpu_vm_mask = 0;
 
 	if (atomic_read(&mm->mm_users) == 0)
 		goto out;		/* happens as a result of exit_mmap() */
@@ -78,7 +94,10 @@
 	flush_tlb_range(vma, (addr & PAGE_MASK), (addr & PAGE_MASK) + PAGE_SIZE);
 #else
 	if (vma->vm_mm == current->active_mm)
+	{
+		flush_vhpt_page(addr);
 		ia64_ptcl(addr, (PAGE_SHIFT << 2));
+	}
 	else
 		vma->vm_mm->context = 0;
 #endif