From ed2686f953890e7aa9c72840c4f48a9bd3717052 Mon Sep 17 00:00:00 2001 From: jacob Date: Mon, 20 Dec 2004 22:54:27 +0000 Subject: [PATCH] add bigstack support to rhel 2.4.21 --- .../kernel-2.4.21-rhel-2.4-x86_64-smp.config | 5 + .../kernel-2.4.21-rhel-2.4-x86_64.config | 5 + .../configurable-x86-stack-2.4.21-chaos.patch | 169 ++++++++++++++++++--- 3 files changed, 156 insertions(+), 23 deletions(-) diff --git a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64-smp.config b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64-smp.config index b5685fc..e7ea628 100644 --- a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64-smp.config +++ b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64-smp.config @@ -53,6 +53,11 @@ CONFIG_MCE=y CONFIG_K8_NUMA=y CONFIG_DISCONTIGMEM=y CONFIG_NUMA=y +# CONFIG_NOBIGSTACK is not set +CONFIG_STACK_SIZE_16KB=y +# CONFIG_STACK_SIZE_32KB is not set +# CONFIG_STACK_SIZE_64KB is not set +CONFIG_STACK_SIZE_SHIFT=2 # # General setup diff --git a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64.config b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64.config index b5685fc..e7ea628 100644 --- a/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64.config +++ b/lustre/kernel_patches/kernel_configs/kernel-2.4.21-rhel-2.4-x86_64.config @@ -53,6 +53,11 @@ CONFIG_MCE=y CONFIG_K8_NUMA=y CONFIG_DISCONTIGMEM=y CONFIG_NUMA=y +# CONFIG_NOBIGSTACK is not set +CONFIG_STACK_SIZE_16KB=y +# CONFIG_STACK_SIZE_32KB is not set +# CONFIG_STACK_SIZE_64KB is not set +CONFIG_STACK_SIZE_SHIFT=2 # # General setup diff --git a/lustre/kernel_patches/patches/configurable-x86-stack-2.4.21-chaos.patch b/lustre/kernel_patches/patches/configurable-x86-stack-2.4.21-chaos.patch index 66c2ef2..3fe5f74 100644 --- a/lustre/kernel_patches/patches/configurable-x86-stack-2.4.21-chaos.patch +++ b/lustre/kernel_patches/patches/configurable-x86-stack-2.4.21-chaos.patch @@ -1,7 +1,7 @@ Index: linux-2.4.21/arch/i386/kernel/entry.S =================================================================== ---- linux-2.4.21.orig/arch/i386/kernel/entry.S 2004-07-09 19:15:11.000000000 -0400 -+++ linux-2.4.21/arch/i386/kernel/entry.S 2004-07-16 18:00:14.000000000 -0400 +--- linux-2.4.21.orig/arch/i386/kernel/entry.S 2004-09-11 10:16:39.000000000 -0400 ++++ linux-2.4.21/arch/i386/kernel/entry.S 2004-12-20 17:47:25.000000000 -0500 @@ -46,6 +46,7 @@ #include #include @@ -41,8 +41,8 @@ Index: linux-2.4.21/arch/i386/kernel/entry.S movl %edx, %esp; \ Index: linux-2.4.21/arch/i386/kernel/smpboot.c =================================================================== ---- linux-2.4.21.orig/arch/i386/kernel/smpboot.c 2004-07-09 19:14:40.000000000 -0400 -+++ linux-2.4.21/arch/i386/kernel/smpboot.c 2004-07-16 18:00:14.000000000 -0400 +--- linux-2.4.21.orig/arch/i386/kernel/smpboot.c 2004-09-11 10:16:17.000000000 -0400 ++++ linux-2.4.21/arch/i386/kernel/smpboot.c 2004-12-20 17:47:25.000000000 -0500 @@ -814,7 +814,7 @@ /* So we see what's up */ @@ -72,8 +72,8 @@ Index: linux-2.4.21/arch/i386/kernel/smpboot.c printk("Restoring NMI vector\n"); Index: linux-2.4.21/arch/i386/kernel/traps.c =================================================================== ---- linux-2.4.21.orig/arch/i386/kernel/traps.c 2004-07-09 19:14:54.000000000 -0400 -+++ linux-2.4.21/arch/i386/kernel/traps.c 2004-07-16 18:00:14.000000000 -0400 +--- linux-2.4.21.orig/arch/i386/kernel/traps.c 2004-09-11 10:16:25.000000000 -0400 ++++ linux-2.4.21/arch/i386/kernel/traps.c 2004-12-20 17:47:25.000000000 -0500 @@ -180,7 +180,7 @@ unsigned long esp = tsk->thread.esp; @@ -85,8 +85,8 @@ Index: linux-2.4.21/arch/i386/kernel/traps.c } Index: linux-2.4.21/arch/i386/kernel/head.S =================================================================== ---- linux-2.4.21.orig/arch/i386/kernel/head.S 2004-07-09 19:14:45.000000000 -0400 -+++ linux-2.4.21/arch/i386/kernel/head.S 2004-07-16 18:00:14.000000000 -0400 +--- linux-2.4.21.orig/arch/i386/kernel/head.S 2004-09-11 10:16:19.000000000 -0400 ++++ linux-2.4.21/arch/i386/kernel/head.S 2004-12-20 17:47:25.000000000 -0500 @@ -15,6 +15,7 @@ #include #include @@ -95,7 +95,7 @@ Index: linux-2.4.21/arch/i386/kernel/head.S #define OLD_CL_MAGIC_ADDR 0x90020 #define OLD_CL_MAGIC 0xA33F -@@ -315,7 +316,7 @@ +@@ -343,7 +344,7 @@ ret ENTRY(stack_start) @@ -106,8 +106,8 @@ Index: linux-2.4.21/arch/i386/kernel/head.S /* This is the default interrupt "handler" :-) */ Index: linux-2.4.21/arch/i386/kernel/irq.c =================================================================== ---- linux-2.4.21.orig/arch/i386/kernel/irq.c 2004-07-09 19:14:59.000000000 -0400 -+++ linux-2.4.21/arch/i386/kernel/irq.c 2004-07-16 18:00:14.000000000 -0400 +--- linux-2.4.21.orig/arch/i386/kernel/irq.c 2004-09-11 10:16:30.000000000 -0400 ++++ linux-2.4.21/arch/i386/kernel/irq.c 2004-12-20 17:47:25.000000000 -0500 @@ -45,6 +45,7 @@ #include #include @@ -128,7 +128,7 @@ Index: linux-2.4.21/arch/i386/kernel/irq.c Index: linux-2.4.21/arch/i386/lib/getuser.S =================================================================== --- linux-2.4.21.orig/arch/i386/lib/getuser.S 1998-01-12 16:42:52.000000000 -0500 -+++ linux-2.4.21/arch/i386/lib/getuser.S 2004-07-16 18:00:14.000000000 -0400 ++++ linux-2.4.21/arch/i386/lib/getuser.S 2004-12-20 17:47:25.000000000 -0500 @@ -21,6 +21,10 @@ * as they get called from within inline assembly. */ @@ -169,8 +169,8 @@ Index: linux-2.4.21/arch/i386/lib/getuser.S 3: movl -3(%eax),%edx Index: linux-2.4.21/arch/i386/config.in =================================================================== ---- linux-2.4.21.orig/arch/i386/config.in 2004-07-09 19:15:12.000000000 -0400 -+++ linux-2.4.21/arch/i386/config.in 2004-07-16 18:00:14.000000000 -0400 +--- linux-2.4.21.orig/arch/i386/config.in 2004-09-11 10:16:39.000000000 -0400 ++++ linux-2.4.21/arch/i386/config.in 2004-12-20 17:47:25.000000000 -0500 @@ -306,6 +306,28 @@ fi fi @@ -200,10 +200,10 @@ Index: linux-2.4.21/arch/i386/config.in if [ "$CONFIG_SMP" = "y" -a "$CONFIG_X86_CMPXCHG" = "y" ]; then define_bool CONFIG_HAVE_DEC_LOCK y fi -Index: linux-p4smp/arch/i386/vmlinux.lds.in +Index: linux-2.4.21/arch/i386/vmlinux.lds.in =================================================================== ---- linux-p4smp.orig/arch/i386/vmlinux.lds.in 2004-06-14 13:13:07.000000000 -0700 -+++ linux-p4smp/arch/i386/vmlinux.lds.in 2004-06-14 13:41:19.000000000 -0700 +--- linux-2.4.21.orig/arch/i386/vmlinux.lds.in 2004-09-11 10:16:19.000000000 -0400 ++++ linux-2.4.21/arch/i386/vmlinux.lds.in 2004-12-20 17:47:25.000000000 -0500 @@ -1,6 +1,7 @@ #define __ASSEMBLY__ @@ -221,9 +221,92 @@ Index: linux-p4smp/arch/i386/vmlinux.lds.in .data.init_task : { *(.data.init_task) } entry_tramp_start = .; +Index: linux-2.4.21/arch/x86_64/config.in +=================================================================== +--- linux-2.4.21.orig/arch/x86_64/config.in 2004-09-11 10:16:35.000000000 -0400 ++++ linux-2.4.21/arch/x86_64/config.in 2004-12-20 17:49:14.000000000 -0500 +@@ -90,6 +90,28 @@ + define_bool CONFIG_NUMA y + fi + ++choice 'Bigger Stack Size Support' \ ++ "off CONFIG_NOBIGSTACK \ ++ 16KB CONFIG_STACK_SIZE_16KB \ ++ 32KB CONFIG_STACK_SIZE_32KB \ ++ 64KB CONFIG_STACK_SIZE_64KB" off ++ ++if [ "$CONFIG_NOBIGSTACK" = "y" ]; then ++ define_int CONFIG_STACK_SIZE_SHIFT 1 ++else ++ if [ "$CONFIG_STACK_SIZE_16KB" = "y" ]; then ++ define_int CONFIG_STACK_SIZE_SHIFT 2 ++ else ++ if [ "$CONFIG_STACK_SIZE_32KB" = "y" ]; then ++ define_int CONFIG_STACK_SIZE_SHIFT 3 ++ else ++ if [ "$CONFIG_STACK_SIZE_64KB" = "y" ]; then ++ define_int CONFIG_STACK_SIZE_SHIFT 4 ++ fi ++ fi ++ fi ++fi ++ + endmenu + + mainmenu_option next_comment +Index: linux-2.4.21/arch/x86_64/kernel/smpboot.c +=================================================================== +--- linux-2.4.21.orig/arch/x86_64/kernel/smpboot.c 2004-09-11 10:16:17.000000000 -0400 ++++ linux-2.4.21/arch/x86_64/kernel/smpboot.c 2004-12-20 17:49:14.000000000 -0500 +@@ -756,7 +756,7 @@ + Dprintk("CPU has booted.\n"); + } else { + boot_status = 1; +- if (*((volatile unsigned char *)phys_to_virt(8192)) ++ if (*((volatile unsigned char *)phys_to_virt(THREAD_SIZE)) + == 0xA5) + /* trampoline started but...? */ + printk("Stuck ??\n"); +@@ -775,7 +775,7 @@ + } + + /* mark "stuck" area as not stuck */ +- *((volatile unsigned int *)phys_to_virt(8192)) = 0; ++ *((volatile unsigned int *)phys_to_virt(THREAD_SIZE)) = 0; + + return cpu; + } +Index: linux-2.4.21/arch/x86_64/kernel/traps.c +=================================================================== +--- linux-2.4.21.orig/arch/x86_64/kernel/traps.c 2004-09-11 10:16:25.000000000 -0400 ++++ linux-2.4.21/arch/x86_64/kernel/traps.c 2004-12-20 17:49:14.000000000 -0500 +@@ -240,7 +240,7 @@ + unsigned long rsp = tsk->thread.rsp; + + /* User space on another CPU? */ +- if ((rsp ^ (unsigned long)tsk) & (PAGE_MASK<<1)) ++ if ((rsp ^ (unsigned long)tsk) & ~(THREAD_SIZE - 1)) + return; + show_trace((unsigned long *)rsp); + } +Index: linux-2.4.21/arch/x86_64/vmlinux.lds +=================================================================== +--- linux-2.4.21.orig/arch/x86_64/vmlinux.lds 2003-06-13 10:51:32.000000000 -0400 ++++ linux-2.4.21/arch/x86_64/vmlinux.lds 2004-12-20 17:49:14.000000000 -0500 +@@ -72,7 +72,8 @@ + .vsyscall_1 ADDR(.vsyscall_0) + 1024: AT (LOADADDR(.vsyscall_0) + 1024) { *(.vsyscall_1) } + . = LOADADDR(.vsyscall_0) + 4096; + +- . = ALIGN(8192); /* init_task */ ++/* chose the biggest of the possible stack sizes here? */ ++ . = ALIGN(65536); /* init_task */ + .data.init_task : { *(.data.init_task) } + + . = ALIGN(4096); +Index: linux-2.4.21/include/asm-i386/current.h =================================================================== --- linux-2.4.21.orig/include/asm-i386/current.h 1998-08-14 19:35:22.000000000 -0400 -+++ linux-2.4.21/include/asm-i386/current.h 2004-07-16 18:00:14.000000000 -0400 ++++ linux-2.4.21/include/asm-i386/current.h 2004-12-20 17:47:25.000000000 -0500 @@ -1,15 +1,64 @@ #ifndef _I386_CURRENT_H #define _I386_CURRENT_H @@ -292,8 +375,8 @@ Index: linux-p4smp/arch/i386/vmlinux.lds.in #endif /* !(_I386_CURRENT_H) */ Index: linux-2.4.21/include/asm-i386/hw_irq.h =================================================================== ---- linux-2.4.21.orig/include/asm-i386/hw_irq.h 2004-07-09 19:14:45.000000000 -0400 -+++ linux-2.4.21/include/asm-i386/hw_irq.h 2004-07-16 18:00:14.000000000 -0400 +--- linux-2.4.21.orig/include/asm-i386/hw_irq.h 2004-09-11 10:16:19.000000000 -0400 ++++ linux-2.4.21/include/asm-i386/hw_irq.h 2004-12-20 17:47:25.000000000 -0500 @@ -135,21 +135,17 @@ " \ /* load the real stack - keep the offset */ \ @@ -320,8 +403,8 @@ Index: linux-2.4.21/include/asm-i386/hw_irq.h */ Index: linux-2.4.21/include/asm-i386/processor.h =================================================================== ---- linux-2.4.21.orig/include/asm-i386/processor.h 2004-07-09 19:15:12.000000000 -0400 -+++ linux-2.4.21/include/asm-i386/processor.h 2004-07-16 18:00:14.000000000 -0400 +--- linux-2.4.21.orig/include/asm-i386/processor.h 2004-09-11 10:16:39.000000000 -0400 ++++ linux-2.4.21/include/asm-i386/processor.h 2004-12-20 17:47:25.000000000 -0500 @@ -14,6 +14,7 @@ #include #include @@ -330,7 +413,7 @@ Index: linux-2.4.21/include/asm-i386/processor.h #include #include #include -@@ -494,10 +495,6 @@ +@@ -490,10 +491,6 @@ #define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019]) #define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022]) @@ -341,3 +424,43 @@ Index: linux-2.4.21/include/asm-i386/processor.h #define init_task (init_task_union.task) #define init_stack (init_task_union.stack) +Index: linux-2.4.21/include/asm-x86_64/current.h +=================================================================== +--- linux-2.4.21.orig/include/asm-x86_64/current.h 2002-11-28 18:53:15.000000000 -0500 ++++ linux-2.4.21/include/asm-x86_64/current.h 2004-12-20 17:49:14.000000000 -0500 +@@ -5,6 +5,7 @@ + struct task_struct; + + #include ++#include + + static inline struct task_struct *get_current(void) + { +Index: linux-2.4.21/include/asm-x86_64/page.h +=================================================================== +--- linux-2.4.21.orig/include/asm-x86_64/page.h 2004-09-11 10:16:20.000000000 -0400 ++++ linux-2.4.21/include/asm-x86_64/page.h 2004-12-20 17:49:14.000000000 -0500 +@@ -27,8 +27,8 @@ + /* We still hope 8K is enough, but ... */ + /* Currently it is actually ~6k. This would change when task_struct moves into + an own slab. */ +-#define THREAD_ORDER 1 +-#define THREAD_SIZE (2*PAGE_SIZE) ++#define THREAD_ORDER CONFIG_STACK_SIZE_SHIFT ++#define THREAD_SIZE ((1 << CONFIG_STACK_SIZE_SHIFT) * PAGE_SIZE) + + #define INIT_TASK_SIZE THREAD_SIZE + #define CURRENT_MASK (~(THREAD_SIZE-1)) +Index: linux-2.4.21/include/asm-x86_64/processor.h +=================================================================== +--- linux-2.4.21.orig/include/asm-x86_64/processor.h 2004-09-11 10:16:39.000000000 -0400 ++++ linux-2.4.21/include/asm-x86_64/processor.h 2004-12-20 17:50:00.000000000 -0500 +@@ -406,7 +406,7 @@ + are already there. When you run out of stack try this first. */ + + #define __alloc_task_struct() ((struct task_struct *) __get_free_pages(GFP_KERNEL,1)) +-#define __free_task_struct(p) free_pages((unsigned long) (p), 1) ++#define __free_task_struct(p) free_pages((unsigned long) (p), THREAD_ORDER) + + #define init_task (init_task_union.task) + #define init_stack (init_task_union.stack) -- 1.8.3.1