X-Git-Url: https://git.whamcloud.com/?a=blobdiff_plain;f=lustre%2Fkernel_patches%2Fpatches%2Fconfigurable-x86-stack-2.4.21-sles8sp3.patch;fp=lustre%2Fkernel_patches%2Fpatches%2Fconfigurable-x86-stack-2.4.21-sles8sp3.patch;h=bc0a1b7973f7761239df35fdda6af0e9d627700d;hb=cbd3a230274e1197d378725ee9e2aed6e35d2cb6;hp=0000000000000000000000000000000000000000;hpb=35d3cb4d741549761bae31819c3a7cdf6293bcf6;p=fs%2Flustre-release.git diff --git a/lustre/kernel_patches/patches/configurable-x86-stack-2.4.21-sles8sp3.patch b/lustre/kernel_patches/patches/configurable-x86-stack-2.4.21-sles8sp3.patch new file mode 100644 index 0000000..bc0a1b7 --- /dev/null +++ b/lustre/kernel_patches/patches/configurable-x86-stack-2.4.21-sles8sp3.patch @@ -0,0 +1,330 @@ +Index: linux-2.4.21/arch/i386/kernel/entry.S +=================================================================== +--- linux-2.4.21.orig/arch/i386/kernel/entry.S 2004-04-24 02:39:01.000000000 -0400 ++++ linux-2.4.21/arch/i386/kernel/entry.S 2004-04-24 02:42:58.000000000 -0400 +@@ -45,6 +45,7 @@ + #include + #include + #include ++#include + + EBX = 0x00 + ECX = 0x04 +@@ -130,10 +131,6 @@ + .long 3b,6b; \ + .previous + +-#define GET_CURRENT(reg) \ +- movl $-8192, reg; \ +- andl %esp, reg +- + ENTRY(lcall7) + pushfl # We get a different stack layout with call gates, + pushl %eax # which has to be cleaned up later.. +@@ -149,7 +146,7 @@ + movl %ecx,CS(%esp) # + movl %esp,%ebx + pushl %ebx +- andl $-8192,%ebx # GET_CURRENT ++ andl $-THREAD_SIZE,%ebx # GET_CURRENT + movl exec_domain(%ebx),%edx # Get the execution domain + movl 4(%edx),%edx # Get the lcall7 handler for the domain + pushl $0x7 +@@ -173,7 +170,7 @@ + movl %ecx,CS(%esp) # + movl %esp,%ebx + pushl %ebx +- andl $-8192,%ebx # GET_CURRENT ++ andl $-THREAD_SIZE,%ebx # GET_CURRENT + movl exec_domain(%ebx),%edx # Get the execution domain + movl 4(%edx),%edx # Get the lcall7 handler for the domain + pushl $0x27 +Index: linux-2.4.21/arch/i386/kernel/smpboot.c +=================================================================== +--- linux-2.4.21.orig/arch/i386/kernel/smpboot.c 2004-04-24 02:39:05.000000000 -0400 ++++ linux-2.4.21/arch/i386/kernel/smpboot.c 2004-04-24 02:42:58.000000000 -0400 +@@ -837,7 +837,7 @@ + + /* So we see what's up */ + printk("Booting processor %d/%d eip %lx\n", cpu, apicid, start_eip); +- stack_start.esp = (void *) (1024 + PAGE_SIZE + (char *)idle); ++ stack_start.esp = (void *)idle->thread.esp; + + /* + * This grunge runs the startup process for +@@ -918,7 +918,7 @@ + Dprintk("CPU has booted.\n"); + } else { + boot_error= 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"); +@@ -941,7 +941,7 @@ + } + + /* mark "stuck" area as not stuck */ +- *((volatile unsigned long *)phys_to_virt(8192)) = 0; ++ *((volatile unsigned long *)phys_to_virt(THREAD_SIZE)) = 0; + + #ifdef CONFIG_ES7000 + if (!es7000_plat) +Index: linux-2.4.21/arch/i386/kernel/traps.c +=================================================================== +--- linux-2.4.21.orig/arch/i386/kernel/traps.c 2004-04-24 02:39:18.000000000 -0400 ++++ linux-2.4.21/arch/i386/kernel/traps.c 2004-04-24 02:42:58.000000000 -0400 +@@ -304,7 +304,7 @@ + unsigned long esp = tsk->thread.esp; + + /* User space on another CPU? */ +- if ((esp ^ (unsigned long)tsk) & (PAGE_MASK<<1)) ++ if ((esp ^ (unsigned long)tsk) & ~(THREAD_SIZE - 1)) + return; + show_trace((unsigned long *)esp); + } +Index: linux-2.4.21/arch/i386/kernel/head.S +=================================================================== +--- linux-2.4.21.orig/arch/i386/kernel/head.S 2004-04-24 02:38:42.000000000 -0400 ++++ linux-2.4.21/arch/i386/kernel/head.S 2004-04-24 02:42:58.000000000 -0400 +@@ -15,6 +15,7 @@ + #include + #include + #include ++#include + + #define OLD_CL_MAGIC_ADDR 0x90020 + #define OLD_CL_MAGIC 0xA33F +@@ -326,7 +327,7 @@ + ret + + ENTRY(stack_start) +- .long SYMBOL_NAME(init_task_union)+8192 ++ .long SYMBOL_NAME(init_task_union)+THREAD_SIZE + .long __KERNEL_DS + + /* 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-04-24 02:39:18.000000000 -0400 ++++ linux-2.4.21/arch/i386/kernel/irq.c 2004-04-24 02:44:26.000000000 -0400 +@@ -602,7 +602,10 @@ + long esp; + + /* Debugging check for stack overflow: is there less than 1KB free? */ +- __asm__ __volatile__("andl %%esp,%0" : "=r" (esp) : "0" (8191)); ++ __asm__ __volatile__( ++ "andl %%esp,%0" ++ : "=r" (esp) : "0" (THREAD_SIZE-1)); ++ + if (unlikely(esp < (sizeof(struct task_struct) + sysctl_stackwarn))) { + static unsigned long next_jiffies; /* ratelimiting */ + static long least_esp = THREAD_SIZE; +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-04-24 02:42:58.000000000 -0400 +@@ -21,6 +21,10 @@ + * as they get called from within inline assembly. + */ + ++/* Duplicated from asm/processor.h */ ++#include ++#include ++ + addr_limit = 12 + + .text +@@ -28,7 +32,7 @@ + .globl __get_user_1 + __get_user_1: + movl %esp,%edx +- andl $0xffffe000,%edx ++ andl $~(THREAD_SIZE - 1),%edx + cmpl addr_limit(%edx),%eax + jae bad_get_user + 1: movzbl (%eax),%edx +@@ -41,7 +45,7 @@ + addl $1,%eax + movl %esp,%edx + jc bad_get_user +- andl $0xffffe000,%edx ++ andl $~(THREAD_SIZE - 1),%edx + cmpl addr_limit(%edx),%eax + jae bad_get_user + 2: movzwl -1(%eax),%edx +@@ -54,7 +58,7 @@ + addl $3,%eax + movl %esp,%edx + jc bad_get_user +- andl $0xffffe000,%edx ++ andl $~(THREAD_SIZE - 1),%edx + cmpl addr_limit(%edx),%eax + jae bad_get_user + 3: movl -3(%eax),%edx +Index: linux-2.4.21/arch/i386/config.in +=================================================================== +--- linux-2.4.21.orig/arch/i386/config.in 2004-04-24 02:39:21.000000000 -0400 ++++ linux-2.4.21/arch/i386/config.in 2004-04-24 02:42:58.000000000 -0400 +@@ -326,6 +326,29 @@ + if [ "$CONFIG_SMP" = "y" -a "$CONFIG_X86_CMPXCHG" = "y" ]; then + define_bool CONFIG_HAVE_DEC_LOCK 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/i386/vmlinux.lds.S +=================================================================== +--- linux-2.4.21.orig/arch/i386/vmlinux.lds.S 2004-04-24 02:38:06.000000000 -0400 ++++ linux-2.4.21/arch/i386/vmlinux.lds.S 2004-04-24 02:42:58.000000000 -0400 +@@ -39,7 +39,8 @@ + + _edata = .; /* End of data section */ + +- . = 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); /* Init code and data */ +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-04-24 02:42:58.000000000 -0400 +@@ -1,15 +1,43 @@ + #ifndef _I386_CURRENT_H + #define _I386_CURRENT_H ++#include ++ ++/* ++ * Configurable page sizes on i386, mainly for debugging purposes. ++ * (c) Balbir Singh ++ */ ++ ++#ifdef __ASSEMBLY__ ++ ++#define PAGE_SIZE 4096 /* as cannot handle 1UL << 12 */ ++#define THREAD_SIZE ((1 << CONFIG_STACK_SIZE_SHIFT) * PAGE_SIZE) ++ ++#define GET_CURRENT(reg) \ ++ movl $-THREAD_SIZE, reg; \ ++ andl %esp, reg ++ ++#else /* __ASSEMBLY__ */ ++ ++#define THREAD_SIZE ((1 << CONFIG_STACK_SIZE_SHIFT) * PAGE_SIZE) ++#define alloc_task_struct() \ ++ ((struct task_struct *) __get_free_pages(GFP_KERNEL,CONFIG_STACK_SIZE_SHIFT)) ++ ++#define free_task_struct(p) \ ++ free_pages((unsigned long) (p), CONFIG_STACK_SIZE_SHIFT) ++ ++#define INIT_TASK_SIZE THREAD_SIZE + + struct task_struct; + + static inline struct task_struct * get_current(void) + { + struct task_struct *current; +- __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~8191UL)); ++ __asm__("andl %%esp,%0; ":"=r" (current) : "0" (~(THREAD_SIZE - 1))); + return current; + } + + #define current get_current() + ++#endif /* __ASSEMBLY__ */ ++ + #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-04-24 02:39:05.000000000 -0400 ++++ linux-2.4.21/include/asm-i386/hw_irq.h 2004-04-24 02:42:58.000000000 -0400 +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + + /* + * IDT vectors usable for external interrupt sources start +@@ -120,10 +121,6 @@ + #define IRQ_NAME2(nr) nr##_interrupt(void) + #define IRQ_NAME(nr) IRQ_NAME2(IRQ##nr) + +-#define GET_CURRENT \ +- "movl %esp, %ebx\n\t" \ +- "andl $-8192, %ebx\n\t" +- + /* + * SMP has a few special interrupts for IPI messages + */ +Index: linux-2.4.21/include/asm-i386/processor.h +=================================================================== +--- linux-2.4.21.orig/include/asm-i386/processor.h 2004-04-24 02:39:21.000000000 -0400 ++++ linux-2.4.21/include/asm-i386/processor.h 2004-04-24 02:42:58.000000000 -0400 +@@ -14,6 +14,7 @@ + #include + #include + #include ++#include + #include + #include + #include +@@ -466,9 +467,6 @@ + #define KSTK_EIP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1019]) + #define KSTK_ESP(tsk) (((unsigned long *)(4096+(unsigned long)(tsk)))[1022]) + +-#define THREAD_SIZE (2*PAGE_SIZE) +-#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 get_task_struct(tsk) atomic_inc(&virt_to_page(tsk)->count) + + #define init_task (init_task_union.task) +Index: linux-2.4.21/include/linux/sched.h +=================================================================== +--- linux-2.4.21.orig/include/linux/sched.h 2004-04-24 02:39:20.000000000 -0400 ++++ linux-2.4.21/include/linux/sched.h 2004-04-24 02:42:58.000000000 -0400 +@@ -2,6 +2,7 @@ + #define _LINUX_SCHED_H + + #include /* for HZ */ ++#include /* maybe for INIT_TASK_SIZE */ + + extern unsigned long event; + +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-04-24 02:42:58.000000000 -0400 +@@ -5,6 +5,7 @@ + struct task_struct; + + #include ++#include + + static inline struct task_struct *get_current(void) + {