From c06c7d7c07e42150c3b4d67f52a8699384697b5b Mon Sep 17 00:00:00 2001 From: "cl349@firebug.cl.cam.ac.uk" Date: Tue, 31 Jan 2006 19:55:22 +0000 Subject: Update to Linux 2.6.14. Signed-off-by: Christian Limpach --- patches/linux-2.6.12/2.6.12.6.patch | 1738 -------------------- patches/linux-2.6.12/cpu-hotplug-init.patch | 34 - .../i386-cpu-hotplug-updated-for-mm.patch | 581 ------- patches/linux-2.6.12/i386-mach-io-check-nmi.patch | 43 - patches/linux-2.6.12/net-csum.patch | 56 - patches/linux-2.6.12/pmd-shared.patch | 130 -- patches/linux-2.6.12/rcu-nohz.patch | 16 - patches/linux-2.6.12/smp-alts.patch | 563 ------- patches/linux-2.6.14/i386-mach-io-check-nmi.patch | 45 + patches/linux-2.6.14/net-csum.patch | 46 + patches/linux-2.6.14/pmd-shared.patch | 111 ++ patches/linux-2.6.14/rcu-nohz.patch | 16 + patches/linux-2.6.14/smp-alts.patch | 563 +++++++ 13 files changed, 781 insertions(+), 3161 deletions(-) delete mode 100644 patches/linux-2.6.12/2.6.12.6.patch delete mode 100644 patches/linux-2.6.12/cpu-hotplug-init.patch delete mode 100644 patches/linux-2.6.12/i386-cpu-hotplug-updated-for-mm.patch delete mode 100644 patches/linux-2.6.12/i386-mach-io-check-nmi.patch delete mode 100644 patches/linux-2.6.12/net-csum.patch delete mode 100644 patches/linux-2.6.12/pmd-shared.patch delete mode 100644 patches/linux-2.6.12/rcu-nohz.patch delete mode 100644 patches/linux-2.6.12/smp-alts.patch create mode 100644 patches/linux-2.6.14/i386-mach-io-check-nmi.patch create mode 100644 patches/linux-2.6.14/net-csum.patch create mode 100644 patches/linux-2.6.14/pmd-shared.patch create mode 100644 patches/linux-2.6.14/rcu-nohz.patch create mode 100644 patches/linux-2.6.14/smp-alts.patch (limited to 'patches') diff --git a/patches/linux-2.6.12/2.6.12.6.patch b/patches/linux-2.6.12/2.6.12.6.patch deleted file mode 100644 index f876d022c5..0000000000 --- a/patches/linux-2.6.12/2.6.12.6.patch +++ /dev/null @@ -1,1738 +0,0 @@ -diff --git a/Makefile b/Makefile ---- a/Makefile -+++ b/Makefile -@@ -1,7 +1,7 @@ - VERSION = 2 - PATCHLEVEL = 6 - SUBLEVEL = 12 --EXTRAVERSION = -+EXTRAVERSION = .6 - NAME=Woozy Numbat - - # *DOCUMENTATION* -@@ -1149,7 +1149,7 @@ endif # KBUILD_EXTMOD - #(which is the most common case IMHO) to avoid unneeded clutter in the big tags file. - #Adding $(srctree) adds about 20M on i386 to the size of the output file! - --ifeq ($(KBUILD_OUTPUT),) -+ifeq ($(src),$(obj)) - __srctree = - else - __srctree = $(srctree)/ -diff --git a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c ---- a/arch/i386/kernel/cpu/cpufreq/powernow-k8.c -+++ b/arch/i386/kernel/cpu/cpufreq/powernow-k8.c -@@ -44,7 +44,7 @@ - - #define PFX "powernow-k8: " - #define BFX PFX "BIOS error: " --#define VERSION "version 1.40.2" -+#define VERSION "version 1.40.4" - #include "powernow-k8.h" - - /* serialize freq changes */ -@@ -978,7 +978,7 @@ static int __init powernowk8_cpu_init(st - { - struct powernow_k8_data *data; - cpumask_t oldmask = CPU_MASK_ALL; -- int rc; -+ int rc, i; - - if (!check_supported_cpu(pol->cpu)) - return -ENODEV; -@@ -1064,7 +1064,9 @@ static int __init powernowk8_cpu_init(st - printk("cpu_init done, current fid 0x%x, vid 0x%x\n", - data->currfid, data->currvid); - -- powernow_data[pol->cpu] = data; -+ for_each_cpu_mask(i, cpu_core_map[pol->cpu]) { -+ powernow_data[i] = data; -+ } - - return 0; - -diff --git a/arch/i386/kernel/process.c b/arch/i386/kernel/process.c ---- a/arch/i386/kernel/process.c -+++ b/arch/i386/kernel/process.c -@@ -827,6 +827,8 @@ asmlinkage int sys_get_thread_area(struc - if (idx < GDT_ENTRY_TLS_MIN || idx > GDT_ENTRY_TLS_MAX) - return -EINVAL; - -+ memset(&info, 0, sizeof(info)); -+ - desc = current->thread.tls_array + idx - GDT_ENTRY_TLS_MIN; - - info.entry_number = idx; -diff --git a/arch/ia64/kernel/ptrace.c b/arch/ia64/kernel/ptrace.c ---- a/arch/ia64/kernel/ptrace.c -+++ b/arch/ia64/kernel/ptrace.c -@@ -945,6 +945,13 @@ access_uarea (struct task_struct *child, - *data = (pt->cr_ipsr & IPSR_MASK); - return 0; - -+ case PT_AR_RSC: -+ if (write_access) -+ pt->ar_rsc = *data | (3 << 2); /* force PL3 */ -+ else -+ *data = pt->ar_rsc; -+ return 0; -+ - case PT_AR_RNAT: - urbs_end = ia64_get_user_rbs_end(child, pt, NULL); - rnat_addr = (long) ia64_rse_rnat_addr((long *) -@@ -996,9 +1003,6 @@ access_uarea (struct task_struct *child, - case PT_AR_BSPSTORE: - ptr = pt_reg_addr(pt, ar_bspstore); - break; -- case PT_AR_RSC: -- ptr = pt_reg_addr(pt, ar_rsc); -- break; - case PT_AR_UNAT: - ptr = pt_reg_addr(pt, ar_unat); - break; -@@ -1234,7 +1238,7 @@ ptrace_getregs (struct task_struct *chil - static long - ptrace_setregs (struct task_struct *child, struct pt_all_user_regs __user *ppr) - { -- unsigned long psr, ec, lc, rnat, bsp, cfm, nat_bits, val = 0; -+ unsigned long psr, rsc, ec, lc, rnat, bsp, cfm, nat_bits, val = 0; - struct unw_frame_info info; - struct switch_stack *sw; - struct ia64_fpreg fpval; -@@ -1267,7 +1271,7 @@ ptrace_setregs (struct task_struct *chil - /* app regs */ - - retval |= __get_user(pt->ar_pfs, &ppr->ar[PT_AUR_PFS]); -- retval |= __get_user(pt->ar_rsc, &ppr->ar[PT_AUR_RSC]); -+ retval |= __get_user(rsc, &ppr->ar[PT_AUR_RSC]); - retval |= __get_user(pt->ar_bspstore, &ppr->ar[PT_AUR_BSPSTORE]); - retval |= __get_user(pt->ar_unat, &ppr->ar[PT_AUR_UNAT]); - retval |= __get_user(pt->ar_ccv, &ppr->ar[PT_AUR_CCV]); -@@ -1365,6 +1369,7 @@ ptrace_setregs (struct task_struct *chil - retval |= __get_user(nat_bits, &ppr->nat); - - retval |= access_uarea(child, PT_CR_IPSR, &psr, 1); -+ retval |= access_uarea(child, PT_AR_RSC, &rsc, 1); - retval |= access_uarea(child, PT_AR_EC, &ec, 1); - retval |= access_uarea(child, PT_AR_LC, &lc, 1); - retval |= access_uarea(child, PT_AR_RNAT, &rnat, 1); -diff --git a/arch/ia64/kernel/signal.c b/arch/ia64/kernel/signal.c ---- a/arch/ia64/kernel/signal.c -+++ b/arch/ia64/kernel/signal.c -@@ -94,7 +94,7 @@ sys_sigaltstack (const stack_t __user *u - static long - restore_sigcontext (struct sigcontext __user *sc, struct sigscratch *scr) - { -- unsigned long ip, flags, nat, um, cfm; -+ unsigned long ip, flags, nat, um, cfm, rsc; - long err; - - /* Always make any pending restarted system calls return -EINTR */ -@@ -106,7 +106,7 @@ restore_sigcontext (struct sigcontext __ - err |= __get_user(ip, &sc->sc_ip); /* instruction pointer */ - err |= __get_user(cfm, &sc->sc_cfm); - err |= __get_user(um, &sc->sc_um); /* user mask */ -- err |= __get_user(scr->pt.ar_rsc, &sc->sc_ar_rsc); -+ err |= __get_user(rsc, &sc->sc_ar_rsc); - err |= __get_user(scr->pt.ar_unat, &sc->sc_ar_unat); - err |= __get_user(scr->pt.ar_fpsr, &sc->sc_ar_fpsr); - err |= __get_user(scr->pt.ar_pfs, &sc->sc_ar_pfs); -@@ -119,6 +119,7 @@ restore_sigcontext (struct sigcontext __ - err |= __copy_from_user(&scr->pt.r15, &sc->sc_gr[15], 8); /* r15 */ - - scr->pt.cr_ifs = cfm | (1UL << 63); -+ scr->pt.ar_rsc = rsc | (3 << 2); /* force PL3 */ - - /* establish new instruction pointer: */ - scr->pt.cr_iip = ip & ~0x3UL; -diff --git a/arch/ppc/kernel/time.c b/arch/ppc/kernel/time.c ---- a/arch/ppc/kernel/time.c -+++ b/arch/ppc/kernel/time.c -@@ -89,6 +89,9 @@ unsigned long tb_to_ns_scale; - - extern unsigned long wall_jiffies; - -+/* used for timezone offset */ -+static long timezone_offset; -+ - DEFINE_SPINLOCK(rtc_lock); - - EXPORT_SYMBOL(rtc_lock); -@@ -170,7 +173,7 @@ void timer_interrupt(struct pt_regs * re - xtime.tv_sec - last_rtc_update >= 659 && - abs((xtime.tv_nsec / 1000) - (1000000-1000000/HZ)) < 500000/HZ && - jiffies - wall_jiffies == 1) { -- if (ppc_md.set_rtc_time(xtime.tv_sec+1 + time_offset) == 0) -+ if (ppc_md.set_rtc_time(xtime.tv_sec+1 + timezone_offset) == 0) - last_rtc_update = xtime.tv_sec+1; - else - /* Try again one minute later */ -@@ -286,7 +289,7 @@ void __init time_init(void) - unsigned old_stamp, stamp, elapsed; - - if (ppc_md.time_init != NULL) -- time_offset = ppc_md.time_init(); -+ timezone_offset = ppc_md.time_init(); - - if (__USE_RTC()) { - /* 601 processor: dec counts down by 128 every 128ns */ -@@ -331,10 +334,10 @@ void __init time_init(void) - set_dec(tb_ticks_per_jiffy); - - /* If platform provided a timezone (pmac), we correct the time */ -- if (time_offset) { -- sys_tz.tz_minuteswest = -time_offset / 60; -+ if (timezone_offset) { -+ sys_tz.tz_minuteswest = -timezone_offset / 60; - sys_tz.tz_dsttime = 0; -- xtime.tv_sec -= time_offset; -+ xtime.tv_sec -= timezone_offset; - } - set_normalized_timespec(&wall_to_monotonic, - -xtime.tv_sec, -xtime.tv_nsec); -diff --git a/arch/ppc64/boot/zlib.c b/arch/ppc64/boot/zlib.c ---- a/arch/ppc64/boot/zlib.c -+++ b/arch/ppc64/boot/zlib.c -@@ -1307,7 +1307,7 @@ local int huft_build( - { - *t = (inflate_huft *)Z_NULL; - *m = 0; -- return Z_OK; -+ return Z_DATA_ERROR; - } - - -@@ -1351,6 +1351,7 @@ local int huft_build( - if ((j = *p++) != 0) - v[x[j]++] = i; - } while (++i < n); -+ n = x[g]; /* set n to length of v */ - - - /* Generate the Huffman codes and for each, make the table entries */ -diff --git a/arch/um/kernel/process.c b/arch/um/kernel/process.c ---- a/arch/um/kernel/process.c -+++ b/arch/um/kernel/process.c -@@ -130,7 +130,7 @@ int start_fork_tramp(void *thread_arg, u - return(arg.pid); - } - --static int ptrace_child(void) -+static int ptrace_child(void *arg) - { - int ret; - int pid = os_getpid(), ppid = getppid(); -@@ -159,16 +159,20 @@ static int ptrace_child(void) - _exit(ret); - } - --static int start_ptraced_child(void) -+static int start_ptraced_child(void **stack_out) - { -+ void *stack; -+ unsigned long sp; - int pid, n, status; - -- pid = fork(); -- if(pid == 0) -- ptrace_child(); -- -+ stack = mmap(NULL, PAGE_SIZE, PROT_READ | PROT_WRITE | PROT_EXEC, -+ MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); -+ if(stack == MAP_FAILED) -+ panic("check_ptrace : mmap failed, errno = %d", errno); -+ sp = (unsigned long) stack + PAGE_SIZE - sizeof(void *); -+ pid = clone(ptrace_child, (void *) sp, SIGCHLD, NULL); - if(pid < 0) -- panic("check_ptrace : fork failed, errno = %d", errno); -+ panic("check_ptrace : clone failed, errno = %d", errno); - CATCH_EINTR(n = waitpid(pid, &status, WUNTRACED)); - if(n < 0) - panic("check_ptrace : wait failed, errno = %d", errno); -@@ -176,6 +180,7 @@ static int start_ptraced_child(void) - panic("check_ptrace : expected SIGSTOP, got status = %d", - status); - -+ *stack_out = stack; - return(pid); - } - -@@ -183,12 +188,12 @@ static int start_ptraced_child(void) - * just avoid using sysemu, not panic, but only if SYSEMU features are broken. - * So only for SYSEMU features we test mustpanic, while normal host features - * must work anyway!*/ --static int stop_ptraced_child(int pid, int exitcode, int mustexit) -+static int stop_ptraced_child(int pid, void *stack, int exitcode, int mustpanic) - { - int status, n, ret = 0; - - if(ptrace(PTRACE_CONT, pid, 0, 0) < 0) -- panic("stop_ptraced_child : ptrace failed, errno = %d", errno); -+ panic("check_ptrace : ptrace failed, errno = %d", errno); - CATCH_EINTR(n = waitpid(pid, &status, 0)); - if(!WIFEXITED(status) || (WEXITSTATUS(status) != exitcode)) { - int exit_with = WEXITSTATUS(status); -@@ -199,13 +204,15 @@ static int stop_ptraced_child(int pid, i - printk("check_ptrace : child exited with exitcode %d, while " - "expecting %d; status 0x%x", exit_with, - exitcode, status); -- if (mustexit) -+ if (mustpanic) - panic("\n"); - else - printk("\n"); - ret = -1; - } - -+ if(munmap(stack, PAGE_SIZE) < 0) -+ panic("check_ptrace : munmap failed, errno = %d", errno); - return ret; - } - -@@ -227,11 +234,12 @@ __uml_setup("nosysemu", nosysemu_cmd_par - - static void __init check_sysemu(void) - { -+ void *stack; - int pid, syscall, n, status, count=0; - - printk("Checking syscall emulation patch for ptrace..."); - sysemu_supported = 0; -- pid = start_ptraced_child(); -+ pid = start_ptraced_child(&stack); - - if(ptrace(PTRACE_SYSEMU, pid, 0, 0) < 0) - goto fail; -@@ -249,7 +257,7 @@ static void __init check_sysemu(void) - panic("check_sysemu : failed to modify system " - "call return, errno = %d", errno); - -- if (stop_ptraced_child(pid, 0, 0) < 0) -+ if (stop_ptraced_child(pid, stack, 0, 0) < 0) - goto fail_stopped; - - sysemu_supported = 1; -@@ -257,7 +265,7 @@ static void __init check_sysemu(void) - set_using_sysemu(!force_sysemu_disabled); - - printk("Checking advanced syscall emulation patch for ptrace..."); -- pid = start_ptraced_child(); -+ pid = start_ptraced_child(&stack); - while(1){ - count++; - if(ptrace(PTRACE_SYSEMU_SINGLESTEP, pid, 0, 0) < 0) -@@ -282,7 +290,7 @@ static void __init check_sysemu(void) - break; - } - } -- if (stop_ptraced_child(pid, 0, 0) < 0) -+ if (stop_ptraced_child(pid, stack, 0, 0) < 0) - goto fail_stopped; - - sysemu_supported = 2; -@@ -293,17 +301,18 @@ static void __init check_sysemu(void) - return; - - fail: -- stop_ptraced_child(pid, 1, 0); -+ stop_ptraced_child(pid, stack, 1, 0); - fail_stopped: - printk("missing\n"); - } - - void __init check_ptrace(void) - { -+ void *stack; - int pid, syscall, n, status; - - printk("Checking that ptrace can change system call numbers..."); -- pid = start_ptraced_child(); -+ pid = start_ptraced_child(&stack); - - if (ptrace(PTRACE_OLDSETOPTIONS, pid, 0, (void *)PTRACE_O_TRACESYSGOOD) < 0) - panic("check_ptrace: PTRACE_SETOPTIONS failed, errno = %d", errno); -@@ -330,7 +339,7 @@ void __init check_ptrace(void) - break; - } - } -- stop_ptraced_child(pid, 0, 1); -+ stop_ptraced_child(pid, stack, 0, 1); - printk("OK\n"); - check_sysemu(); - } -@@ -362,10 +371,11 @@ void forward_pending_sigio(int target) - static inline int check_skas3_ptrace_support(void) - { - struct ptrace_faultinfo fi; -+ void *stack; - int pid, n, ret = 1; - - printf("Checking for the skas3 patch in the host..."); -- pid = start_ptraced_child(); -+ pid = start_ptraced_child(&stack); - - n = ptrace(PTRACE_FAULTINFO, pid, 0, &fi); - if (n < 0) { -@@ -380,7 +390,7 @@ static inline int check_skas3_ptrace_sup - } - - init_registers(pid); -- stop_ptraced_child(pid, 1, 1); -+ stop_ptraced_child(pid, stack, 1, 1); - - return(ret); - } -diff --git a/arch/x86_64/ia32/syscall32.c b/arch/x86_64/ia32/syscall32.c ---- a/arch/x86_64/ia32/syscall32.c -+++ b/arch/x86_64/ia32/syscall32.c -@@ -57,6 +57,7 @@ int syscall32_setup_pages(struct linux_b - int npages = (VSYSCALL32_END - VSYSCALL32_BASE) >> PAGE_SHIFT; - struct vm_area_struct *vma; - struct mm_struct *mm = current->mm; -+ int ret; - - vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); - if (!vma) -@@ -78,7 +79,11 @@ int syscall32_setup_pages(struct linux_b - vma->vm_mm = mm; - - down_write(&mm->mmap_sem); -- insert_vm_struct(mm, vma); -+ if ((ret = insert_vm_struct(mm, vma))) { -+ up_write(&mm->mmap_sem); -+ kmem_cache_free(vm_area_cachep, vma); -+ return ret; -+ } - mm->total_vm += npages; - up_write(&mm->mmap_sem); - return 0; -diff --git a/arch/x86_64/kernel/setup.c b/arch/x86_64/kernel/setup.c ---- a/arch/x86_64/kernel/setup.c -+++ b/arch/x86_64/kernel/setup.c -@@ -729,8 +729,6 @@ static void __init amd_detect_cmp(struct - int cpu = smp_processor_id(); - int node = 0; - unsigned bits; -- if (c->x86_num_cores == 1) -- return; - - bits = 0; - while ((1 << bits) < c->x86_num_cores) -diff --git a/arch/x86_64/kernel/smp.c b/arch/x86_64/kernel/smp.c ---- a/arch/x86_64/kernel/smp.c -+++ b/arch/x86_64/kernel/smp.c -@@ -284,6 +284,71 @@ struct call_data_struct { - static struct call_data_struct * call_data; - - /* -+ * this function sends a 'generic call function' IPI to one other CPU -+ * in the system. -+ */ -+static void __smp_call_function_single (int cpu, void (*func) (void *info), void *info, -+ int nonatomic, int wait) -+{ -+ struct call_data_struct data; -+ int cpus = 1; -+ -+ data.func = func; -+ data.info = info; -+ atomic_set(&data.started, 0); -+ data.wait = wait; -+ if (wait) -+ atomic_set(&data.finished, 0); -+ -+ call_data = &data; -+ wmb(); -+ /* Send a message to all other CPUs and wait for them to respond */ -+ send_IPI_mask(cpumask_of_cpu(cpu), CALL_FUNCTION_VECTOR); -+ -+ /* Wait for response */ -+ while (atomic_read(&data.started) != cpus) -+ cpu_relax(); -+ -+ if (!wait) -+ return; -+ -+ while (atomic_read(&data.finished) != cpus) -+ cpu_relax(); -+} -+ -+/* -+ * Run a function on another CPU -+ * The function to run. This must be fast and non-blocking. -+ * An arbitrary pointer to pass to the function. -+ * Currently unused. -+ * If true, wait until function has completed on other CPUs. -+ * [RETURNS] 0 on success, else a negative status code. -+ * -+ * Does not return until the remote CPU is nearly ready to execute -+ * or is or has executed. -+ */ -+ -+int smp_call_function_single (int cpu, void (*func) (void *info), void *info, -+ int nonatomic, int wait) -+{ -+ -+ int me = get_cpu(); /* prevent preemption and reschedule on another processor */ -+ -+ if (cpu == me) { -+ printk("%s: trying to call self\n", __func__); -+ put_cpu(); -+ return -EBUSY; -+ } -+ spin_lock_bh(&call_lock); -+ -+ __smp_call_function_single(cpu, func,info,nonatomic,wait); -+ -+ spin_unlock_bh(&call_lock); -+ put_cpu(); -+ return 0; -+} -+ -+/* - * this function sends a 'generic call function' IPI to all other CPUs - * in the system. - */ -diff --git a/arch/x86_64/kernel/smpboot.c b/arch/x86_64/kernel/smpboot.c ---- a/arch/x86_64/kernel/smpboot.c -+++ b/arch/x86_64/kernel/smpboot.c -@@ -202,9 +202,6 @@ static __cpuinit void sync_master(void * - { - unsigned long flags, i; - -- if (smp_processor_id() != boot_cpu_id) -- return; -- - go[MASTER] = 0; - - local_irq_save(flags); -@@ -253,7 +250,7 @@ get_delta(long *rt, long *master) - return tcenter - best_tm; - } - --static __cpuinit void sync_tsc(void) -+static __cpuinit void sync_tsc(unsigned int master) - { - int i, done = 0; - long delta, adj, adjust_latency = 0; -@@ -267,9 +264,17 @@ static __cpuinit void sync_tsc(void) - } t[NUM_ROUNDS] __cpuinitdata; - #endif - -+ printk(KERN_INFO "CPU %d: Syncing TSC to CPU %u.\n", -+ smp_processor_id(), master); -+ - go[MASTER] = 1; - -- smp_call_function(sync_master, NULL, 1, 0); -+ /* It is dangerous to broadcast IPI as cpus are coming up, -+ * as they may not be ready to accept them. So since -+ * we only need to send the ipi to the boot cpu direct -+ * the message, and avoid the race. -+ */ -+ smp_call_function_single(master, sync_master, NULL, 1, 0); - - while (go[MASTER]) /* wait for master to be ready */ - no_cpu_relax(); -@@ -313,16 +318,14 @@ static __cpuinit void sync_tsc(void) - printk(KERN_INFO - "CPU %d: synchronized TSC with CPU %u (last diff %ld cycles, " - "maxerr %lu cycles)\n", -- smp_processor_id(), boot_cpu_id, delta, rt); -+ smp_processor_id(), master, delta, rt); - } - - static void __cpuinit tsc_sync_wait(void) - { - if (notscsync || !cpu_has_tsc) - return; -- printk(KERN_INFO "CPU %d: Syncing TSC to CPU %u.\n", smp_processor_id(), -- boot_cpu_id); -- sync_tsc(); -+ sync_tsc(0); - } - - static __init int notscsync_setup(char *s) -diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c ---- a/drivers/acpi/pci_irq.c -+++ b/drivers/acpi/pci_irq.c -@@ -433,8 +433,9 @@ acpi_pci_irq_enable ( - printk(KERN_WARNING PREFIX "PCI Interrupt %s[%c]: no GSI", - pci_name(dev), ('A' + pin)); - /* Interrupt Line values above 0xF are forbidden */ -- if (dev->irq >= 0 && (dev->irq <= 0xF)) { -+ if (dev->irq > 0 && (dev->irq <= 0xF)) { - printk(" - using IRQ %d\n", dev->irq); -+ acpi_register_gsi(dev->irq, ACPI_LEVEL_SENSITIVE, ACPI_ACTIVE_LOW); - return_VALUE(0); - } - else { -diff --git a/drivers/char/rocket.c b/drivers/char/rocket.c ---- a/drivers/char/rocket.c -+++ b/drivers/char/rocket.c -@@ -277,7 +277,7 @@ static void rp_do_receive(struct r_port - ToRecv = space; - - if (ToRecv <= 0) -- return; -+ goto done; - - /* - * if status indicates there are errored characters in the -@@ -359,6 +359,7 @@ static void rp_do_receive(struct r_port - } - /* Push the data up to the tty layer */ - ld->receive_buf(tty, tty->flip.char_buf, tty->flip.flag_buf, count); -+done: - tty_ldisc_deref(ld); - } - -diff --git a/drivers/char/tpm/tpm.c b/drivers/char/tpm/tpm.c ---- a/drivers/char/tpm/tpm.c -+++ b/drivers/char/tpm/tpm.c -@@ -32,12 +32,6 @@ - - #define TPM_BUFSIZE 2048 - --/* PCI configuration addresses */ --#define PCI_GEN_PMCON_1 0xA0 --#define PCI_GEN1_DEC 0xE4 --#define PCI_LPC_EN 0xE6 --#define PCI_GEN2_DEC 0xEC -- - static LIST_HEAD(tpm_chip_list); - static DEFINE_SPINLOCK(driver_lock); - static int dev_mask[32]; -@@ -61,72 +55,6 @@ void tpm_time_expired(unsigned long ptr) - EXPORT_SYMBOL_GPL(tpm_time_expired); - - /* -- * Initialize the LPC bus and enable the TPM ports -- */ --int tpm_lpc_bus_init(struct pci_dev *pci_dev, u16 base) --{ -- u32 lpcenable, tmp; -- int is_lpcm = 0; -- -- switch (pci_dev->vendor) { -- case PCI_VENDOR_ID_INTEL: -- switch (pci_dev->device) { -- case PCI_DEVICE_ID_INTEL_82801CA_12: -- case PCI_DEVICE_ID_INTEL_82801DB_12: -- is_lpcm = 1; -- break; -- } -- /* init ICH (enable LPC) */ -- pci_read_config_dword(pci_dev, PCI_GEN1_DEC, &lpcenable); -- lpcenable |= 0x20000000; -- pci_write_config_dword(pci_dev, PCI_GEN1_DEC, lpcenable); -- -- if (is_lpcm) { -- pci_read_config_dword(pci_dev, PCI_GEN1_DEC, -- &lpcenable); -- if ((lpcenable & 0x20000000) == 0) { -- dev_err(&pci_dev->dev, -- "cannot enable LPC\n"); -- return -ENODEV; -- } -- } -- -- /* initialize TPM registers */ -- pci_read_config_dword(pci_dev, PCI_GEN2_DEC, &tmp); -- -- if (!is_lpcm) -- tmp = (tmp & 0xFFFF0000) | (base & 0xFFF0); -- else -- tmp = -- (tmp & 0xFFFF0000) | (base & 0xFFF0) | -- 0x00000001; -- -- pci_write_config_dword(pci_dev, PCI_GEN2_DEC, tmp); -- -- if (is_lpcm) { -- pci_read_config_dword(pci_dev, PCI_GEN_PMCON_1, -- &tmp); -- tmp |= 0x00000004; /* enable CLKRUN */ -- pci_write_config_dword(pci_dev, PCI_GEN_PMCON_1, -- tmp); -- } -- tpm_write_index(0x0D, 0x55); /* unlock 4F */ -- tpm_write_index(0x0A, 0x00); /* int disable */ -- tpm_write_index(0x08, base); /* base addr lo */ -- tpm_write_index(0x09, (base & 0xFF00) >> 8); /* base addr hi */ -- tpm_write_index(0x0D, 0xAA); /* lock 4F */ -- break; -- case PCI_VENDOR_ID_AMD: -- /* nothing yet */ -- break; -- } -- -- return 0; --} -- --EXPORT_SYMBOL_GPL(tpm_lpc_bus_init); -- --/* - * Internal kernel interface to transmit TPM commands - */ - static ssize_t tpm_transmit(struct tpm_chip *chip, const char *buf, -@@ -590,10 +518,6 @@ int tpm_pm_resume(struct pci_dev *pci_de - if (chip == NULL) - return -ENODEV; - -- spin_lock(&driver_lock); -- tpm_lpc_bus_init(pci_dev, chip->vendor->base); -- spin_unlock(&driver_lock); -- - return 0; - } - -diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h ---- a/drivers/char/tpm/tpm.h -+++ b/drivers/char/tpm/tpm.h -@@ -79,8 +79,6 @@ static inline void tpm_write_index(int i - } - - extern void tpm_time_expired(unsigned long); --extern int tpm_lpc_bus_init(struct pci_dev *, u16); -- - extern int tpm_register_hardware(struct pci_dev *, - struct tpm_vendor_specific *); - extern int tpm_open(struct inode *, struct file *); -diff --git a/drivers/char/tpm/tpm_atmel.c b/drivers/char/tpm/tpm_atmel.c ---- a/drivers/char/tpm/tpm_atmel.c -+++ b/drivers/char/tpm/tpm_atmel.c -@@ -22,7 +22,10 @@ - #include "tpm.h" - - /* Atmel definitions */ --#define TPM_ATML_BASE 0x400 -+enum tpm_atmel_addr { -+ TPM_ATMEL_BASE_ADDR_LO = 0x08, -+ TPM_ATMEL_BASE_ADDR_HI = 0x09 -+}; - - /* write status bits */ - #define ATML_STATUS_ABORT 0x01 -@@ -127,7 +130,6 @@ static struct tpm_vendor_specific tpm_at - .cancel = tpm_atml_cancel, - .req_complete_mask = ATML_STATUS_BUSY | ATML_STATUS_DATA_AVAIL, - .req_complete_val = ATML_STATUS_DATA_AVAIL, -- .base = TPM_ATML_BASE, - .miscdev = { .fops = &atmel_ops, }, - }; - -@@ -136,14 +138,16 @@ static int __devinit tpm_atml_init(struc - { - u8 version[4]; - int rc = 0; -+ int lo, hi; - - if (pci_enable_device(pci_dev)) - return -EIO; - -- if (tpm_lpc_bus_init(pci_dev, TPM_ATML_BASE)) { -- rc = -ENODEV; -- goto out_err; -- } -+ lo = tpm_read_index( TPM_ATMEL_BASE_ADDR_LO ); -+ hi = tpm_read_index( TPM_ATMEL_BASE_ADDR_HI ); -+ -+ tpm_atmel.base = (hi<<8)|lo; -+ dev_dbg( &pci_dev->dev, "Operating with base: 0x%x\n", tpm_atmel.base); - - /* verify that it is an Atmel part */ - if (tpm_read_index(4) != 'A' || tpm_read_index(5) != 'T' -diff --git a/drivers/char/tpm/tpm_nsc.c b/drivers/char/tpm/tpm_nsc.c ---- a/drivers/char/tpm/tpm_nsc.c -+++ b/drivers/char/tpm/tpm_nsc.c -@@ -24,6 +24,10 @@ - /* National definitions */ - #define TPM_NSC_BASE 0x360 - #define TPM_NSC_IRQ 0x07 -+#define TPM_NSC_BASE0_HI 0x60 -+#define TPM_NSC_BASE0_LO 0x61 -+#define TPM_NSC_BASE1_HI 0x62 -+#define TPM_NSC_BASE1_LO 0x63 - - #define NSC_LDN_INDEX 0x07 - #define NSC_SID_INDEX 0x20 -@@ -234,7 +238,6 @@ static struct tpm_vendor_specific tpm_ns - .cancel = tpm_nsc_cancel, - .req_complete_mask = NSC_STATUS_OBF, - .req_complete_val = NSC_STATUS_OBF, -- .base = TPM_NSC_BASE, - .miscdev = { .fops = &nsc_ops, }, - - }; -@@ -243,15 +246,16 @@ static int __devinit tpm_nsc_init(struct - const struct pci_device_id *pci_id) - { - int rc = 0; -+ int lo, hi; -+ -+ hi = tpm_read_index(TPM_NSC_BASE0_HI); -+ lo = tpm_read_index(TPM_NSC_BASE0_LO); -+ -+ tpm_nsc.base = (hi<<8) | lo; - - if (pci_enable_device(pci_dev)) - return -EIO; - -- if (tpm_lpc_bus_init(pci_dev, TPM_NSC_BASE)) { -- rc = -ENODEV; -- goto out_err; -- } -- - /* verify that it is a National part (SID) */ - if (tpm_read_index(NSC_SID_INDEX) != 0xEF) { - rc = -ENODEV; -diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c ---- a/drivers/char/tty_ioctl.c -+++ b/drivers/char/tty_ioctl.c -@@ -476,11 +476,11 @@ int n_tty_ioctl(struct tty_struct * tty, - ld = tty_ldisc_ref(tty); - switch (arg) { - case TCIFLUSH: -- if (ld->flush_buffer) -+ if (ld && ld->flush_buffer) - ld->flush_buffer(tty); - break; - case TCIOFLUSH: -- if (ld->flush_buffer) -+ if (ld && ld->flush_buffer) - ld->flush_buffer(tty); - /* fall through */ - case TCOFLUSH: -diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c ---- a/drivers/media/video/cx88/cx88-video.c -+++ b/drivers/media/video/cx88/cx88-video.c -@@ -261,7 +261,7 @@ static struct cx88_ctrl cx8800_ctls[] = - .default_value = 0, - .type = V4L2_CTRL_TYPE_INTEGER, - }, -- .off = 0, -+ .off = 128, - .reg = MO_HUE, - .mask = 0x00ff, - .shift = 0, -diff --git a/drivers/net/e1000/e1000_main.c b/drivers/net/e1000/e1000_main.c ---- a/drivers/net/e1000/e1000_main.c -+++ b/drivers/net/e1000/e1000_main.c -@@ -2307,6 +2307,7 @@ e1000_xmit_frame(struct sk_buff *skb, st - tso = e1000_tso(adapter, skb); - if (tso < 0) { - dev_kfree_skb_any(skb); -+ spin_unlock_irqrestore(&adapter->tx_lock, flags); - return NETDEV_TX_OK; - } - -diff --git a/drivers/net/hamradio/Kconfig b/drivers/net/hamradio/Kconfig ---- a/drivers/net/hamradio/Kconfig -+++ b/drivers/net/hamradio/Kconfig -@@ -17,7 +17,7 @@ config MKISS - - config 6PACK - tristate "Serial port 6PACK driver" -- depends on AX25 && BROKEN_ON_SMP -+ depends on AX25 - ---help--- - 6pack is a transmission protocol for the data exchange between your - PC and your TNC (the Terminal Node Controller acts as a kind of -diff --git a/drivers/net/shaper.c b/drivers/net/shaper.c ---- a/drivers/net/shaper.c -+++ b/drivers/net/shaper.c -@@ -135,10 +135,8 @@ static int shaper_start_xmit(struct sk_b - { - struct shaper *shaper = dev->priv; - struct sk_buff *ptr; -- -- if (down_trylock(&shaper->sem)) -- return -1; - -+ spin_lock(&shaper->lock); - ptr=shaper->sendq.prev; - - /* -@@ -232,7 +230,7 @@ static int shaper_start_xmit(struct sk_b - shaper->stats.collisions++; - } - shaper_kick(shaper); -- up(&shaper->sem); -+ spin_unlock(&shaper->lock); - return 0; - } - -@@ -271,11 +269,9 @@ static void shaper_timer(unsigned long d - { - struct shaper *shaper = (struct shaper *)data; - -- if (!down_trylock(&shaper->sem)) { -- shaper_kick(shaper); -- up(&shaper->sem); -- } else -- mod_timer(&shaper->timer, jiffies); -+ spin_lock(&shaper->lock); -+ shaper_kick(shaper); -+ spin_unlock(&shaper->lock); - } - - /* -@@ -332,21 +328,6 @@ static void shaper_kick(struct shaper *s - - - /* -- * Flush the shaper queues on a closedown -- */ -- --static void shaper_flush(struct shaper *shaper) --{ -- struct sk_buff *skb; -- -- down(&shaper->sem); -- while((skb=skb_dequeue(&shaper->sendq))!=NULL) -- dev_kfree_skb(skb); -- shaper_kick(shaper); -- up(&shaper->sem); --} -- --/* - * Bring the interface up. We just disallow this until a - * bind. - */ -@@ -375,7 +356,15 @@ static int shaper_open(struct net_device - static int shaper_close(struct net_device *dev) - { - struct shaper *shaper=dev->priv; -- shaper_flush(shaper); -+ struct sk_buff *skb; -+ -+ while ((skb = skb_dequeue(&shaper->sendq)) != NULL) -+ dev_kfree_skb(skb); -+ -+ spin_lock_bh(&shaper->lock); -+ shaper_kick(shaper); -+ spin_unlock_bh(&shaper->lock); -+ - del_timer_sync(&shaper->timer); - return 0; - } -@@ -576,6 +565,7 @@ static void shaper_init_priv(struct net_ - init_timer(&sh->timer); - sh->timer.function=shaper_timer; - sh->timer.data=(unsigned long)sh; -+ spin_lock_init(&sh->lock); - } - - /* -diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c ---- a/drivers/pci/pci-driver.c -+++ b/drivers/pci/pci-driver.c -@@ -396,7 +396,7 @@ int pci_register_driver(struct pci_drive - /* FIXME, once all of the existing PCI drivers have been fixed to set - * the pci shutdown function, this test can go away. */ - if (!drv->driver.shutdown) -- drv->driver.shutdown = pci_device_shutdown, -+ drv->driver.shutdown = pci_device_shutdown; - drv->driver.owner = drv->owner; - drv->driver.kobj.ktype = &pci_driver_kobj_type; - pci_init_dynids(&drv->dynids); -diff --git a/drivers/scsi/qla2xxx/qla_init.c b/drivers/scsi/qla2xxx/qla_init.c ---- a/drivers/scsi/qla2xxx/qla_init.c -+++ b/drivers/scsi/qla2xxx/qla_init.c -@@ -1914,9 +1914,11 @@ qla2x00_reg_remote_port(scsi_qla_host_t - rport_ids.roles |= FC_RPORT_ROLE_FCP_TARGET; - - fcport->rport = rport = fc_remote_port_add(ha->host, 0, &rport_ids); -- if (!rport) -+ if (!rport) { - qla_printk(KERN_WARNING, ha, - "Unable to allocate fc remote port!\n"); -+ return; -+ } - - if (rport->scsi_target_id != -1 && rport->scsi_target_id < MAX_TARGETS) - fcport->os_target_id = rport->scsi_target_id; -diff --git a/drivers/scsi/qla2xxx/qla_os.c b/drivers/scsi/qla2xxx/qla_os.c ---- a/drivers/scsi/qla2xxx/qla_os.c -+++ b/drivers/scsi/qla2xxx/qla_os.c -@@ -1150,7 +1150,7 @@ iospace_error_exit: - */ - int qla2x00_probe_one(struct pci_dev *pdev, struct qla_board_info *brd_info) - { -- int ret; -+ int ret = -ENODEV; - device_reg_t __iomem *reg; - struct Scsi_Host *host; - scsi_qla_host_t *ha; -@@ -1161,7 +1161,7 @@ int qla2x00_probe_one(struct pci_dev *pd - fc_port_t *fcport; - - if (pci_enable_device(pdev)) -- return -1; -+ goto probe_out; - - host = scsi_host_alloc(&qla2x00_driver_template, - sizeof(scsi_qla_host_t)); -@@ -1183,9 +1183,8 @@ int qla2x00_probe_one(struct pci_dev *pd - - /* Configure PCI I/O space */ - ret = qla2x00_iospace_config(ha); -- if (ret != 0) { -- goto probe_alloc_failed; -- } -+ if (ret) -+ goto probe_failed; - - /* Sanitize the information from PCI BIOS. */ - host->irq = pdev->irq; -@@ -1258,23 +1257,10 @@ int qla2x00_probe_one(struct pci_dev *pd - qla_printk(KERN_WARNING, ha, - "[ERROR] Failed to allocate memory for adapter\n"); - -- goto probe_alloc_failed; -+ ret = -ENOMEM; -+ goto probe_failed; - } - -- pci_set_drvdata(pdev, ha); -- host->this_id = 255; -- host->cmd_per_lun = 3; -- host->unique_id = ha->instance; -- host->max_cmd_len = MAX_CMDSZ; -- host->max_channel = ha->ports - 1; -- host->max_id = ha->max_targets; -- host->max_lun = ha->max_luns; -- host->transportt = qla2xxx_transport_template; -- if (scsi_add_host(host, &pdev->dev)) -- goto probe_alloc_failed; -- -- qla2x00_alloc_sysfs_attr(ha); -- - if (qla2x00_initialize_adapter(ha) && - !(ha->device_flags & DFLG_NO_CABLE)) { - -@@ -1285,11 +1271,10 @@ int qla2x00_probe_one(struct pci_dev *pd - "Adapter flags %x.\n", - ha->host_no, ha->device_flags)); - -+ ret = -ENODEV; - goto probe_failed; - } - -- qla2x00_init_host_attr(ha); -- - /* - * Startup the kernel thread for this host adapter - */ -@@ -1299,17 +1284,26 @@ int qla2x00_probe_one(struct pci_dev *pd - qla_printk(KERN_WARNING, ha, - "Unable to start DPC thread!\n"); - -+ ret = -ENODEV; - goto probe_failed; - } - wait_for_completion(&ha->dpc_inited); - -+ host->this_id = 255; -+ host->cmd_per_lun = 3; -+ host->unique_id = ha->instance; -+ host->max_cmd_len = MAX_CMDSZ; -+ host->max_channel = ha->ports - 1; -+ host->max_lun = MAX_LUNS; -+ host->transportt = qla2xxx_transport_template; -+ - if (IS_QLA2100(ha) || IS_QLA2200(ha)) - ret = request_irq(host->irq, qla2100_intr_handler, - SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); - else - ret = request_irq(host->irq, qla2300_intr_handler, - SA_INTERRUPT|SA_SHIRQ, ha->brd_info->drv_name, ha); -- if (ret != 0) { -+ if (ret) { - qla_printk(KERN_WARNING, ha, - "Failed to reserve interrupt %d already in use.\n", - host->irq); -@@ -1363,9 +1357,18 @@ int qla2x00_probe_one(struct pci_dev *pd - msleep(10); - } - -+ pci_set_drvdata(pdev, ha); - ha->flags.init_done = 1; - num_hosts++; - -+ ret = scsi_add_host(host, &pdev->dev); -+ if (ret) -+ goto probe_failed; -+ -+ qla2x00_alloc_sysfs_attr(ha); -+ -+ qla2x00_init_host_attr(ha); -+ - qla_printk(KERN_INFO, ha, "\n" - " QLogic Fibre Channel HBA Driver: %s\n" - " QLogic %s - %s\n" -@@ -1384,9 +1387,6 @@ int qla2x00_probe_one(struct pci_dev *pd - probe_failed: - fc_remove_host(ha->host); - -- scsi_remove_host(host); -- --probe_alloc_failed: - qla2x00_free_device(ha); - - scsi_host_put(host); -@@ -1394,7 +1394,8 @@ probe_alloc_failed: - probe_disable_device: - pci_disable_device(pdev); - -- return -1; -+probe_out: -+ return ret; - } - EXPORT_SYMBOL_GPL(qla2x00_probe_one); - -diff --git a/drivers/scsi/sg.c b/drivers/scsi/sg.c ---- a/drivers/scsi/sg.c -+++ b/drivers/scsi/sg.c -@@ -2969,23 +2969,22 @@ static void * dev_seq_start(struct seq_f - { - struct sg_proc_deviter * it = kmalloc(sizeof(*it), GFP_KERNEL); - -+ s->private = it; - if (! it) - return NULL; -+ - if (NULL == sg_dev_arr) -- goto err1; -+ return NULL; - it->index = *pos; - it->max = sg_last_dev(); - if (it->index >= it->max) -- goto err1; -+ return NULL; - return it; --err1: -- kfree(it); -- return NULL; - } - - static void * dev_seq_next(struct seq_file *s, void *v, loff_t *pos) - { -- struct sg_proc_deviter * it = (struct sg_proc_deviter *) v; -+ struct sg_proc_deviter * it = s->private; - - *pos = ++it->index; - return (it->index < it->max) ? it : NULL; -@@ -2993,7 +2992,9 @@ static void * dev_seq_next(struct seq_fi - - static void dev_seq_stop(struct seq_file *s, void *v) - { -- kfree (v); -+ struct sg_proc_deviter * it = s->private; -+ -+ kfree (it); - } - - static int sg_proc_open_dev(struct inode *inode, struct file *file) -diff --git a/drivers/usb/net/usbnet.c b/drivers/usb/net/usbnet.c ---- a/drivers/usb/net/usbnet.c -+++ b/drivers/usb/net/usbnet.c -@@ -1922,7 +1922,7 @@ static int genelink_rx_fixup (struct usb - - // copy the packet data to the new skb - memcpy(skb_put(gl_skb, size), packet->packet_data, size); -- skb_return (dev, skb); -+ skb_return (dev, gl_skb); - } - - // advance to the next packet -diff --git a/fs/bio.c b/fs/bio.c ---- a/fs/bio.c -+++ b/fs/bio.c -@@ -261,6 +261,7 @@ inline void __bio_clone(struct bio *bio, - */ - bio->bi_vcnt = bio_src->bi_vcnt; - bio->bi_size = bio_src->bi_size; -+ bio->bi_idx = bio_src->bi_idx; - bio_phys_segments(q, bio); - bio_hw_segments(q, bio); - } -diff --git a/fs/char_dev.c b/fs/char_dev.c ---- a/fs/char_dev.c -+++ b/fs/char_dev.c -@@ -139,7 +139,7 @@ __unregister_chrdev_region(unsigned majo - struct char_device_struct *cd = NULL, **cp; - int i = major_to_index(major); - -- up(&chrdevs_lock); -+ down(&chrdevs_lock); - for (cp = &chrdevs[i]; *cp; cp = &(*cp)->next) - if ((*cp)->major == major && - (*cp)->baseminor == baseminor && -diff --git a/fs/exec.c b/fs/exec.c ---- a/fs/exec.c -+++ b/fs/exec.c -@@ -649,6 +649,7 @@ static inline int de_thread(struct task_ - } - sig->group_exit_task = NULL; - sig->notify_count = 0; -+ sig->real_timer.data = (unsigned long)current; - spin_unlock_irq(lock); - - /* -diff --git a/fs/isofs/compress.c b/fs/isofs/compress.c ---- a/fs/isofs/compress.c -+++ b/fs/isofs/compress.c -@@ -129,8 +129,14 @@ static int zisofs_readpage(struct file * - cend = le32_to_cpu(*(__le32 *)(bh->b_data + (blockendptr & bufmask))); - brelse(bh); - -+ if (cstart > cend) -+ goto eio; -+ - csize = cend-cstart; - -+ if (csize > deflateBound(1UL << zisofs_block_shift)) -+ goto eio; -+ - /* Now page[] contains an array of pages, any of which can be NULL, - and the locks on which we hold. We should now read the data and - release the pages. If the pages are NULL the decompressed data -diff --git a/include/asm-i386/string.h b/include/asm-i386/string.h ---- a/include/asm-i386/string.h -+++ b/include/asm-i386/string.h -@@ -116,7 +116,8 @@ __asm__ __volatile__( - "orb $1,%%al\n" - "3:" - :"=a" (__res), "=&S" (d0), "=&D" (d1) -- :"1" (cs),"2" (ct)); -+ :"1" (cs),"2" (ct) -+ :"memory"); - return __res; - } - -@@ -138,8 +139,9 @@ __asm__ __volatile__( - "3:\tsbbl %%eax,%%eax\n\t" - "orb $1,%%al\n" - "4:" -- :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2) -- :"1" (cs),"2" (ct),"3" (count)); -+ :"=a" (__res), "=&S" (d0), "=&D" (d1), "=&c" (d2) -+ :"1" (cs),"2" (ct),"3" (count) -+ :"memory"); - return __res; - } - -@@ -158,7 +160,9 @@ __asm__ __volatile__( - "movl $1,%1\n" - "2:\tmovl %1,%0\n\t" - "decl %0" -- :"=a" (__res), "=&S" (d0) : "1" (s),"0" (c)); -+ :"=a" (__res), "=&S" (d0) -+ :"1" (s),"0" (c) -+ :"memory"); - return __res; - } - -@@ -175,7 +179,9 @@ __asm__ __volatile__( - "leal -1(%%esi),%0\n" - "2:\ttestb %%al,%%al\n\t" - "jne 1b" -- :"=g" (__res), "=&S" (d0), "=&a" (d1) :"0" (0),"1" (s),"2" (c)); -+ :"=g" (__res), "=&S" (d0), "=&a" (d1) -+ :"0" (0),"1" (s),"2" (c) -+ :"memory"); - return __res; - } - -@@ -189,7 +195,9 @@ __asm__ __volatile__( - "scasb\n\t" - "notl %0\n\t" - "decl %0" -- :"=c" (__res), "=&D" (d0) :"1" (s),"a" (0), "0" (0xffffffffu)); -+ :"=c" (__res), "=&D" (d0) -+ :"1" (s),"a" (0), "0" (0xffffffffu) -+ :"memory"); - return __res; - } - -@@ -333,7 +341,9 @@ __asm__ __volatile__( - "je 1f\n\t" - "movl $1,%0\n" - "1:\tdecl %0" -- :"=D" (__res), "=&c" (d0) : "a" (c),"0" (cs),"1" (count)); -+ :"=D" (__res), "=&c" (d0) -+ :"a" (c),"0" (cs),"1" (count) -+ :"memory"); - return __res; - } - -@@ -369,7 +379,7 @@ __asm__ __volatile__( - "je 2f\n\t" - "stosb\n" - "2:" -- : "=&c" (d0), "=&D" (d1) -+ :"=&c" (d0), "=&D" (d1) - :"a" (c), "q" (count), "0" (count/4), "1" ((long) s) - :"memory"); - return (s); -@@ -392,7 +402,8 @@ __asm__ __volatile__( - "jne 1b\n" - "3:\tsubl %2,%0" - :"=a" (__res), "=&d" (d0) -- :"c" (s),"1" (count)); -+ :"c" (s),"1" (count) -+ :"memory"); - return __res; - } - /* end of additional stuff */ -@@ -473,7 +484,8 @@ static inline void * memscan(void * addr - "dec %%edi\n" - "1:" - : "=D" (addr), "=c" (size) -- : "0" (addr), "1" (size), "a" (c)); -+ : "0" (addr), "1" (size), "a" (c) -+ : "memory"); - return addr; - } - -diff --git a/include/asm-x86_64/smp.h b/include/asm-x86_64/smp.h ---- a/include/asm-x86_64/smp.h -+++ b/include/asm-x86_64/smp.h -@@ -46,6 +46,8 @@ extern int pic_mode; - extern int smp_num_siblings; - extern void smp_flush_tlb(void); - extern void smp_message_irq(int cpl, void *dev_id, struct pt_regs *regs); -+extern int smp_call_function_single (int cpuid, void (*func) (void *info), void *info, -+ int retry, int wait); - extern void smp_send_reschedule(int cpu); - extern void smp_invalidate_rcv(void); /* Process an NMI */ - extern void zap_low_mappings(void); -diff --git a/include/linux/if_shaper.h b/include/linux/if_shaper.h ---- a/include/linux/if_shaper.h -+++ b/include/linux/if_shaper.h -@@ -23,7 +23,7 @@ struct shaper - __u32 shapeclock; - unsigned long recovery; /* Time we can next clock a packet out on - an empty queue */ -- struct semaphore sem; -+ spinlock_t lock; - struct net_device_stats stats; - struct net_device *dev; - int (*hard_start_xmit) (struct sk_buff *skb, -diff --git a/include/linux/skbuff.h b/include/linux/skbuff.h ---- a/include/linux/skbuff.h -+++ b/include/linux/skbuff.h -@@ -1192,7 +1192,7 @@ static inline void *skb_header_pointer(c - { - int hlen = skb_headlen(skb); - -- if (offset + len <= hlen) -+ if (hlen - offset >= len) - return skb->data + offset; - - if (skb_copy_bits(skb, offset, buffer, len) < 0) -diff --git a/include/linux/zlib.h b/include/linux/zlib.h ---- a/include/linux/zlib.h -+++ b/include/linux/zlib.h -@@ -506,6 +506,11 @@ extern int zlib_deflateReset (z_streamp - stream state was inconsistent (such as zalloc or state being NULL). - */ - -+static inline unsigned long deflateBound(unsigned long s) -+{ -+ return s + ((s + 7) >> 3) + ((s + 63) >> 6) + 11; -+} -+ - extern int zlib_deflateParams (z_streamp strm, int level, int strategy); - /* - Dynamically update the compression level and compression strategy. The -diff --git a/kernel/module.c b/kernel/module.c ---- a/kernel/module.c -+++ b/kernel/module.c -@@ -249,13 +249,18 @@ static inline unsigned int block_size(in - /* Created by linker magic */ - extern char __per_cpu_start[], __per_cpu_end[]; - --static void *percpu_modalloc(unsigned long size, unsigned long align) -+static void *percpu_modalloc(unsigned long size, unsigned long align, -+ const char *name) - { - unsigned long extra; - unsigned int i; - void *ptr; - -- BUG_ON(align > SMP_CACHE_BYTES); -+ if (align > SMP_CACHE_BYTES) { -+ printk(KERN_WARNING "%s: per-cpu alignment %li > %i\n", -+ name, align, SMP_CACHE_BYTES); -+ align = SMP_CACHE_BYTES; -+ } - - ptr = __per_cpu_start; - for (i = 0; i < pcpu_num_used; ptr += block_size(pcpu_size[i]), i++) { -@@ -347,7 +352,8 @@ static int percpu_modinit(void) - } - __initcall(percpu_modinit); - #else /* ... !CONFIG_SMP */ --static inline void *percpu_modalloc(unsigned long size, unsigned long align) -+static inline void *percpu_modalloc(unsigned long size, unsigned long align, -+ const char *name) - { - return NULL; - } -@@ -1554,7 +1560,8 @@ static struct module *load_module(void _ - if (pcpuindex) { - /* We have a special allocation for this section. */ - percpu = percpu_modalloc(sechdrs[pcpuindex].sh_size, -- sechdrs[pcpuindex].sh_addralign); -+ sechdrs[pcpuindex].sh_addralign, -+ mod->name); - if (!percpu) { - err = -ENOMEM; - goto free_mod; -diff --git a/kernel/signal.c b/kernel/signal.c ---- a/kernel/signal.c -+++ b/kernel/signal.c -@@ -686,7 +686,7 @@ static void handle_stop_signal(int sig, - { - struct task_struct *t; - -- if (p->flags & SIGNAL_GROUP_EXIT) -+ if (p->signal->flags & SIGNAL_GROUP_EXIT) - /* - * The process is in the middle of dying already. - */ -diff --git a/lib/inflate.c b/lib/inflate.c ---- a/lib/inflate.c -+++ b/lib/inflate.c -@@ -326,7 +326,7 @@ DEBG("huft1 "); - { - *t = (struct huft *)NULL; - *m = 0; -- return 0; -+ return 2; - } - - DEBG("huft2 "); -@@ -374,6 +374,7 @@ DEBG("huft5 "); - if ((j = *p++) != 0) - v[x[j]++] = i; - } while (++i < n); -+ n = x[g]; /* set n to length of v */ - - DEBG("h6 "); - -@@ -410,12 +411,13 @@ DEBG1("1 "); - DEBG1("2 "); - f -= a + 1; /* deduct codes from patterns left */ - xp = c + k; -- while (++j < z) /* try smaller tables up to z bits */ -- { -- if ((f <<= 1) <= *++xp) -- break; /* enough codes to use up j bits */ -- f -= *xp; /* else deduct codes from patterns */ -- } -+ if (j < z) -+ while (++j < z) /* try smaller tables up to z bits */ -+ { -+ if ((f <<= 1) <= *++xp) -+ break; /* enough codes to use up j bits */ -+ f -= *xp; /* else deduct codes from patterns */ -+ } - } - DEBG1("3 "); - z = 1 << j; /* table entries for j-bit table */ -diff --git a/mm/memory.c b/mm/memory.c ---- a/mm/memory.c -+++ b/mm/memory.c -@@ -1164,7 +1164,7 @@ int remap_pfn_range(struct vm_area_struc - { - pgd_t *pgd; - unsigned long next; -- unsigned long end = addr + size; -+ unsigned long end = addr + PAGE_ALIGN(size); - struct mm_struct *mm = vma->vm_mm; - int err; - -diff --git a/mm/mempolicy.c b/mm/mempolicy.c ---- a/mm/mempolicy.c -+++ b/mm/mempolicy.c -@@ -409,7 +409,7 @@ asmlinkage long sys_set_mempolicy(int mo - struct mempolicy *new; - DECLARE_BITMAP(nodes, MAX_NUMNODES); - -- if (mode > MPOL_MAX) -+ if (mode < 0 || mode > MPOL_MAX) - return -EINVAL; - err = get_nodes(nodes, nmask, maxnode, mode); - if (err) -diff --git a/net/8021q/vlan.c b/net/8021q/vlan.c ---- a/net/8021q/vlan.c -+++ b/net/8021q/vlan.c -@@ -578,6 +578,14 @@ static int vlan_device_event(struct noti - if (!vlandev) - continue; - -+ if (netif_carrier_ok(dev)) { -+ if (!netif_carrier_ok(vlandev)) -+ netif_carrier_on(vlandev); -+ } else { -+ if (netif_carrier_ok(vlandev)) -+ netif_carrier_off(vlandev); -+ } -+ - if ((vlandev->state & VLAN_LINK_STATE_MASK) != flgs) { - vlandev->state = (vlandev->state &~ VLAN_LINK_STATE_MASK) - | flgs; -diff --git a/net/ipv4/icmp.c b/net/ipv4/icmp.c ---- a/net/ipv4/icmp.c -+++ b/net/ipv4/icmp.c -@@ -349,12 +349,12 @@ static void icmp_push_reply(struct icmp_ - { - struct sk_buff *skb; - -- ip_append_data(icmp_socket->sk, icmp_glue_bits, icmp_param, -- icmp_param->data_len+icmp_param->head_len, -- icmp_param->head_len, -- ipc, rt, MSG_DONTWAIT); -- -- if ((skb = skb_peek(&icmp_socket->sk->sk_write_queue)) != NULL) { -+ if (ip_append_data(icmp_socket->sk, icmp_glue_bits, icmp_param, -+ icmp_param->data_len+icmp_param->head_len, -+ icmp_param->head_len, -+ ipc, rt, MSG_DONTWAIT) < 0) -+ ip_flush_pending_frames(icmp_socket->sk); -+ else if ((skb = skb_peek(&icmp_socket->sk->sk_write_queue)) != NULL) { - struct icmphdr *icmph = skb->h.icmph; - unsigned int csum = 0; - struct sk_buff *skb1; -diff --git a/net/ipv4/ip_output.c b/net/ipv4/ip_output.c ---- a/net/ipv4/ip_output.c -+++ b/net/ipv4/ip_output.c -@@ -111,7 +111,6 @@ static int ip_dev_loopback_xmit(struct s - #ifdef CONFIG_NETFILTER_DEBUG - nf_debug_ip_loopback_xmit(newskb); - #endif -- nf_reset(newskb); - netif_rx(newskb); - return 0; - } -@@ -196,8 +195,6 @@ static inline int ip_finish_output2(stru - nf_debug_ip_finish_output2(skb); - #endif /*CONFIG_NETFILTER_DEBUG*/ - -- nf_reset(skb); -- - if (hh) { - int hh_alen; - -diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c ---- a/net/ipv4/ip_sockglue.c -+++ b/net/ipv4/ip_sockglue.c -@@ -848,6 +848,9 @@ mc_msf_out: - - case IP_IPSEC_POLICY: - case IP_XFRM_POLICY: -+ err = -EPERM; -+ if (!capable(CAP_NET_ADMIN)) -+ break; - err = xfrm_user_policy(sk, optname, optval, optlen); - break; - -diff --git a/net/ipv4/netfilter/ip_conntrack_core.c b/net/ipv4/netfilter/ip_conntrack_core.c ---- a/net/ipv4/netfilter/ip_conntrack_core.c -+++ b/net/ipv4/netfilter/ip_conntrack_core.c -@@ -1124,6 +1124,9 @@ void ip_conntrack_cleanup(void) - schedule(); - goto i_see_dead_people; - } -+ /* wait until all references to ip_conntrack_untracked are dropped */ -+ while (atomic_read(&ip_conntrack_untracked.ct_general.use) > 1) -+ schedule(); - - kmem_cache_destroy(ip_conntrack_cachep); - kmem_cache_destroy(ip_conntrack_expect_cachep); -diff --git a/net/ipv4/netfilter/ip_conntrack_standalone.c b/net/ipv4/netfilter/ip_conntrack_standalone.c ---- a/net/ipv4/netfilter/ip_conntrack_standalone.c -+++ b/net/ipv4/netfilter/ip_conntrack_standalone.c -@@ -432,6 +432,13 @@ static unsigned int ip_conntrack_defrag( - const struct net_device *out, - int (*okfn)(struct sk_buff *)) - { -+#if !defined(CONFIG_IP_NF_NAT) && !defined(CONFIG_IP_NF_NAT_MODULE) -+ /* Previously seen (loopback)? Ignore. Do this before -+ fragment check. */ -+ if ((*pskb)->nfct) -+ return NF_ACCEPT; -+#endif -+ - /* Gather fragments. */ - if ((*pskb)->nh.iph->frag_off & htons(IP_MF|IP_OFFSET)) { - *pskb = ip_ct_gather_frags(*pskb, -diff --git a/net/ipv4/netfilter/ip_nat_proto_tcp.c b/net/ipv4/netfilter/ip_nat_proto_tcp.c ---- a/net/ipv4/netfilter/ip_nat_proto_tcp.c -+++ b/net/ipv4/netfilter/ip_nat_proto_tcp.c -@@ -40,7 +40,8 @@ tcp_unique_tuple(struct ip_conntrack_tup - enum ip_nat_manip_type maniptype, - const struct ip_conntrack *conntrack) - { -- static u_int16_t port, *portptr; -+ static u_int16_t port; -+ u_int16_t *portptr; - unsigned int range_size, min, i; - - if (maniptype == IP_NAT_MANIP_SRC) -diff --git a/net/ipv4/netfilter/ip_nat_proto_udp.c b/net/ipv4/netfilter/ip_nat_proto_udp.c ---- a/net/ipv4/netfilter/ip_nat_proto_udp.c -+++ b/net/ipv4/netfilter/ip_nat_proto_udp.c -@@ -41,7 +41,8 @@ udp_unique_tuple(struct ip_conntrack_tup - enum ip_nat_manip_type maniptype, - const struct ip_conntrack *conntrack) - { -- static u_int16_t port, *portptr; -+ static u_int16_t port; -+ u_int16_t *portptr; - unsigned int range_size, min, i; - - if (maniptype == IP_NAT_MANIP_SRC) -diff --git a/net/ipv6/ip6_input.c b/net/ipv6/ip6_input.c ---- a/net/ipv6/ip6_input.c -+++ b/net/ipv6/ip6_input.c -@@ -198,12 +198,13 @@ resubmit: - if (!raw_sk) { - if (xfrm6_policy_check(NULL, XFRM_POLICY_IN, skb)) { - IP6_INC_STATS_BH(IPSTATS_MIB_INUNKNOWNPROTOS); -- icmpv6_param_prob(skb, ICMPV6_UNK_NEXTHDR, nhoff); -+ icmpv6_send(skb, ICMPV6_PARAMPROB, -+ ICMPV6_UNK_NEXTHDR, nhoff, -+ skb->dev); - } -- } else { -+ } else - IP6_INC_STATS_BH(IPSTATS_MIB_INDELIVERS); -- kfree_skb(skb); -- } -+ kfree_skb(skb); - } - rcu_read_unlock(); - return 0; -diff --git a/net/ipv6/ipv6_sockglue.c b/net/ipv6/ipv6_sockglue.c ---- a/net/ipv6/ipv6_sockglue.c -+++ b/net/ipv6/ipv6_sockglue.c -@@ -503,6 +503,9 @@ done: - break; - case IPV6_IPSEC_POLICY: - case IPV6_XFRM_POLICY: -+ retv = -EPERM; -+ if (!capable(CAP_NET_ADMIN)) -+ break; - retv = xfrm_user_policy(sk, optname, optval, optlen); - break; - -diff --git a/net/ipv6/netfilter/ip6_queue.c b/net/ipv6/netfilter/ip6_queue.c ---- a/net/ipv6/netfilter/ip6_queue.c -+++ b/net/ipv6/netfilter/ip6_queue.c -@@ -76,7 +76,9 @@ static DECLARE_MUTEX(ipqnl_sem); - static void - ipq_issue_verdict(struct ipq_queue_entry *entry, int verdict) - { -+ local_bh_disable(); - nf_reinject(entry->skb, entry->info, verdict); -+ local_bh_enable(); - kfree(entry); - } - -diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c ---- a/net/netlink/af_netlink.c -+++ b/net/netlink/af_netlink.c -@@ -315,8 +315,8 @@ err: - static void netlink_remove(struct sock *sk) - { - netlink_table_grab(); -- nl_table[sk->sk_protocol].hash.entries--; -- sk_del_node_init(sk); -+ if (sk_del_node_init(sk)) -+ nl_table[sk->sk_protocol].hash.entries--; - if (nlk_sk(sk)->groups) - __sk_del_bind_node(sk); - netlink_table_ungrab(); -@@ -429,7 +429,12 @@ retry: - err = netlink_insert(sk, pid); - if (err == -EADDRINUSE) - goto retry; -- return 0; -+ -+ /* If 2 threads race to autobind, that is fine. */ -+ if (err == -EBUSY) -+ err = 0; -+ -+ return err; - } - - static inline int netlink_capable(struct socket *sock, unsigned int flag) -diff --git a/net/packet/af_packet.c b/net/packet/af_packet.c ---- a/net/packet/af_packet.c -+++ b/net/packet/af_packet.c -@@ -274,6 +274,9 @@ static int packet_rcv_spkt(struct sk_buf - dst_release(skb->dst); - skb->dst = NULL; - -+ /* drop conntrack reference */ -+ nf_reset(skb); -+ - spkt = (struct sockaddr_pkt*)skb->cb; - - skb_push(skb, skb->data-skb->mac.raw); -@@ -517,6 +520,9 @@ static int packet_rcv(struct sk_buff *sk - dst_release(skb->dst); - skb->dst = NULL; - -+ /* drop conntrack reference */ -+ nf_reset(skb); -+ - spin_lock(&sk->sk_receive_queue.lock); - po->stats.tp_packets++; - __skb_queue_tail(&sk->sk_receive_queue, skb); -diff --git a/net/xfrm/xfrm_user.c b/net/xfrm/xfrm_user.c ---- a/net/xfrm/xfrm_user.c -+++ b/net/xfrm/xfrm_user.c -@@ -1180,6 +1180,9 @@ static struct xfrm_policy *xfrm_compile_ - if (nr > XFRM_MAX_DEPTH) - return NULL; - -+ if (p->dir > XFRM_POLICY_OUT) -+ return NULL; -+ - xp = xfrm_policy_alloc(GFP_KERNEL); - if (xp == NULL) { - *dir = -ENOBUFS; -diff --git a/security/keys/keyring.c b/security/keys/keyring.c ---- a/security/keys/keyring.c -+++ b/security/keys/keyring.c -@@ -188,7 +188,11 @@ static void keyring_destroy(struct key * - - if (keyring->description) { - write_lock(&keyring_name_lock); -- list_del(&keyring->type_data.link); -+ -+ if (keyring->type_data.link.next != NULL && -+ !list_empty(&keyring->type_data.link)) -+ list_del(&keyring->type_data.link); -+ - write_unlock(&keyring_name_lock); - } - -diff --git a/security/keys/process_keys.c b/security/keys/process_keys.c ---- a/security/keys/process_keys.c -+++ b/security/keys/process_keys.c -@@ -641,7 +641,7 @@ long join_session_keyring(const char *na - keyring = keyring_alloc(name, tsk->uid, tsk->gid, 0, NULL); - if (IS_ERR(keyring)) { - ret = PTR_ERR(keyring); -- goto error; -+ goto error2; - } - } - else if (IS_ERR(keyring)) { diff --git a/patches/linux-2.6.12/cpu-hotplug-init.patch b/patches/linux-2.6.12/cpu-hotplug-init.patch deleted file mode 100644 index 9e039db252..0000000000 --- a/patches/linux-2.6.12/cpu-hotplug-init.patch +++ /dev/null @@ -1,34 +0,0 @@ -diff -ur linux-2.6.12.orig/include/linux/init.h linux-2.6.12/include/linux/init.h ---- linux-2.6.12.orig/include/linux/init.h 2005-11-01 14:52:28.656025573 +0000 -+++ linux-2.6.12/include/linux/init.h 2005-11-01 14:53:28.015791549 +0000 -@@ -229,6 +229,18 @@ - #define __devexitdata __exitdata - #endif - -+#ifdef CONFIG_HOTPLUG_CPU -+#define __cpuinit -+#define __cpuinitdata -+#define __cpuexit -+#define __cpuexitdata -+#else -+#define __cpuinit __init -+#define __cpuinitdata __initdata -+#define __cpuexit __exit -+#define __cpuexitdata __exitdata -+#endif -+ - /* Functions marked as __devexit may be discarded at kernel link time, depending - on config options. Newer versions of binutils detect references from - retained sections to discarded sections and flag an error. Pointers to -diff -ur linux-2.6.12.orig/arch/x86_64/kernel/i387.c linux-2.6.12/arch/x86_64/kernel/i387.c ---- linux-2.6.12.orig/arch/x86_64/kernel/i387.c 2005-11-01 15:01:58.932991232 +0000 -+++ linux-2.6.12/arch/x86_64/kernel/i387.c 2005-11-01 15:02:09.729312416 +0000 -@@ -42,7 +42,7 @@ - * Called at bootup to set up the initial FPU state that is later cloned - * into all processes. - */ --void __init fpu_init(void) -+void __cpuinit fpu_init(void) - { - unsigned long oldcr0 = read_cr0(); - extern void __bad_fxsave_alignment(void); diff --git a/patches/linux-2.6.12/i386-cpu-hotplug-updated-for-mm.patch b/patches/linux-2.6.12/i386-cpu-hotplug-updated-for-mm.patch deleted file mode 100644 index abd3c2af3c..0000000000 --- a/patches/linux-2.6.12/i386-cpu-hotplug-updated-for-mm.patch +++ /dev/null @@ -1,581 +0,0 @@ -diff -Naur linux-2.6.12.orig/arch/i386/Kconfig linux-2.6.12/arch/i386/Kconfig ---- linux-2.6.12.orig/arch/i386/Kconfig 2005-07-08 12:33:40.000000000 -0400 -+++ linux-2.6.12/arch/i386/Kconfig 2005-07-08 12:34:10.000000000 -0400 -@@ -1226,6 +1226,15 @@ - This support is also available as a module. If compiled as a - module, it will be called scx200. - -+config HOTPLUG_CPU -+ bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" -+ depends on SMP && HOTPLUG && EXPERIMENTAL -+ ---help--- -+ Say Y here to experiment with turning CPUs off and on. CPUs -+ can be controlled through /sys/devices/system/cpu. -+ -+ Say N. -+ - source "drivers/pcmcia/Kconfig" - - source "drivers/pci/hotplug/Kconfig" -diff -Naur linux-2.6.12.orig/arch/i386/kernel/apic.c linux-2.6.12/arch/i386/kernel/apic.c ---- linux-2.6.12.orig/arch/i386/kernel/apic.c 2005-07-08 12:33:40.000000000 -0400 -+++ linux-2.6.12/arch/i386/kernel/apic.c 2005-07-08 12:34:10.000000000 -0400 -@@ -26,6 +26,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -1048,7 +1049,7 @@ - setup_APIC_timer(calibration_result); - } - --void __init disable_APIC_timer(void) -+void __devinit disable_APIC_timer(void) - { - if (using_apic_timer) { - unsigned long v; -diff -Naur linux-2.6.12.orig/arch/i386/kernel/io_apic.c linux-2.6.12/arch/i386/kernel/io_apic.c ---- linux-2.6.12.orig/arch/i386/kernel/io_apic.c 2005-07-08 12:33:40.000000000 -0400 -+++ linux-2.6.12/arch/i386/kernel/io_apic.c 2005-07-08 12:34:10.000000000 -0400 -@@ -576,9 +576,11 @@ - try_to_freeze(PF_FREEZE); - if (time_after(jiffies, - prev_balance_time+balanced_irq_interval)) { -+ preempt_disable(); - do_irq_balance(); - prev_balance_time = jiffies; - time_remaining = balanced_irq_interval; -+ preempt_enable(); - } - } - return 0; -diff -Naur linux-2.6.12.orig/arch/i386/kernel/irq.c linux-2.6.12/arch/i386/kernel/irq.c ---- linux-2.6.12.orig/arch/i386/kernel/irq.c 2005-07-08 12:33:40.000000000 -0400 -+++ linux-2.6.12/arch/i386/kernel/irq.c 2005-07-08 12:36:06.000000000 -0400 -@@ -15,6 +15,9 @@ - #include - #include - #include -+#include -+#include -+#include - - DEFINE_PER_CPU(irq_cpustat_t, irq_stat) ____cacheline_maxaligned_in_smp; - EXPORT_PER_CPU_SYMBOL(irq_stat); -@@ -210,9 +213,8 @@ - - if (i == 0) { - seq_printf(p, " "); -- for (j=0; jtypename); - seq_printf(p, " %s", action->name); -@@ -240,16 +241,13 @@ - spin_unlock_irqrestore(&irq_desc[i].lock, flags); - } else if (i == NR_IRQS) { - seq_printf(p, "NMI: "); -- for (j = 0; j < NR_CPUS; j++) -- if (cpu_online(j)) -- seq_printf(p, "%10u ", nmi_count(j)); -+ for_each_cpu(j) -+ seq_printf(p, "%10u ", nmi_count(j)); - seq_putc(p, '\n'); - #ifdef CONFIG_X86_LOCAL_APIC - seq_printf(p, "LOC: "); -- for (j = 0; j < NR_CPUS; j++) -- if (cpu_online(j)) -- seq_printf(p, "%10u ", -- per_cpu(irq_stat,j).apic_timer_irqs); -+ for_each_cpu(j) -+ seq_printf(p, "%10u ", per_cpu(irq_stat,j).apic_timer_irqs); - seq_putc(p, '\n'); - #endif - seq_printf(p, "ERR: %10u\n", atomic_read(&irq_err_count)); -@@ -259,3 +257,45 @@ - } - return 0; - } -+ -+#ifdef CONFIG_HOTPLUG_CPU -+#include -+ -+void fixup_irqs(cpumask_t map) -+{ -+ unsigned int irq; -+ static int warned; -+ -+ for (irq = 0; irq < NR_IRQS; irq++) { -+ cpumask_t mask; -+ if (irq == 2) -+ continue; -+ -+ cpus_and(mask, irq_affinity[irq], map); -+ if (any_online_cpu(mask) == NR_CPUS) { -+ printk("Breaking affinity for irq %i\n", irq); -+ mask = map; -+ } -+ if (irq_desc[irq].handler->set_affinity) -+ irq_desc[irq].handler->set_affinity(irq, mask); -+ else if (irq_desc[irq].action && !(warned++)) -+ printk("Cannot set affinity for irq %i\n", irq); -+ } -+ -+#if 0 -+ barrier(); -+ /* Ingo Molnar says: "after the IO-APIC masks have been redirected -+ [note the nop - the interrupt-enable boundary on x86 is two -+ instructions from sti] - to flush out pending hardirqs and -+ IPIs. After this point nothing is supposed to reach this CPU." */ -+ __asm__ __volatile__("sti; nop; cli"); -+ barrier(); -+#else -+ /* That doesn't seem sufficient. Give it 1ms. */ -+ local_irq_enable(); -+ mdelay(1); -+ local_irq_disable(); -+#endif -+} -+#endif -+ -diff -Naur linux-2.6.12.orig/arch/i386/kernel/msr.c linux-2.6.12/arch/i386/kernel/msr.c ---- linux-2.6.12.orig/arch/i386/kernel/msr.c 2005-07-08 12:33:40.000000000 -0400 -+++ linux-2.6.12/arch/i386/kernel/msr.c 2005-07-08 12:34:10.000000000 -0400 -@@ -260,7 +260,7 @@ - .open = msr_open, - }; - --static int msr_class_simple_device_add(int i) -+static int __devinit msr_class_simple_device_add(int i) - { - int err = 0; - struct class_device *class_err; -diff -Naur linux-2.6.12.orig/arch/i386/kernel/process.c linux-2.6.12/arch/i386/kernel/process.c ---- linux-2.6.12.orig/arch/i386/kernel/process.c 2005-07-08 12:33:40.000000000 -0400 -+++ linux-2.6.12/arch/i386/kernel/process.c 2005-07-08 12:36:43.000000000 -0400 -@@ -13,6 +13,7 @@ - - #include - -+#include - #include - #include - #include -@@ -54,6 +55,9 @@ - #include - #include - -+#include -+#include -+ - asmlinkage void ret_from_fork(void) __asm__("ret_from_fork"); - - static int hlt_counter; -@@ -138,6 +142,34 @@ - } - } - -+#ifdef CONFIG_HOTPLUG_CPU -+#include -+/* We don't actually take CPU down, just spin without interrupts. */ -+static inline void play_dead(void) -+{ -+ /* Ack it */ -+ __get_cpu_var(cpu_state) = CPU_DEAD; -+ -+ /* We shouldn't have to disable interrupts while dead, but -+ * some interrupts just don't seem to go away, and this makes -+ * it "work" for testing purposes. */ -+ /* Death loop */ -+ while (__get_cpu_var(cpu_state) != CPU_UP_PREPARE) -+ cpu_relax(); -+ -+ local_irq_disable(); -+ __flush_tlb_all(); -+ cpu_set(smp_processor_id(), cpu_online_map); -+ enable_APIC_timer(); -+ local_irq_enable(); -+} -+#else -+static inline void play_dead(void) -+{ -+ BUG(); -+} -+#endif /* CONFIG_HOTPLUG_CPU */ -+ - /* - * The idle thread. There's no useful work to be - * done, so just try to conserve power and have a -@@ -160,6 +192,9 @@ - if (!idle) - idle = default_idle; - -+ if (cpu_is_offline(cpu)) -+ play_dead(); -+ - __get_cpu_var(irq_stat).idle_timestamp = jiffies; - idle(); - } -diff -Naur linux-2.6.12.orig/arch/i386/kernel/smpboot.c linux-2.6.12/arch/i386/kernel/smpboot.c ---- linux-2.6.12.orig/arch/i386/kernel/smpboot.c 2005-07-08 12:33:40.000000000 -0400 -+++ linux-2.6.12/arch/i386/kernel/smpboot.c 2005-07-08 12:34:10.000000000 -0400 -@@ -44,6 +44,9 @@ - #include - #include - #include -+#include -+#include -+#include - - #include - #include -@@ -90,6 +93,9 @@ - - static void map_cpu_to_logical_apicid(void); - -+/* State of each CPU. */ -+DEFINE_PER_CPU(int, cpu_state) = { 0 }; -+ - /* - * Currently trivial. Write the real->protected mode - * bootstrap into the page concerned. The caller -@@ -1107,6 +1113,9 @@ - who understands all this stuff should rewrite it properly. --RR 15/Jul/02 */ - void __init smp_prepare_cpus(unsigned int max_cpus) - { -+ smp_commenced_mask = cpumask_of_cpu(0); -+ cpu_callin_map = cpumask_of_cpu(0); -+ mb(); - smp_boot_cpus(max_cpus); - } - -@@ -1116,20 +1125,99 @@ - cpu_set(smp_processor_id(), cpu_callout_map); - } - --int __devinit __cpu_up(unsigned int cpu) -+#ifdef CONFIG_HOTPLUG_CPU -+ -+/* must be called with the cpucontrol mutex held */ -+static int __devinit cpu_enable(unsigned int cpu) - { -- /* This only works at boot for x86. See "rewrite" above. */ -- if (cpu_isset(cpu, smp_commenced_mask)) { -- local_irq_enable(); -- return -ENOSYS; -+ /* get the target out of its holding state */ -+ per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; -+ wmb(); -+ -+ /* wait for the processor to ack it. timeout? */ -+ while (!cpu_online(cpu)) -+ cpu_relax(); -+ -+ fixup_irqs(cpu_online_map); -+ /* counter the disable in fixup_irqs() */ -+ local_irq_enable(); -+ return 0; -+} -+ -+int __cpu_disable(void) -+{ -+ cpumask_t map = cpu_online_map; -+ int cpu = smp_processor_id(); -+ -+ /* -+ * Perhaps use cpufreq to drop frequency, but that could go -+ * into generic code. -+ * -+ * We won't take down the boot processor on i386 due to some -+ * interrupts only being able to be serviced by the BSP. -+ * Especially so if we're not using an IOAPIC -zwane -+ */ -+ if (cpu == 0) -+ return -EBUSY; -+ -+ /* We enable the timer again on the exit path of the death loop */ -+ disable_APIC_timer(); -+ /* Allow any queued timer interrupts to get serviced */ -+ local_irq_enable(); -+ mdelay(1); -+ local_irq_disable(); -+ -+ cpu_clear(cpu, map); -+ fixup_irqs(map); -+ /* It's now safe to remove this processor from the online map */ -+ cpu_clear(cpu, cpu_online_map); -+ return 0; -+} -+ -+void __cpu_die(unsigned int cpu) -+{ -+ /* We don't do anything here: idle task is faking death itself. */ -+ unsigned int i; -+ -+ for (i = 0; i < 10; i++) { -+ /* They ack this in play_dead by setting CPU_DEAD */ -+ if (per_cpu(cpu_state, cpu) == CPU_DEAD) -+ return; -+ current->state = TASK_UNINTERRUPTIBLE; -+ schedule_timeout(HZ/10); - } -+ printk(KERN_ERR "CPU %u didn't die...\n", cpu); -+} -+#else /* ... !CONFIG_HOTPLUG_CPU */ -+int __cpu_disable(void) -+{ -+ return -ENOSYS; -+} - -+void __cpu_die(unsigned int cpu) -+{ -+ /* We said "no" in __cpu_disable */ -+ BUG(); -+} -+#endif /* CONFIG_HOTPLUG_CPU */ -+ -+int __devinit __cpu_up(unsigned int cpu) -+{ - /* In case one didn't come up */ - if (!cpu_isset(cpu, cpu_callin_map)) { -+ printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu); - local_irq_enable(); - return -EIO; - } - -+#ifdef CONFIG_HOTPLUG_CPU -+ /* Already up, and in cpu_quiescent now? */ -+ if (cpu_isset(cpu, smp_commenced_mask)) { -+ cpu_enable(cpu); -+ return 0; -+ } -+#endif -+ - local_irq_enable(); - /* Unleash the CPU! */ - cpu_set(cpu, smp_commenced_mask); -diff -Naur linux-2.6.12.orig/arch/i386/kernel/smp.c linux-2.6.12/arch/i386/kernel/smp.c ---- linux-2.6.12.orig/arch/i386/kernel/smp.c 2005-07-08 12:33:40.000000000 -0400 -+++ linux-2.6.12/arch/i386/kernel/smp.c 2005-07-08 12:34:10.000000000 -0400 -@@ -19,6 +19,7 @@ - #include - #include - #include -+#include - - #include - #include -@@ -163,7 +164,7 @@ - unsigned long flags; - - local_irq_save(flags); -- -+ WARN_ON(mask & ~cpus_addr(cpu_online_map)[0]); - /* - * Wait for idle. - */ -@@ -345,21 +346,21 @@ - static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm, - unsigned long va) - { -- cpumask_t tmp; - /* - * A couple of (to be removed) sanity checks: - * -- * - we do not send IPIs to not-yet booted CPUs. - * - current CPU must not be in mask - * - mask must exist :) - */ - BUG_ON(cpus_empty(cpumask)); -- -- cpus_and(tmp, cpumask, cpu_online_map); -- BUG_ON(!cpus_equal(cpumask, tmp)); - BUG_ON(cpu_isset(smp_processor_id(), cpumask)); - BUG_ON(!mm); - -+ /* If a CPU which we ran on has gone down, OK. */ -+ cpus_and(cpumask, cpumask, cpu_online_map); -+ if (cpus_empty(cpumask)) -+ return; -+ - /* - * i'm not happy about this global shared spinlock in the - * MM hot path, but we'll see how contended it is. -@@ -474,6 +475,7 @@ - */ - void smp_send_reschedule(int cpu) - { -+ WARN_ON(cpu_is_offline(cpu)); - send_IPI_mask(cpumask_of_cpu(cpu), RESCHEDULE_VECTOR); - } - -@@ -514,10 +516,16 @@ - */ - { - struct call_data_struct data; -- int cpus = num_online_cpus()-1; -+ int cpus; - -- if (!cpus) -+ /* Holding any lock stops cpus from going down. */ -+ spin_lock(&call_lock); -+ cpus = num_online_cpus()-1; -+ -+ if (!cpus) { -+ spin_unlock(&call_lock); - return 0; -+ } - - /* Can deadlock when called with interrupts disabled */ - WARN_ON(irqs_disabled()); -@@ -529,7 +537,6 @@ - if (wait) - atomic_set(&data.finished, 0); - -- spin_lock(&call_lock); - call_data = &data; - mb(); - -diff -Naur linux-2.6.12.orig/arch/i386/kernel/traps.c linux-2.6.12/arch/i386/kernel/traps.c ---- linux-2.6.12.orig/arch/i386/kernel/traps.c 2005-07-08 12:33:40.000000000 -0400 -+++ linux-2.6.12/arch/i386/kernel/traps.c 2005-07-08 12:34:10.000000000 -0400 -@@ -624,6 +624,14 @@ - nmi_enter(); - - cpu = smp_processor_id(); -+ -+#ifdef CONFIG_HOTPLUG_CPU -+ if (!cpu_online(cpu)) { -+ nmi_exit(); -+ return; -+ } -+#endif -+ - ++nmi_count(cpu); - - if (!nmi_callback(regs, cpu)) -diff -Naur linux-2.6.12.orig/arch/ppc64/kernel/pSeries_smp.c linux-2.6.12/arch/ppc64/kernel/pSeries_smp.c ---- linux-2.6.12.orig/arch/ppc64/kernel/pSeries_smp.c 2005-07-08 12:33:42.000000000 -0400 -+++ linux-2.6.12/arch/ppc64/kernel/pSeries_smp.c 2005-07-08 12:34:10.000000000 -0400 -@@ -92,10 +92,13 @@ - - int pSeries_cpu_disable(void) - { -+ int cpu = smp_processor_id(); -+ -+ cpu_clear(cpu, cpu_online_map); - systemcfg->processorCount--; - - /*fix boot_cpuid here*/ -- if (smp_processor_id() == boot_cpuid) -+ if (cpu == boot_cpuid) - boot_cpuid = any_online_cpu(cpu_online_map); - - /* FIXME: abstract this to not be platform specific later on */ -diff -Naur linux-2.6.12.orig/arch/s390/kernel/smp.c linux-2.6.12/arch/s390/kernel/smp.c ---- linux-2.6.12.orig/arch/s390/kernel/smp.c 2005-07-08 12:33:42.000000000 -0400 -+++ linux-2.6.12/arch/s390/kernel/smp.c 2005-07-08 12:34:10.000000000 -0400 -@@ -679,12 +679,14 @@ - { - unsigned long flags; - ec_creg_mask_parms cr_parms; -+ int cpu = smp_processor_id(); - - spin_lock_irqsave(&smp_reserve_lock, flags); -- if (smp_cpu_reserved[smp_processor_id()] != 0) { -+ if (smp_cpu_reserved[cpu] != 0) { - spin_unlock_irqrestore(&smp_reserve_lock, flags); - return -EBUSY; - } -+ cpu_clear(cpu, cpu_online_map); - - #ifdef CONFIG_PFAULT - /* Disable pfault pseudo page faults on this cpu. */ -diff -Naur linux-2.6.12.orig/include/asm-i386/cpu.h linux-2.6.12/include/asm-i386/cpu.h ---- linux-2.6.12.orig/include/asm-i386/cpu.h 2005-07-08 12:33:58.000000000 -0400 -+++ linux-2.6.12/include/asm-i386/cpu.h 2005-07-08 12:34:10.000000000 -0400 -@@ -5,6 +5,7 @@ - #include - #include - #include -+#include - - #include - -@@ -16,4 +17,5 @@ - extern void arch_unregister_cpu(int); - #endif - -+DECLARE_PER_CPU(int, cpu_state); - #endif /* _ASM_I386_CPU_H_ */ -diff -Naur linux-2.6.12.orig/include/asm-i386/irq.h linux-2.6.12/include/asm-i386/irq.h ---- linux-2.6.12.orig/include/asm-i386/irq.h 2005-07-08 12:33:58.000000000 -0400 -+++ linux-2.6.12/include/asm-i386/irq.h 2005-07-08 12:34:10.000000000 -0400 -@@ -38,4 +38,8 @@ - extern int irqbalance_disable(char *str); - #endif - -+#ifdef CONFIG_HOTPLUG_CPU -+extern void fixup_irqs(cpumask_t map); -+#endif -+ - #endif /* _ASM_IRQ_H */ -diff -Naur linux-2.6.12.orig/include/asm-i386/smp.h linux-2.6.12/include/asm-i386/smp.h ---- linux-2.6.12.orig/include/asm-i386/smp.h 2005-07-08 12:33:58.000000000 -0400 -+++ linux-2.6.12/include/asm-i386/smp.h 2005-07-08 12:34:10.000000000 -0400 -@@ -83,6 +83,9 @@ - } - - #endif -+ -+extern int __cpu_disable(void); -+extern void __cpu_die(unsigned int cpu); - #endif /* !__ASSEMBLY__ */ - - #define NO_PROC_ID 0xFF /* No processor magic marker */ -diff -Naur linux-2.6.12.orig/kernel/cpu.c linux-2.6.12/kernel/cpu.c ---- linux-2.6.12.orig/kernel/cpu.c 2005-07-08 12:33:26.000000000 -0400 -+++ linux-2.6.12/kernel/cpu.c 2005-07-08 12:34:10.000000000 -0400 -@@ -63,19 +63,15 @@ - { - int err; - -- /* Take offline: makes arch_cpu_down somewhat easier. */ -- cpu_clear(smp_processor_id(), cpu_online_map); -- - /* Ensure this CPU doesn't handle any more interrupts. */ - err = __cpu_disable(); - if (err < 0) -- cpu_set(smp_processor_id(), cpu_online_map); -- else -- /* Force idle task to run as soon as we yield: it should -- immediately notice cpu is offline and die quickly. */ -- sched_idle_next(); -+ return err; - -- return err; -+ /* Force idle task to run as soon as we yield: it should -+ immediately notice cpu is offline and die quickly. */ -+ sched_idle_next(); -+ return 0; - } - - int cpu_down(unsigned int cpu) diff --git a/patches/linux-2.6.12/i386-mach-io-check-nmi.patch b/patches/linux-2.6.12/i386-mach-io-check-nmi.patch deleted file mode 100644 index 3a6048833a..0000000000 --- a/patches/linux-2.6.12/i386-mach-io-check-nmi.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- ref-linux-2.6.12/arch/i386/kernel/traps.c 2005-12-19 09:23:44.000000000 +0000 -+++ linux-2.6.12-xen0/arch/i386/kernel/traps.c 2006-01-05 15:51:52.000000000 +0000 -@@ -521,18 +521,11 @@ - - static void io_check_error(unsigned char reason, struct pt_regs * regs) - { -- unsigned long i; -- - printk("NMI: IOCK error (debug interrupt?)\n"); - show_registers(regs); - - /* Re-enable the IOCK line, wait for a few seconds */ -- reason = (reason & 0xf) | 8; -- outb(reason, 0x61); -- i = 2000; -- while (--i) udelay(1000); -- reason &= ~8; -- outb(reason, 0x61); -+ clear_io_check_error(reason); - } - - static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs) ---- ref-linux-2.6.12/include/asm-i386/mach-default/mach_traps.h 2005-06-17 20:48:29.000000000 +0100 -+++ linux-2.6.12-xen0/include/asm-i386/mach-default/mach_traps.h 2006-01-05 15:52:33.000000000 +0000 -@@ -15,6 +15,18 @@ - outb(reason, 0x61); - } - -+static inline void clear_io_check_error(unsigned char reason) -+{ -+ unsigned long i; -+ -+ reason = (reason & 0xf) | 8; -+ outb(reason, 0x61); -+ i = 2000; -+ while (--i) udelay(1000); -+ reason &= ~8; -+ outb(reason, 0x61); -+} -+ - static inline unsigned char get_nmi_reason(void) - { - return inb(0x61); diff --git a/patches/linux-2.6.12/net-csum.patch b/patches/linux-2.6.12/net-csum.patch deleted file mode 100644 index 4f744a250f..0000000000 --- a/patches/linux-2.6.12/net-csum.patch +++ /dev/null @@ -1,56 +0,0 @@ -diff -ur linux-2.6.11/net/ipv4/netfilter/ip_conntrack_proto_udp.c linux-2.6.11-csum/net/ipv4/netfilter/ip_conntrack_proto_udp.c ---- linux-2.6.11/net/ipv4/netfilter/ip_conntrack_proto_udp.c 2005-05-27 11:47:48 +01:00 -+++ linux-2.6.11-csum/net/ipv4/netfilter/ip_conntrack_proto_udp.c 2005-05-27 11:48:07 +01:00 -@@ -120,6 +120,7 @@ - * and moreover root might send raw packets. - * FIXME: Source route IP option packets --RR */ - if (hooknum == NF_IP_PRE_ROUTING -+ && skb->ip_summed != CHECKSUM_UNNECESSARY - && csum_tcpudp_magic(iph->saddr, iph->daddr, udplen, IPPROTO_UDP, - skb->ip_summed == CHECKSUM_HW ? skb->csum - : skb_checksum(skb, iph->ihl*4, udplen, 0))) { - ---- ../xen-unstable.hg/linux-2.6.12-xen0/net/ipv4/netfilter/ip_nat_proto_udp.c 2005-06-17 14:48:29.000000000 -0500 -+++ linux-2.6-xen-sparse/net/ipv4/netfilter/ip_nat_proto_udp.c 2005-10-14 15:17:53.000000000 -0500 -@@ -112,11 +112,19 @@ udp_manip_pkt(struct sk_buff **pskb, - newport = tuple->dst.u.udp.port; - portptr = &hdr->dest; - } -- if (hdr->check) /* 0 is a special case meaning no checksum */ -- hdr->check = ip_nat_cheat_check(~oldip, newip, -+ -+ if (hdr->check) { /* 0 is a special case meaning no checksum */ -+ if ((*pskb)->proto_csum_blank) { -+ hdr->check = ip_nat_cheat_check(oldip, ~newip, -+ ip_nat_cheat_check(*portptr ^ 0xFFFF, -+ newport, hdr->check)); -+ } else { -+ hdr->check = ip_nat_cheat_check(~oldip, newip, - ip_nat_cheat_check(*portptr ^ 0xFFFF, - newport, - hdr->check)); -+ } -+ } - *portptr = newport; - return 1; - } ---- ../xen-unstable.hg/linux-2.6.12-xen0/net/ipv4/netfilter/ip_nat_proto_tcp.c 2005-06-17 14:48:29.000000000 -0500 -+++ linux-2.6-xen-sparse/net/ipv4/netfilter/ip_nat_proto_tcp.c 2005-10-14 16:41:20.000000000 -0500 -@@ -127,10 +127,16 @@ tcp_manip_pkt(struct sk_buff **pskb, - if (hdrsize < sizeof(*hdr)) - return 1; - -- hdr->check = ip_nat_cheat_check(~oldip, newip, -+ if ((*pskb)->proto_csum_blank) { -+ hdr->check = ip_nat_cheat_check(oldip, ~newip, -+ ip_nat_cheat_check(oldport ^ 0xFFFF, -+ newport, hdr->check)); -+ } else { -+ hdr->check = ip_nat_cheat_check(~oldip, newip, - ip_nat_cheat_check(oldport ^ 0xFFFF, - newport, - hdr->check)); -+ } - return 1; - } - diff --git a/patches/linux-2.6.12/pmd-shared.patch b/patches/linux-2.6.12/pmd-shared.patch deleted file mode 100644 index 50ce938ce7..0000000000 --- a/patches/linux-2.6.12/pmd-shared.patch +++ /dev/null @@ -1,130 +0,0 @@ -diff -urNpP linux-2.6.12/arch/i386/mm/pageattr.c linux-2.6.12.new/arch/i386/mm/pageattr.c ---- linux-2.6.12/arch/i386/mm/pageattr.c 2005-06-17 20:48:29.000000000 +0100 -+++ linux-2.6.12.new/arch/i386/mm/pageattr.c 2005-07-11 16:28:09.775165494 +0100 -@@ -75,7 +75,7 @@ static void set_pmd_pte(pte_t *kpte, uns - unsigned long flags; - - set_pte_atomic(kpte, pte); /* change init_mm */ -- if (PTRS_PER_PMD > 1) -+ if (HAVE_SHARED_KERNEL_PMD) - return; - - spin_lock_irqsave(&pgd_lock, flags); -diff -urNpP linux-2.6.12/arch/i386/mm/pgtable.c linux-2.6.12.new/arch/i386/mm/pgtable.c ---- linux-2.6.12/arch/i386/mm/pgtable.c 2005-11-26 09:55:10.000000000 +0000 -+++ linux-2.6.12.new/arch/i386/mm/pgtable.c 2005-11-26 10:20:36.000000000 +0000 -@@ -199,19 +199,20 @@ void pgd_ctor(void *pgd, kmem_cache_t *c - { - unsigned long flags; - -- if (PTRS_PER_PMD == 1) -+ if (PTRS_PER_PMD > 1) { -+ if (HAVE_SHARED_KERNEL_PMD) -+ memcpy((pgd_t *)pgd + USER_PTRS_PER_PGD, -+ swapper_pg_dir + USER_PTRS_PER_PGD, -+ (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); -+ } else { - spin_lock_irqsave(&pgd_lock, flags); -- -- memcpy((pgd_t *)pgd + USER_PTRS_PER_PGD, -- swapper_pg_dir + USER_PTRS_PER_PGD, -- (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); -- -- if (PTRS_PER_PMD > 1) -- return; -- -- pgd_list_add(pgd); -- spin_unlock_irqrestore(&pgd_lock, flags); -- memset(pgd, 0, USER_PTRS_PER_PGD*sizeof(pgd_t)); -+ memcpy((pgd_t *)pgd + USER_PTRS_PER_PGD, -+ swapper_pg_dir + USER_PTRS_PER_PGD, -+ (PTRS_PER_PGD - USER_PTRS_PER_PGD) * sizeof(pgd_t)); -+ memset(pgd, 0, USER_PTRS_PER_PGD*sizeof(pgd_t)); -+ pgd_list_add(pgd); -+ spin_unlock_irqrestore(&pgd_lock, flags); -+ } - } - - /* never called when PTRS_PER_PMD > 1 */ -@@ -238,6 +239,30 @@ pgd_t *pgd_alloc(struct mm_struct *mm) - goto out_oom; - set_pgd(&pgd[i], __pgd(1 + __pa(pmd))); - } -+ -+ if (!HAVE_SHARED_KERNEL_PMD) { -+ unsigned long flags; -+ -+ for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) { -+ pmd_t *pmd = kmem_cache_alloc(pmd_cache, GFP_KERNEL); -+ if (!pmd) -+ goto out_oom; -+ set_pgd(&pgd[USER_PTRS_PER_PGD], __pgd(1 + __pa(pmd))); -+ } -+ -+ spin_lock_irqsave(&pgd_lock, flags); -+ for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) { -+ unsigned long v = (unsigned long)i << PGDIR_SHIFT; -+ pgd_t *kpgd = pgd_offset_k(v); -+ pud_t *kpud = pud_offset(kpgd, v); -+ pmd_t *kpmd = pmd_offset(kpud, v); -+ pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1); -+ memcpy(pmd, kpmd, PAGE_SIZE); -+ } -+ pgd_list_add(pgd); -+ spin_unlock_irqrestore(&pgd_lock, flags); -+ } -+ - return pgd; - - out_oom: -@@ -252,9 +277,23 @@ void pgd_free(pgd_t *pgd) - int i; - - /* in the PAE case user pgd entries are overwritten before usage */ -- if (PTRS_PER_PMD > 1) -- for (i = 0; i < USER_PTRS_PER_PGD; ++i) -- kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i])-1)); -+ if (PTRS_PER_PMD > 1) { -+ for (i = 0; i < USER_PTRS_PER_PGD; ++i) { -+ pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1); -+ kmem_cache_free(pmd_cache, pmd); -+ } -+ if (!HAVE_SHARED_KERNEL_PMD) { -+ unsigned long flags; -+ spin_lock_irqsave(&pgd_lock, flags); -+ pgd_list_del(pgd); -+ spin_unlock_irqrestore(&pgd_lock, flags); -+ for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) { -+ pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1); -+ memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t)); -+ kmem_cache_free(pmd_cache, pmd); -+ } -+ } -+ } - /* in the non-PAE case, free_pgtables() clears user pgd entries */ - kmem_cache_free(pgd_cache, pgd); - } -diff -urNpP linux-2.6.12/include/asm-i386/pgtable-2level-defs.h linux-2.6.12.new/include/asm-i386/pgtable-2level-defs.h ---- linux-2.6.12/include/asm-i386/pgtable-2level-defs.h 2005-06-17 20:48:29.000000000 +0100 -+++ linux-2.6.12.new/include/asm-i386/pgtable-2level-defs.h 2005-07-11 16:28:09.733164251 +0100 -@@ -1,6 +1,8 @@ - #ifndef _I386_PGTABLE_2LEVEL_DEFS_H - #define _I386_PGTABLE_2LEVEL_DEFS_H - -+#define HAVE_SHARED_KERNEL_PMD 0 -+ - /* - * traditional i386 two-level paging structure: - */ -diff -urNpP linux-2.6.12/include/asm-i386/pgtable-3level-defs.h linux-2.6.12.new/include/asm-i386/pgtable-3level-defs.h ---- linux-2.6.12/include/asm-i386/pgtable-3level-defs.h 2005-06-17 20:48:29.000000000 +0100 -+++ linux-2.6.12.new/include/asm-i386/pgtable-3level-defs.h 2005-07-11 16:28:09.755164902 +0100 -@@ -1,6 +1,8 @@ - #ifndef _I386_PGTABLE_3LEVEL_DEFS_H - #define _I386_PGTABLE_3LEVEL_DEFS_H - -+#define HAVE_SHARED_KERNEL_PMD 1 -+ - /* - * PGDIR_SHIFT determines what a top-level page table entry can map - */ diff --git a/patches/linux-2.6.12/rcu-nohz.patch b/patches/linux-2.6.12/rcu-nohz.patch deleted file mode 100644 index d7bafb3a62..0000000000 --- a/patches/linux-2.6.12/rcu-nohz.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff -ur linux-2.6.11/kernel/rcupdate.c linux-2.6.11-rcu/kernel/rcupdate.c ---- linux-2.6.11/kernel/rcupdate.c 2005-05-30 10:51:41 +01:00 -+++ linux-2.6.11-rcu/kernel/rcupdate.c 2005-05-30 10:53:53 +01:00 -@@ -202,8 +202,11 @@ - */ - static void cpu_quiet(int cpu, struct rcu_ctrlblk *rcp, struct rcu_state *rsp) - { -+ cpumask_t mask; -+ - cpu_clear(cpu, rsp->cpumask); -- if (cpus_empty(rsp->cpumask)) { -+ cpus_andnot(mask, rsp->cpumask, nohz_cpu_mask); -+ if (cpus_empty(mask)) { - /* batch completed ! */ - rcp->completed = rcp->cur; - rcu_start_batch(rcp, rsp, 0); diff --git a/patches/linux-2.6.12/smp-alts.patch b/patches/linux-2.6.12/smp-alts.patch deleted file mode 100644 index 27c8f99d09..0000000000 --- a/patches/linux-2.6.12/smp-alts.patch +++ /dev/null @@ -1,563 +0,0 @@ -diff -Naur linux-2.6.12/arch/i386/Kconfig linux-2.6.12.post/arch/i386/Kconfig ---- linux-2.6.12/arch/i386/Kconfig 2005-06-17 15:48:29.000000000 -0400 -+++ linux-2.6.12.post/arch/i386/Kconfig 2005-07-25 05:51:21.000000000 -0400 -@@ -487,6 +487,19 @@ - - If you don't know what to do here, say N. - -+config SMP_ALTERNATIVES -+ bool "SMP alternatives support (EXPERIMENTAL)" -+ depends on SMP && EXPERIMENTAL -+ help -+ Try to reduce the overhead of running an SMP kernel on a uniprocessor -+ host slightly by replacing certain key instruction sequences -+ according to whether we currently have more than one CPU available. -+ This should provide a noticeable boost to performance when -+ running SMP kernels on UP machines, and have negligible impact -+ when running on an true SMP host. -+ -+ If unsure, say N. -+ - config NR_CPUS - int "Maximum number of CPUs (2-255)" - range 2 255 -diff -Naur linux-2.6.12/arch/i386/kernel/Makefile linux-2.6.12.post/arch/i386/kernel/Makefile ---- linux-2.6.12/arch/i386/kernel/Makefile 2005-06-17 15:48:29.000000000 -0400 -+++ linux-2.6.12.post/arch/i386/kernel/Makefile 2005-07-25 05:51:21.000000000 -0400 -@@ -33,6 +33,7 @@ - obj-$(CONFIG_HPET_TIMER) += time_hpet.o - obj-$(CONFIG_EFI) += efi.o efi_stub.o - obj-$(CONFIG_EARLY_PRINTK) += early_printk.o -+obj-$(CONFIG_SMP_ALTERNATIVES) += smpalts.o - - EXTRA_AFLAGS := -traditional - -diff -Naur linux-2.6.12/arch/i386/kernel/smpalts.c linux-2.6.12.post/arch/i386/kernel/smpalts.c ---- linux-2.6.12/arch/i386/kernel/smpalts.c 1969-12-31 19:00:00.000000000 -0500 -+++ linux-2.6.12.post/arch/i386/kernel/smpalts.c 2005-07-25 05:51:21.000000000 -0400 -@@ -0,0 +1,85 @@ -+#include -+#include -+#include -+#include -+#include -+ -+struct smp_replacement_record { -+ unsigned char targ_size; -+ unsigned char smp1_size; -+ unsigned char smp2_size; -+ unsigned char up_size; -+ unsigned char feature; -+ unsigned char data[0]; -+}; -+ -+struct smp_alternative_record { -+ void *targ_start; -+ struct smp_replacement_record *repl; -+}; -+ -+extern struct smp_alternative_record __start_smp_alternatives_table, -+ __stop_smp_alternatives_table; -+extern unsigned long __init_begin, __init_end; -+ -+void prepare_for_smp(void) -+{ -+ struct smp_alternative_record *r; -+ printk(KERN_INFO "Enabling SMP...\n"); -+ for (r = &__start_smp_alternatives_table; -+ r != &__stop_smp_alternatives_table; -+ r++) { -+ BUG_ON(r->repl->targ_size < r->repl->smp1_size); -+ BUG_ON(r->repl->targ_size < r->repl->smp2_size); -+ BUG_ON(r->repl->targ_size < r->repl->up_size); -+ if (system_state == SYSTEM_RUNNING && -+ r->targ_start >= (void *)&__init_begin && -+ r->targ_start < (void *)&__init_end) -+ continue; -+ if (r->repl->feature != (unsigned char)-1 && -+ boot_cpu_has(r->repl->feature)) { -+ memcpy(r->targ_start, -+ r->repl->data + r->repl->smp1_size, -+ r->repl->smp2_size); -+ memset(r->targ_start + r->repl->smp2_size, -+ 0x90, -+ r->repl->targ_size - r->repl->smp2_size); -+ } else { -+ memcpy(r->targ_start, -+ r->repl->data, -+ r->repl->smp1_size); -+ memset(r->targ_start + r->repl->smp1_size, -+ 0x90, -+ r->repl->targ_size - r->repl->smp1_size); -+ } -+ } -+ /* Paranoia */ -+ asm volatile ("jmp 1f\n1:"); -+ mb(); -+} -+ -+void unprepare_for_smp(void) -+{ -+ struct smp_alternative_record *r; -+ printk(KERN_INFO "Disabling SMP...\n"); -+ for (r = &__start_smp_alternatives_table; -+ r != &__stop_smp_alternatives_table; -+ r++) { -+ BUG_ON(r->repl->targ_size < r->repl->smp1_size); -+ BUG_ON(r->repl->targ_size < r->repl->smp2_size); -+ BUG_ON(r->repl->targ_size < r->repl->up_size); -+ if (system_state == SYSTEM_RUNNING && -+ r->targ_start >= (void *)&__init_begin && -+ r->targ_start < (void *)&__init_end) -+ continue; -+ memcpy(r->targ_start, -+ r->repl->data + r->repl->smp1_size + r->repl->smp2_size, -+ r->repl->up_size); -+ memset(r->targ_start + r->repl->up_size, -+ 0x90, -+ r->repl->targ_size - r->repl->up_size); -+ } -+ /* Paranoia */ -+ asm volatile ("jmp 1f\n1:"); -+ mb(); -+} -diff -Naur linux-2.6.12/arch/i386/kernel/smpboot.c linux-2.6.12.post/arch/i386/kernel/smpboot.c ---- linux-2.6.12/arch/i386/kernel/smpboot.c 2005-06-17 15:48:29.000000000 -0400 -+++ linux-2.6.12.post/arch/i386/kernel/smpboot.c 2005-07-25 05:51:21.000000000 -0400 -@@ -1001,6 +1001,11 @@ - if (max_cpus <= cpucount+1) - continue; - -+#ifdef CONFIG_SMP_ALTERNATIVES -+ if (kicked == 1) -+ prepare_for_smp(); -+#endif -+ - if (do_boot_cpu(apicid)) - printk("CPU #%d not responding - cannot use it.\n", - apicid); -@@ -1130,6 +1135,11 @@ - return -EIO; - } - -+#ifdef CONFIG_SMP_ALTERNATIVES -+ if (num_online_cpus() == 1) -+ prepare_for_smp(); -+#endif -+ - local_irq_enable(); - /* Unleash the CPU! */ - cpu_set(cpu, smp_commenced_mask); -diff -Naur linux-2.6.12/arch/i386/kernel/vmlinux.lds.S linux-2.6.12.post/arch/i386/kernel/vmlinux.lds.S ---- linux-2.6.12/arch/i386/kernel/vmlinux.lds.S 2005-06-17 15:48:29.000000000 -0400 -+++ linux-2.6.12.post/arch/i386/kernel/vmlinux.lds.S 2005-07-25 05:51:21.000000000 -0400 -@@ -30,6 +30,13 @@ - __ex_table : { *(__ex_table) } - __stop___ex_table = .; - -+ . = ALIGN(16); -+ __start_smp_alternatives_table = .; -+ __smp_alternatives : { *(__smp_alternatives) } -+ __stop_smp_alternatives_table = .; -+ -+ __smp_replacements : { *(__smp_replacements) } -+ - RODATA - - /* writeable */ -diff -Naur linux-2.6.12/include/asm-i386/atomic.h linux-2.6.12.post/include/asm-i386/atomic.h ---- linux-2.6.12/include/asm-i386/atomic.h 2005-06-17 15:48:29.000000000 -0400 -+++ linux-2.6.12.post/include/asm-i386/atomic.h 2005-07-25 05:51:21.000000000 -0400 -@@ -4,18 +4,13 @@ - #include - #include - #include -+#include - - /* - * Atomic operations that C can't guarantee us. Useful for - * resource counting etc.. - */ - --#ifdef CONFIG_SMP --#define LOCK "lock ; " --#else --#define LOCK "" --#endif -- - /* - * Make sure gcc doesn't try to be clever and move things around - * on us. We need to use _exactly_ the address the user gave us, -diff -Naur linux-2.6.12/include/asm-i386/bitops.h linux-2.6.12.post/include/asm-i386/bitops.h ---- linux-2.6.12/include/asm-i386/bitops.h 2005-06-17 15:48:29.000000000 -0400 -+++ linux-2.6.12.post/include/asm-i386/bitops.h 2005-07-25 05:51:21.000000000 -0400 -@@ -7,6 +7,7 @@ - - #include - #include -+#include - - /* - * These have to be done with inline assembly: that way the bit-setting -@@ -16,12 +17,6 @@ - * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). - */ - --#ifdef CONFIG_SMP --#define LOCK_PREFIX "lock ; " --#else --#define LOCK_PREFIX "" --#endif -- - #define ADDR (*(volatile long *) addr) - - /** -@@ -41,7 +36,7 @@ - */ - static inline void set_bit(int nr, volatile unsigned long * addr) - { -- __asm__ __volatile__( LOCK_PREFIX -+ __asm__ __volatile__( LOCK - "btsl %1,%0" - :"=m" (ADDR) - :"Ir" (nr)); -@@ -76,7 +71,7 @@ - */ - static inline void clear_bit(int nr, volatile unsigned long * addr) - { -- __asm__ __volatile__( LOCK_PREFIX -+ __asm__ __volatile__( LOCK - "btrl %1,%0" - :"=m" (ADDR) - :"Ir" (nr)); -@@ -121,7 +116,7 @@ - */ - static inline void change_bit(int nr, volatile unsigned long * addr) - { -- __asm__ __volatile__( LOCK_PREFIX -+ __asm__ __volatile__( LOCK - "btcl %1,%0" - :"=m" (ADDR) - :"Ir" (nr)); -@@ -140,7 +135,7 @@ - { - int oldbit; - -- __asm__ __volatile__( LOCK_PREFIX -+ __asm__ __volatile__( LOCK - "btsl %2,%1\n\tsbbl %0,%0" - :"=r" (oldbit),"=m" (ADDR) - :"Ir" (nr) : "memory"); -@@ -180,7 +175,7 @@ - { - int oldbit; - -- __asm__ __volatile__( LOCK_PREFIX -+ __asm__ __volatile__( LOCK - "btrl %2,%1\n\tsbbl %0,%0" - :"=r" (oldbit),"=m" (ADDR) - :"Ir" (nr) : "memory"); -@@ -231,7 +226,7 @@ - { - int oldbit; - -- __asm__ __volatile__( LOCK_PREFIX -+ __asm__ __volatile__( LOCK - "btcl %2,%1\n\tsbbl %0,%0" - :"=r" (oldbit),"=m" (ADDR) - :"Ir" (nr) : "memory"); -diff -Naur linux-2.6.12/include/asm-i386/rwsem.h linux-2.6.12.post/include/asm-i386/rwsem.h ---- linux-2.6.12/include/asm-i386/rwsem.h 2005-06-17 15:48:29.000000000 -0400 -+++ linux-2.6.12.post/include/asm-i386/rwsem.h 2005-07-25 05:51:21.000000000 -0400 -@@ -40,6 +40,7 @@ - - #include - #include -+#include - - struct rwsem_waiter; - -@@ -99,7 +100,7 @@ - { - __asm__ __volatile__( - "# beginning down_read\n\t" --LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value */ -+LOCK " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value */ - " js 2f\n\t" /* jump if we weren't granted the lock */ - "1:\n\t" - LOCK_SECTION_START("") -@@ -130,7 +131,7 @@ - " movl %1,%2\n\t" - " addl %3,%2\n\t" - " jle 2f\n\t" --LOCK_PREFIX " cmpxchgl %2,%0\n\t" -+LOCK " cmpxchgl %2,%0\n\t" - " jnz 1b\n\t" - "2:\n\t" - "# ending __down_read_trylock\n\t" -@@ -150,7 +151,7 @@ - tmp = RWSEM_ACTIVE_WRITE_BIAS; - __asm__ __volatile__( - "# beginning down_write\n\t" --LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */ -+LOCK " xadd %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */ - " testl %%edx,%%edx\n\t" /* was the count 0 before? */ - " jnz 2f\n\t" /* jump if we weren't granted the lock */ - "1:\n\t" -@@ -188,7 +189,7 @@ - __s32 tmp = -RWSEM_ACTIVE_READ_BIAS; - __asm__ __volatile__( - "# beginning __up_read\n\t" --LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */ -+LOCK " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */ - " js 2f\n\t" /* jump if the lock is being waited upon */ - "1:\n\t" - LOCK_SECTION_START("") -@@ -214,7 +215,7 @@ - __asm__ __volatile__( - "# beginning __up_write\n\t" - " movl %2,%%edx\n\t" --LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */ -+LOCK " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */ - " jnz 2f\n\t" /* jump if the lock is being waited upon */ - "1:\n\t" - LOCK_SECTION_START("") -@@ -239,7 +240,7 @@ - { - __asm__ __volatile__( - "# beginning __downgrade_write\n\t" --LOCK_PREFIX " addl %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */ -+LOCK " addl %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */ - " js 2f\n\t" /* jump if the lock is being waited upon */ - "1:\n\t" - LOCK_SECTION_START("") -@@ -263,7 +264,7 @@ - static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem) - { - __asm__ __volatile__( --LOCK_PREFIX "addl %1,%0" -+LOCK "addl %1,%0" - : "=m"(sem->count) - : "ir"(delta), "m"(sem->count)); - } -@@ -276,7 +277,7 @@ - int tmp = delta; - - __asm__ __volatile__( --LOCK_PREFIX "xadd %0,(%2)" -+LOCK "xadd %0,(%2)" - : "+r"(tmp), "=m"(sem->count) - : "r"(sem), "m"(sem->count) - : "memory"); -diff -Naur linux-2.6.12/include/asm-i386/smp_alt.h linux-2.6.12.post/include/asm-i386/smp_alt.h ---- linux-2.6.12/include/asm-i386/smp_alt.h 1969-12-31 19:00:00.000000000 -0500 -+++ linux-2.6.12.post/include/asm-i386/smp_alt.h 2005-07-25 05:51:21.000000000 -0400 -@@ -0,0 +1,32 @@ -+#ifndef __ASM_SMP_ALT_H__ -+#define __ASM_SMP_ALT_H__ -+ -+#include -+ -+#ifdef CONFIG_SMP -+#if defined(CONFIG_SMP_ALTERNATIVES) && !defined(MODULE) -+#define LOCK \ -+ "6677: nop\n" \ -+ ".section __smp_alternatives,\"a\"\n" \ -+ ".long 6677b\n" \ -+ ".long 6678f\n" \ -+ ".previous\n" \ -+ ".section __smp_replacements,\"a\"\n" \ -+ "6678: .byte 1\n" \ -+ ".byte 1\n" \ -+ ".byte 0\n" \ -+ ".byte 1\n" \ -+ ".byte -1\n" \ -+ "lock\n" \ -+ "nop\n" \ -+ ".previous\n" -+void prepare_for_smp(void); -+void unprepare_for_smp(void); -+#else -+#define LOCK "lock ; " -+#endif -+#else -+#define LOCK "" -+#endif -+ -+#endif /* __ASM_SMP_ALT_H__ */ -diff -Naur linux-2.6.12/include/asm-i386/spinlock.h linux-2.6.12.post/include/asm-i386/spinlock.h ---- linux-2.6.12/include/asm-i386/spinlock.h 2005-06-17 15:48:29.000000000 -0400 -+++ linux-2.6.12.post/include/asm-i386/spinlock.h 2005-07-25 05:51:21.000000000 -0400 -@@ -6,6 +6,7 @@ - #include - #include - #include -+#include - - asmlinkage int printk(const char * fmt, ...) - __attribute__ ((format (printf, 1, 2))); -@@ -47,8 +48,9 @@ - #define spin_unlock_wait(x) do { barrier(); } while(spin_is_locked(x)) - - #define spin_lock_string \ -- "\n1:\t" \ -- "lock ; decb %0\n\t" \ -+ "1:\n" \ -+ LOCK \ -+ "decb %0\n\t" \ - "jns 3f\n" \ - "2:\t" \ - "rep;nop\n\t" \ -@@ -58,8 +60,9 @@ - "3:\n\t" - - #define spin_lock_string_flags \ -- "\n1:\t" \ -- "lock ; decb %0\n\t" \ -+ "1:\n" \ -+ LOCK \ -+ "decb %0\n\t" \ - "jns 4f\n\t" \ - "2:\t" \ - "testl $0x200, %1\n\t" \ -@@ -121,10 +124,34 @@ - static inline int _raw_spin_trylock(spinlock_t *lock) - { - char oldval; -+#ifdef CONFIG_SMP_ALTERNATIVES - __asm__ __volatile__( -- "xchgb %b0,%1" -+ "1:movb %1,%b0\n" -+ "movb $0,%1\n" -+ "2:" -+ ".section __smp_alternatives,\"a\"\n" -+ ".long 1b\n" -+ ".long 3f\n" -+ ".previous\n" -+ ".section __smp_replacements,\"a\"\n" -+ "3: .byte 2b - 1b\n" -+ ".byte 5f-4f\n" -+ ".byte 0\n" -+ ".byte 6f-5f\n" -+ ".byte -1\n" -+ "4: xchgb %b0,%1\n" -+ "5: movb %1,%b0\n" -+ "movb $0,%1\n" -+ "6:\n" -+ ".previous\n" - :"=q" (oldval), "=m" (lock->slock) - :"0" (0) : "memory"); -+#else -+ __asm__ __volatile__( -+ "xchgb %b0,%1\n" -+ :"=q" (oldval), "=m" (lock->slock) -+ :"0" (0) : "memory"); -+#endif - return oldval > 0; - } - -@@ -225,8 +252,8 @@ - __build_write_lock(rw, "__write_lock_failed"); - } - --#define _raw_read_unlock(rw) asm volatile("lock ; incl %0" :"=m" ((rw)->lock) : : "memory") --#define _raw_write_unlock(rw) asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ",%0":"=m" ((rw)->lock) : : "memory") -+#define _raw_read_unlock(rw) asm volatile(LOCK "incl %0" :"=m" ((rw)->lock) : : "memory") -+#define _raw_write_unlock(rw) asm volatile(LOCK "addl $" RW_LOCK_BIAS_STR ",%0":"=m" ((rw)->lock) : : "memory") - - static inline int _raw_read_trylock(rwlock_t *lock) - { -diff -Naur linux-2.6.12/include/asm-i386/system.h linux-2.6.12.post/include/asm-i386/system.h ---- linux-2.6.12/include/asm-i386/system.h 2005-06-17 15:48:29.000000000 -0400 -+++ linux-2.6.12.post/include/asm-i386/system.h 2005-07-25 05:51:21.000000000 -0400 -@@ -5,7 +5,7 @@ - #include - #include - #include --#include /* for LOCK_PREFIX */ -+#include - - #ifdef __KERNEL__ - -@@ -249,19 +249,19 @@ - unsigned long prev; - switch (size) { - case 1: -- __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2" -+ __asm__ __volatile__(LOCK "cmpxchgb %b1,%2" - : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) - : "memory"); - return prev; - case 2: -- __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2" -+ __asm__ __volatile__(LOCK "cmpxchgw %w1,%2" - : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) - : "memory"); - return prev; - case 4: -- __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2" -+ __asm__ __volatile__(LOCK "cmpxchgl %1,%2" - : "=a"(prev) - : "q"(new), "m"(*__xg(ptr)), "0"(old) - : "memory"); -@@ -425,11 +425,55 @@ - #endif - - #ifdef CONFIG_SMP --#define smp_mb() mb() --#define smp_rmb() rmb() - #define smp_wmb() wmb() --#define smp_read_barrier_depends() read_barrier_depends() -+#if defined(CONFIG_SMP_ALTERNATIVES) && !defined(MODULE) -+#define smp_alt_mb(instr) \ -+__asm__ __volatile__("6667:\nnop\nnop\nnop\nnop\nnop\nnop\n6668:\n" \ -+ ".section __smp_alternatives,\"a\"\n" \ -+ ".long 6667b\n" \ -+ ".long 6673f\n" \ -+ ".previous\n" \ -+ ".section __smp_replacements,\"a\"\n" \ -+ "6673:.byte 6668b-6667b\n" \ -+ ".byte 6670f-6669f\n" \ -+ ".byte 6671f-6670f\n" \ -+ ".byte 0\n" \ -+ ".byte %c0\n" \ -+ "6669:lock;addl $0,0(%%esp)\n" \ -+ "6670:" instr "\n" \ -+ "6671:\n" \ -+ ".previous\n" \ -+ : \ -+ : "i" (X86_FEATURE_XMM2) \ -+ : "memory") -+#define smp_rmb() smp_alt_mb("lfence") -+#define smp_mb() smp_alt_mb("mfence") -+#define set_mb(var, value) do { \ -+unsigned long __set_mb_temp; \ -+__asm__ __volatile__("6667:movl %1, %0\n6668:\n" \ -+ ".section __smp_alternatives,\"a\"\n" \ -+ ".long 6667b\n" \ -+ ".long 6673f\n" \ -+ ".previous\n" \ -+ ".section __smp_replacements,\"a\"\n" \ -+ "6673: .byte 6668b-6667b\n" \ -+ ".byte 6670f-6669f\n" \ -+ ".byte 0\n" \ -+ ".byte 6671f-6670f\n" \ -+ ".byte -1\n" \ -+ "6669: xchg %1, %0\n" \ -+ "6670:movl %1, %0\n" \ -+ "6671:\n" \ -+ ".previous\n" \ -+ : "=m" (var), "=r" (__set_mb_temp) \ -+ : "1" (value) \ -+ : "memory"); } while (0) -+#else -+#define smp_rmb() rmb() -+#define smp_mb() mb() - #define set_mb(var, value) do { xchg(&var, value); } while (0) -+#endif -+#define smp_read_barrier_depends() read_barrier_depends() - #else - #define smp_mb() barrier() - #define smp_rmb() barrier() diff --git a/patches/linux-2.6.14/i386-mach-io-check-nmi.patch b/patches/linux-2.6.14/i386-mach-io-check-nmi.patch new file mode 100644 index 0000000000..c42fd9b057 --- /dev/null +++ b/patches/linux-2.6.14/i386-mach-io-check-nmi.patch @@ -0,0 +1,45 @@ +diff -pruN ../pristine-linux-2.6.14/arch/i386/kernel/traps.c ./arch/i386/kernel/traps.c +--- ../pristine-linux-2.6.14/arch/i386/kernel/traps.c 2005-10-28 01:02:08.000000000 +0100 ++++ ./arch/i386/kernel/traps.c 2006-01-31 16:15:06.000000000 +0000 +@@ -532,18 +532,11 @@ static void mem_parity_error(unsigned ch + + static void io_check_error(unsigned char reason, struct pt_regs * regs) + { +- unsigned long i; +- + printk("NMI: IOCK error (debug interrupt?)\n"); + show_registers(regs); + + /* Re-enable the IOCK line, wait for a few seconds */ +- reason = (reason & 0xf) | 8; +- outb(reason, 0x61); +- i = 2000; +- while (--i) udelay(1000); +- reason &= ~8; +- outb(reason, 0x61); ++ clear_io_check_error(reason); + } + + static void unknown_nmi_error(unsigned char reason, struct pt_regs * regs) +diff -pruN ../pristine-linux-2.6.14/include/asm-i386/mach-default/mach_traps.h ./include/asm-i386/mach-default/mach_traps.h +--- ../pristine-linux-2.6.14/include/asm-i386/mach-default/mach_traps.h 2005-10-28 01:02:08.000000000 +0100 ++++ ./include/asm-i386/mach-default/mach_traps.h 2006-01-31 16:15:06.000000000 +0000 +@@ -15,6 +15,18 @@ static inline void clear_mem_error(unsig + outb(reason, 0x61); + } + ++static inline void clear_io_check_error(unsigned char reason) ++{ ++ unsigned long i; ++ ++ reason = (reason & 0xf) | 8; ++ outb(reason, 0x61); ++ i = 2000; ++ while (--i) udelay(1000); ++ reason &= ~8; ++ outb(reason, 0x61); ++} ++ + static inline unsigned char get_nmi_reason(void) + { + return inb(0x61); diff --git a/patches/linux-2.6.14/net-csum.patch b/patches/linux-2.6.14/net-csum.patch new file mode 100644 index 0000000000..78fe073427 --- /dev/null +++ b/patches/linux-2.6.14/net-csum.patch @@ -0,0 +1,46 @@ +diff -pruN ../pristine-linux-2.6.14/net/ipv4/netfilter/ip_nat_proto_tcp.c ./net/ipv4/netfilter/ip_nat_proto_tcp.c +--- ../pristine-linux-2.6.14/net/ipv4/netfilter/ip_nat_proto_tcp.c 2005-10-28 01:02:08.000000000 +0100 ++++ ./net/ipv4/netfilter/ip_nat_proto_tcp.c 2006-01-31 16:15:46.000000000 +0000 +@@ -129,10 +129,16 @@ tcp_manip_pkt(struct sk_buff **pskb, + if (hdrsize < sizeof(*hdr)) + return 1; + +- hdr->check = ip_nat_cheat_check(~oldip, newip, ++ if ((*pskb)->proto_csum_blank) { ++ hdr->check = ip_nat_cheat_check(oldip, ~newip, ++ ip_nat_cheat_check(oldport ^ 0xFFFF, ++ newport, hdr->check)); ++ } else { ++ hdr->check = ip_nat_cheat_check(~oldip, newip, + ip_nat_cheat_check(oldport ^ 0xFFFF, + newport, + hdr->check)); ++ } + return 1; + } + +diff -pruN ../pristine-linux-2.6.14/net/ipv4/netfilter/ip_nat_proto_udp.c ./net/ipv4/netfilter/ip_nat_proto_udp.c +--- ../pristine-linux-2.6.14/net/ipv4/netfilter/ip_nat_proto_udp.c 2005-10-28 01:02:08.000000000 +0100 ++++ ./net/ipv4/netfilter/ip_nat_proto_udp.c 2006-01-31 16:15:46.000000000 +0000 +@@ -113,11 +113,19 @@ udp_manip_pkt(struct sk_buff **pskb, + newport = tuple->dst.u.udp.port; + portptr = &hdr->dest; + } +- if (hdr->check) /* 0 is a special case meaning no checksum */ +- hdr->check = ip_nat_cheat_check(~oldip, newip, ++ ++ if (hdr->check) { /* 0 is a special case meaning no checksum */ ++ if ((*pskb)->proto_csum_blank) { ++ hdr->check = ip_nat_cheat_check(oldip, ~newip, ++ ip_nat_cheat_check(*portptr ^ 0xFFFF, ++ newport, hdr->check)); ++ } else { ++ hdr->check = ip_nat_cheat_check(~oldip, newip, + ip_nat_cheat_check(*portptr ^ 0xFFFF, + newport, + hdr->check)); ++ } ++ } + *portptr = newport; + return 1; + } diff --git a/patches/linux-2.6.14/pmd-shared.patch b/patches/linux-2.6.14/pmd-shared.patch new file mode 100644 index 0000000000..017ef168c3 --- /dev/null +++ b/patches/linux-2.6.14/pmd-shared.patch @@ -0,0 +1,111 @@ +diff -pru ../pristine-linux-2.6.14/arch/i386/mm/pageattr.c ./arch/i386/mm/pageattr.c +--- ../pristine-linux-2.6.14/arch/i386/mm/pageattr.c 2005-10-28 01:02:08.000000000 +0100 ++++ ./arch/i386/mm/pageattr.c 2006-01-31 15:49:38.000000000 +0000 +@@ -76,7 +76,7 @@ static void set_pmd_pte(pte_t *kpte, uns + unsigned long flags; + + set_pte_atomic(kpte, pte); /* change init_mm */ +- if (PTRS_PER_PMD > 1) ++ if (HAVE_SHARED_KERNEL_PMD) + return; + + spin_lock_irqsave(&pgd_lock, flags); +diff -pru ../pristine-linux-2.6.14/arch/i386/mm/pgtable.c ./arch/i386/mm/pgtable.c +--- ../pristine-linux-2.6.14/arch/i386/mm/pgtable.c 2005-10-28 01:02:08.000000000 +0100 ++++ ./arch/i386/mm/pgtable.c 2006-01-31 15:56:50.000000000 +0000 +@@ -212,9 +212,10 @@ void pgd_ctor(void *pgd, kmem_cache_t *c + spin_lock_irqsave(&pgd_lock, flags); + } + +- clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD, +- swapper_pg_dir + USER_PTRS_PER_PGD, +- KERNEL_PGD_PTRS); ++ if (PTRS_PER_PMD == 1 || HAVE_SHARED_KERNEL_PMD) ++ clone_pgd_range((pgd_t *)pgd + USER_PTRS_PER_PGD, ++ swapper_pg_dir + USER_PTRS_PER_PGD, ++ KERNEL_PGD_PTRS); + if (PTRS_PER_PMD > 1) + return; + +@@ -246,6 +247,30 @@ pgd_t *pgd_alloc(struct mm_struct *mm) + goto out_oom; + set_pgd(&pgd[i], __pgd(1 + __pa(pmd))); + } ++ ++ if (!HAVE_SHARED_KERNEL_PMD) { ++ unsigned long flags; ++ ++ for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) { ++ pmd_t *pmd = kmem_cache_alloc(pmd_cache, GFP_KERNEL); ++ if (!pmd) ++ goto out_oom; ++ set_pgd(&pgd[USER_PTRS_PER_PGD], __pgd(1 + __pa(pmd))); ++ } ++ ++ spin_lock_irqsave(&pgd_lock, flags); ++ for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) { ++ unsigned long v = (unsigned long)i << PGDIR_SHIFT; ++ pgd_t *kpgd = pgd_offset_k(v); ++ pud_t *kpud = pud_offset(kpgd, v); ++ pmd_t *kpmd = pmd_offset(kpud, v); ++ pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1); ++ memcpy(pmd, kpmd, PAGE_SIZE); ++ } ++ pgd_list_add(pgd); ++ spin_unlock_irqrestore(&pgd_lock, flags); ++ } ++ + return pgd; + + out_oom: +@@ -260,9 +285,23 @@ void pgd_free(pgd_t *pgd) + int i; + + /* in the PAE case user pgd entries are overwritten before usage */ +- if (PTRS_PER_PMD > 1) +- for (i = 0; i < USER_PTRS_PER_PGD; ++i) +- kmem_cache_free(pmd_cache, (void *)__va(pgd_val(pgd[i])-1)); ++ if (PTRS_PER_PMD > 1) { ++ for (i = 0; i < USER_PTRS_PER_PGD; ++i) { ++ pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1); ++ kmem_cache_free(pmd_cache, pmd); ++ } ++ if (!HAVE_SHARED_KERNEL_PMD) { ++ unsigned long flags; ++ spin_lock_irqsave(&pgd_lock, flags); ++ pgd_list_del(pgd); ++ spin_unlock_irqrestore(&pgd_lock, flags); ++ for (i = USER_PTRS_PER_PGD; i < PTRS_PER_PGD; i++) { ++ pmd_t *pmd = (void *)__va(pgd_val(pgd[i])-1); ++ memset(pmd, 0, PTRS_PER_PMD*sizeof(pmd_t)); ++ kmem_cache_free(pmd_cache, pmd); ++ } ++ } ++ } + /* in the non-PAE case, free_pgtables() clears user pgd entries */ + kmem_cache_free(pgd_cache, pgd); + } +diff -pru ../pristine-linux-2.6.14/include/asm-i386/pgtable-2level-defs.h ./include/asm-i386/pgtable-2level-defs.h +--- ../pristine-linux-2.6.14/include/asm-i386/pgtable-2level-defs.h 2005-10-28 01:02:08.000000000 +0100 ++++ ./include/asm-i386/pgtable-2level-defs.h 2006-01-31 15:49:38.000000000 +0000 +@@ -1,6 +1,8 @@ + #ifndef _I386_PGTABLE_2LEVEL_DEFS_H + #define _I386_PGTABLE_2LEVEL_DEFS_H + ++#define HAVE_SHARED_KERNEL_PMD 0 ++ + /* + * traditional i386 two-level paging structure: + */ +diff -pru ../pristine-linux-2.6.14/include/asm-i386/pgtable-3level-defs.h ./include/asm-i386/pgtable-3level-defs.h +--- ../pristine-linux-2.6.14/include/asm-i386/pgtable-3level-defs.h 2005-10-28 01:02:08.000000000 +0100 ++++ ./include/asm-i386/pgtable-3level-defs.h 2006-01-31 15:49:38.000000000 +0000 +@@ -1,6 +1,8 @@ + #ifndef _I386_PGTABLE_3LEVEL_DEFS_H + #define _I386_PGTABLE_3LEVEL_DEFS_H + ++#define HAVE_SHARED_KERNEL_PMD 1 ++ + /* + * PGDIR_SHIFT determines what a top-level page table entry can map + */ diff --git a/patches/linux-2.6.14/rcu-nohz.patch b/patches/linux-2.6.14/rcu-nohz.patch new file mode 100644 index 0000000000..b882db04e7 --- /dev/null +++ b/patches/linux-2.6.14/rcu-nohz.patch @@ -0,0 +1,16 @@ +diff -pru ../pristine-linux-2.6.14/kernel/rcupdate.c ./kernel/rcupdate.c +--- ../pristine-linux-2.6.14/kernel/rcupdate.c 2005-10-28 01:02:08.000000000 +0100 ++++ ./kernel/rcupdate.c 2006-01-31 16:04:36.000000000 +0000 +@@ -227,8 +227,11 @@ static void rcu_start_batch(struct rcu_c + */ + static void cpu_quiet(int cpu, struct rcu_ctrlblk *rcp, struct rcu_state *rsp) + { ++ cpumask_t mask; ++ + cpu_clear(cpu, rsp->cpumask); +- if (cpus_empty(rsp->cpumask)) { ++ cpus_andnot(mask, rsp->cpumask, nohz_cpu_mask); ++ if (cpus_empty(mask)) { + /* batch completed ! */ + rcp->completed = rcp->cur; + rcu_start_batch(rcp, rsp, 0); diff --git a/patches/linux-2.6.14/smp-alts.patch b/patches/linux-2.6.14/smp-alts.patch new file mode 100644 index 0000000000..e152e7fb6a --- /dev/null +++ b/patches/linux-2.6.14/smp-alts.patch @@ -0,0 +1,563 @@ +diff -pruN ../pristine-linux-2.6.14/arch/i386/Kconfig ./arch/i386/Kconfig +--- ../pristine-linux-2.6.14/arch/i386/Kconfig 2005-10-28 01:02:08.000000000 +0100 ++++ ./arch/i386/Kconfig 2006-01-31 16:05:37.000000000 +0000 +@@ -495,6 +495,19 @@ config SMP + + If you don't know what to do here, say N. + ++config SMP_ALTERNATIVES ++ bool "SMP alternatives support (EXPERIMENTAL)" ++ depends on SMP && EXPERIMENTAL ++ help ++ Try to reduce the overhead of running an SMP kernel on a uniprocessor ++ host slightly by replacing certain key instruction sequences ++ according to whether we currently have more than one CPU available. ++ This should provide a noticeable boost to performance when ++ running SMP kernels on UP machines, and have negligible impact ++ when running on an true SMP host. ++ ++ If unsure, say N. ++ + config NR_CPUS + int "Maximum number of CPUs (2-255)" + range 2 255 +diff -pruN ../pristine-linux-2.6.14/arch/i386/kernel/Makefile ./arch/i386/kernel/Makefile +--- ../pristine-linux-2.6.14/arch/i386/kernel/Makefile 2005-10-28 01:02:08.000000000 +0100 ++++ ./arch/i386/kernel/Makefile 2006-01-31 16:05:37.000000000 +0000 +@@ -34,6 +34,7 @@ obj-$(CONFIG_ACPI_SRAT) += srat.o + obj-$(CONFIG_HPET_TIMER) += time_hpet.o + obj-$(CONFIG_EFI) += efi.o efi_stub.o + obj-$(CONFIG_EARLY_PRINTK) += early_printk.o ++obj-$(CONFIG_SMP_ALTERNATIVES) += smpalts.o + + EXTRA_AFLAGS := -traditional + +diff -pruN ../pristine-linux-2.6.14/arch/i386/kernel/smpalts.c ./arch/i386/kernel/smpalts.c +--- ../pristine-linux-2.6.14/arch/i386/kernel/smpalts.c 1970-01-01 01:00:00.000000000 +0100 ++++ ./arch/i386/kernel/smpalts.c 2006-01-31 16:05:37.000000000 +0000 +@@ -0,0 +1,85 @@ ++#include ++#include ++#include ++#include ++#include ++ ++struct smp_replacement_record { ++ unsigned char targ_size; ++ unsigned char smp1_size; ++ unsigned char smp2_size; ++ unsigned char up_size; ++ unsigned char feature; ++ unsigned char data[0]; ++}; ++ ++struct smp_alternative_record { ++ void *targ_start; ++ struct smp_replacement_record *repl; ++}; ++ ++extern struct smp_alternative_record __start_smp_alternatives_table, ++ __stop_smp_alternatives_table; ++extern unsigned long __init_begin, __init_end; ++ ++void prepare_for_smp(void) ++{ ++ struct smp_alternative_record *r; ++ printk(KERN_INFO "Enabling SMP...\n"); ++ for (r = &__start_smp_alternatives_table; ++ r != &__stop_smp_alternatives_table; ++ r++) { ++ BUG_ON(r->repl->targ_size < r->repl->smp1_size); ++ BUG_ON(r->repl->targ_size < r->repl->smp2_size); ++ BUG_ON(r->repl->targ_size < r->repl->up_size); ++ if (system_state == SYSTEM_RUNNING && ++ r->targ_start >= (void *)&__init_begin && ++ r->targ_start < (void *)&__init_end) ++ continue; ++ if (r->repl->feature != (unsigned char)-1 && ++ boot_cpu_has(r->repl->feature)) { ++ memcpy(r->targ_start, ++ r->repl->data + r->repl->smp1_size, ++ r->repl->smp2_size); ++ memset(r->targ_start + r->repl->smp2_size, ++ 0x90, ++ r->repl->targ_size - r->repl->smp2_size); ++ } else { ++ memcpy(r->targ_start, ++ r->repl->data, ++ r->repl->smp1_size); ++ memset(r->targ_start + r->repl->smp1_size, ++ 0x90, ++ r->repl->targ_size - r->repl->smp1_size); ++ } ++ } ++ /* Paranoia */ ++ asm volatile ("jmp 1f\n1:"); ++ mb(); ++} ++ ++void unprepare_for_smp(void) ++{ ++ struct smp_alternative_record *r; ++ printk(KERN_INFO "Disabling SMP...\n"); ++ for (r = &__start_smp_alternatives_table; ++ r != &__stop_smp_alternatives_table; ++ r++) { ++ BUG_ON(r->repl->targ_size < r->repl->smp1_size); ++ BUG_ON(r->repl->targ_size < r->repl->smp2_size); ++ BUG_ON(r->repl->targ_size < r->repl->up_size); ++ if (system_state == SYSTEM_RUNNING && ++ r->targ_start >= (void *)&__init_begin && ++ r->targ_start < (void *)&__init_end) ++ continue; ++ memcpy(r->targ_start, ++ r->repl->data + r->repl->smp1_size + r->repl->smp2_size, ++ r->repl->up_size); ++ memset(r->targ_start + r->repl->up_size, ++ 0x90, ++ r->repl->targ_size - r->repl->up_size); ++ } ++ /* Paranoia */ ++ asm volatile ("jmp 1f\n1:"); ++ mb(); ++} +diff -pruN ../pristine-linux-2.6.14/arch/i386/kernel/smpboot.c ./arch/i386/kernel/smpboot.c +--- ../pristine-linux-2.6.14/arch/i386/kernel/smpboot.c 2005-10-28 01:02:08.000000000 +0100 ++++ ./arch/i386/kernel/smpboot.c 2006-01-31 16:06:47.000000000 +0000 +@@ -1185,6 +1185,11 @@ static void __init smp_boot_cpus(unsigne + if (max_cpus <= cpucount+1) + continue; + ++#ifdef CONFIG_SMP_ALTERNATIVES ++ if (kicked == 1) ++ prepare_for_smp(); ++#endif ++ + if (((cpu = alloc_cpu_id()) <= 0) || do_boot_cpu(apicid, cpu)) + printk("CPU #%d not responding - cannot use it.\n", + apicid); +@@ -1355,6 +1360,11 @@ int __devinit __cpu_up(unsigned int cpu) + return -EIO; + } + ++#ifdef CONFIG_SMP_ALTERNATIVES ++ if (num_online_cpus() == 1) ++ prepare_for_smp(); ++#endif ++ + local_irq_enable(); + per_cpu(cpu_state, cpu) = CPU_UP_PREPARE; + /* Unleash the CPU! */ +diff -pruN ../pristine-linux-2.6.14/arch/i386/kernel/vmlinux.lds.S ./arch/i386/kernel/vmlinux.lds.S +--- ../pristine-linux-2.6.14/arch/i386/kernel/vmlinux.lds.S 2005-10-28 01:02:08.000000000 +0100 ++++ ./arch/i386/kernel/vmlinux.lds.S 2006-01-31 16:05:37.000000000 +0000 +@@ -34,6 +34,13 @@ SECTIONS + __ex_table : AT(ADDR(__ex_table) - LOAD_OFFSET) { *(__ex_table) } + __stop___ex_table = .; + ++ . = ALIGN(16); ++ __start_smp_alternatives_table = .; ++ __smp_alternatives : { *(__smp_alternatives) } ++ __stop_smp_alternatives_table = .; ++ ++ __smp_replacements : { *(__smp_replacements) } ++ + RODATA + + /* writeable */ +diff -pruN ../pristine-linux-2.6.14/include/asm-i386/atomic.h ./include/asm-i386/atomic.h +--- ../pristine-linux-2.6.14/include/asm-i386/atomic.h 2005-10-28 01:02:08.000000000 +0100 ++++ ./include/asm-i386/atomic.h 2006-01-31 16:05:37.000000000 +0000 +@@ -4,18 +4,13 @@ + #include + #include + #include ++#include + + /* + * Atomic operations that C can't guarantee us. Useful for + * resource counting etc.. + */ + +-#ifdef CONFIG_SMP +-#define LOCK "lock ; " +-#else +-#define LOCK "" +-#endif +- + /* + * Make sure gcc doesn't try to be clever and move things around + * on us. We need to use _exactly_ the address the user gave us, +diff -pruN ../pristine-linux-2.6.14/include/asm-i386/bitops.h ./include/asm-i386/bitops.h +--- ../pristine-linux-2.6.14/include/asm-i386/bitops.h 2005-10-28 01:02:08.000000000 +0100 ++++ ./include/asm-i386/bitops.h 2006-01-31 16:05:37.000000000 +0000 +@@ -7,6 +7,7 @@ + + #include + #include ++#include + + /* + * These have to be done with inline assembly: that way the bit-setting +@@ -16,12 +17,6 @@ + * bit 0 is the LSB of addr; bit 32 is the LSB of (addr+1). + */ + +-#ifdef CONFIG_SMP +-#define LOCK_PREFIX "lock ; " +-#else +-#define LOCK_PREFIX "" +-#endif +- + #define ADDR (*(volatile long *) addr) + + /** +@@ -41,7 +36,7 @@ + */ + static inline void set_bit(int nr, volatile unsigned long * addr) + { +- __asm__ __volatile__( LOCK_PREFIX ++ __asm__ __volatile__( LOCK + "btsl %1,%0" + :"=m" (ADDR) + :"Ir" (nr)); +@@ -76,7 +71,7 @@ static inline void __set_bit(int nr, vol + */ + static inline void clear_bit(int nr, volatile unsigned long * addr) + { +- __asm__ __volatile__( LOCK_PREFIX ++ __asm__ __volatile__( LOCK + "btrl %1,%0" + :"=m" (ADDR) + :"Ir" (nr)); +@@ -121,7 +116,7 @@ static inline void __change_bit(int nr, + */ + static inline void change_bit(int nr, volatile unsigned long * addr) + { +- __asm__ __volatile__( LOCK_PREFIX ++ __asm__ __volatile__( LOCK + "btcl %1,%0" + :"=m" (ADDR) + :"Ir" (nr)); +@@ -140,7 +135,7 @@ static inline int test_and_set_bit(int n + { + int oldbit; + +- __asm__ __volatile__( LOCK_PREFIX ++ __asm__ __volatile__( LOCK + "btsl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"=m" (ADDR) + :"Ir" (nr) : "memory"); +@@ -180,7 +175,7 @@ static inline int test_and_clear_bit(int + { + int oldbit; + +- __asm__ __volatile__( LOCK_PREFIX ++ __asm__ __volatile__( LOCK + "btrl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"=m" (ADDR) + :"Ir" (nr) : "memory"); +@@ -231,7 +226,7 @@ static inline int test_and_change_bit(in + { + int oldbit; + +- __asm__ __volatile__( LOCK_PREFIX ++ __asm__ __volatile__( LOCK + "btcl %2,%1\n\tsbbl %0,%0" + :"=r" (oldbit),"=m" (ADDR) + :"Ir" (nr) : "memory"); +diff -pruN ../pristine-linux-2.6.14/include/asm-i386/rwsem.h ./include/asm-i386/rwsem.h +--- ../pristine-linux-2.6.14/include/asm-i386/rwsem.h 2005-10-28 01:02:08.000000000 +0100 ++++ ./include/asm-i386/rwsem.h 2006-01-31 16:05:37.000000000 +0000 +@@ -40,6 +40,7 @@ + + #include + #include ++#include + + struct rwsem_waiter; + +@@ -99,7 +100,7 @@ static inline void __down_read(struct rw + { + __asm__ __volatile__( + "# beginning down_read\n\t" +-LOCK_PREFIX " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value */ ++LOCK " incl (%%eax)\n\t" /* adds 0x00000001, returns the old value */ + " js 2f\n\t" /* jump if we weren't granted the lock */ + "1:\n\t" + LOCK_SECTION_START("") +@@ -130,7 +131,7 @@ static inline int __down_read_trylock(st + " movl %1,%2\n\t" + " addl %3,%2\n\t" + " jle 2f\n\t" +-LOCK_PREFIX " cmpxchgl %2,%0\n\t" ++LOCK " cmpxchgl %2,%0\n\t" + " jnz 1b\n\t" + "2:\n\t" + "# ending __down_read_trylock\n\t" +@@ -150,7 +151,7 @@ static inline void __down_write(struct r + tmp = RWSEM_ACTIVE_WRITE_BIAS; + __asm__ __volatile__( + "# beginning down_write\n\t" +-LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */ ++LOCK " xadd %%edx,(%%eax)\n\t" /* subtract 0x0000ffff, returns the old value */ + " testl %%edx,%%edx\n\t" /* was the count 0 before? */ + " jnz 2f\n\t" /* jump if we weren't granted the lock */ + "1:\n\t" +@@ -188,7 +189,7 @@ static inline void __up_read(struct rw_s + __s32 tmp = -RWSEM_ACTIVE_READ_BIAS; + __asm__ __volatile__( + "# beginning __up_read\n\t" +-LOCK_PREFIX " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */ ++LOCK " xadd %%edx,(%%eax)\n\t" /* subtracts 1, returns the old value */ + " js 2f\n\t" /* jump if the lock is being waited upon */ + "1:\n\t" + LOCK_SECTION_START("") +@@ -214,7 +215,7 @@ static inline void __up_write(struct rw_ + __asm__ __volatile__( + "# beginning __up_write\n\t" + " movl %2,%%edx\n\t" +-LOCK_PREFIX " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */ ++LOCK " xaddl %%edx,(%%eax)\n\t" /* tries to transition 0xffff0001 -> 0x00000000 */ + " jnz 2f\n\t" /* jump if the lock is being waited upon */ + "1:\n\t" + LOCK_SECTION_START("") +@@ -239,7 +240,7 @@ static inline void __downgrade_write(str + { + __asm__ __volatile__( + "# beginning __downgrade_write\n\t" +-LOCK_PREFIX " addl %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */ ++LOCK " addl %2,(%%eax)\n\t" /* transitions 0xZZZZ0001 -> 0xYYYY0001 */ + " js 2f\n\t" /* jump if the lock is being waited upon */ + "1:\n\t" + LOCK_SECTION_START("") +@@ -263,7 +264,7 @@ LOCK_PREFIX " addl %2,(%%eax)\n\t" + static inline void rwsem_atomic_add(int delta, struct rw_semaphore *sem) + { + __asm__ __volatile__( +-LOCK_PREFIX "addl %1,%0" ++LOCK "addl %1,%0" + : "=m"(sem->count) + : "ir"(delta), "m"(sem->count)); + } +@@ -276,7 +277,7 @@ static inline int rwsem_atomic_update(in + int tmp = delta; + + __asm__ __volatile__( +-LOCK_PREFIX "xadd %0,(%2)" ++LOCK "xadd %0,(%2)" + : "+r"(tmp), "=m"(sem->count) + : "r"(sem), "m"(sem->count) + : "memory"); +diff -pruN ../pristine-linux-2.6.14/include/asm-i386/smp_alt.h ./include/asm-i386/smp_alt.h +--- ../pristine-linux-2.6.14/include/asm-i386/smp_alt.h 1970-01-01 01:00:00.000000000 +0100 ++++ ./include/asm-i386/smp_alt.h 2006-01-31 16:05:37.000000000 +0000 +@@ -0,0 +1,32 @@ ++#ifndef __ASM_SMP_ALT_H__ ++#define __ASM_SMP_ALT_H__ ++ ++#include ++ ++#ifdef CONFIG_SMP ++#if defined(CONFIG_SMP_ALTERNATIVES) && !defined(MODULE) ++#define LOCK \ ++ "6677: nop\n" \ ++ ".section __smp_alternatives,\"a\"\n" \ ++ ".long 6677b\n" \ ++ ".long 6678f\n" \ ++ ".previous\n" \ ++ ".section __smp_replacements,\"a\"\n" \ ++ "6678: .byte 1\n" \ ++ ".byte 1\n" \ ++ ".byte 0\n" \ ++ ".byte 1\n" \ ++ ".byte -1\n" \ ++ "lock\n" \ ++ "nop\n" \ ++ ".previous\n" ++void prepare_for_smp(void); ++void unprepare_for_smp(void); ++#else ++#define LOCK "lock ; " ++#endif ++#else ++#define LOCK "" ++#endif ++ ++#endif /* __ASM_SMP_ALT_H__ */ +diff -pruN ../pristine-linux-2.6.14/include/asm-i386/spinlock.h ./include/asm-i386/spinlock.h +--- ../pristine-linux-2.6.14/include/asm-i386/spinlock.h 2005-10-28 01:02:08.000000000 +0100 ++++ ./include/asm-i386/spinlock.h 2006-01-31 16:09:52.000000000 +0000 +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + + /* + * Your basic SMP spinlocks, allowing only a single CPU anywhere +@@ -23,7 +24,8 @@ + + #define __raw_spin_lock_string \ + "\n1:\t" \ +- "lock ; decb %0\n\t" \ ++ LOCK \ ++ "decb %0\n\t" \ + "jns 3f\n" \ + "2:\t" \ + "rep;nop\n\t" \ +@@ -34,7 +36,8 @@ + + #define __raw_spin_lock_string_flags \ + "\n1:\t" \ +- "lock ; decb %0\n\t" \ ++ LOCK \ ++ "decb %0\n\t" \ + "jns 4f\n\t" \ + "2:\t" \ + "testl $0x200, %1\n\t" \ +@@ -65,10 +68,34 @@ static inline void __raw_spin_lock_flags + static inline int __raw_spin_trylock(raw_spinlock_t *lock) + { + char oldval; ++#ifdef CONFIG_SMP_ALTERNATIVES + __asm__ __volatile__( +- "xchgb %b0,%1" ++ "1:movb %1,%b0\n" ++ "movb $0,%1\n" ++ "2:" ++ ".section __smp_alternatives,\"a\"\n" ++ ".long 1b\n" ++ ".long 3f\n" ++ ".previous\n" ++ ".section __smp_replacements,\"a\"\n" ++ "3: .byte 2b - 1b\n" ++ ".byte 5f-4f\n" ++ ".byte 0\n" ++ ".byte 6f-5f\n" ++ ".byte -1\n" ++ "4: xchgb %b0,%1\n" ++ "5: movb %1,%b0\n" ++ "movb $0,%1\n" ++ "6:\n" ++ ".previous\n" + :"=q" (oldval), "=m" (lock->slock) + :"0" (0) : "memory"); ++#else ++ __asm__ __volatile__( ++ "xchgb %b0,%1\n" ++ :"=q" (oldval), "=m" (lock->slock) ++ :"0" (0) : "memory"); ++#endif + return oldval > 0; + } + +@@ -178,12 +205,12 @@ static inline int __raw_write_trylock(ra + + static inline void __raw_read_unlock(raw_rwlock_t *rw) + { +- asm volatile("lock ; incl %0" :"=m" (rw->lock) : : "memory"); ++ asm volatile(LOCK "incl %0" :"=m" (rw->lock) : : "memory"); + } + + static inline void __raw_write_unlock(raw_rwlock_t *rw) + { +- asm volatile("lock ; addl $" RW_LOCK_BIAS_STR ", %0" ++ asm volatile(LOCK "addl $" RW_LOCK_BIAS_STR ", %0" + : "=m" (rw->lock) : : "memory"); + } + +diff -pruN ../pristine-linux-2.6.14/include/asm-i386/system.h ./include/asm-i386/system.h +--- ../pristine-linux-2.6.14/include/asm-i386/system.h 2005-10-28 01:02:08.000000000 +0100 ++++ ./include/asm-i386/system.h 2006-01-31 16:05:37.000000000 +0000 +@@ -5,7 +5,7 @@ + #include + #include + #include +-#include /* for LOCK_PREFIX */ ++#include + + #ifdef __KERNEL__ + +@@ -267,19 +267,19 @@ static inline unsigned long __cmpxchg(vo + unsigned long prev; + switch (size) { + case 1: +- __asm__ __volatile__(LOCK_PREFIX "cmpxchgb %b1,%2" ++ __asm__ __volatile__(LOCK "cmpxchgb %b1,%2" + : "=a"(prev) + : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + case 2: +- __asm__ __volatile__(LOCK_PREFIX "cmpxchgw %w1,%2" ++ __asm__ __volatile__(LOCK "cmpxchgw %w1,%2" + : "=a"(prev) + : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); + return prev; + case 4: +- __asm__ __volatile__(LOCK_PREFIX "cmpxchgl %1,%2" ++ __asm__ __volatile__(LOCK "cmpxchgl %1,%2" + : "=a"(prev) + : "q"(new), "m"(*__xg(ptr)), "0"(old) + : "memory"); +@@ -443,11 +443,55 @@ struct alt_instr { + #endif + + #ifdef CONFIG_SMP +-#define smp_mb() mb() +-#define smp_rmb() rmb() + #define smp_wmb() wmb() +-#define smp_read_barrier_depends() read_barrier_depends() ++#if defined(CONFIG_SMP_ALTERNATIVES) && !defined(MODULE) ++#define smp_alt_mb(instr) \ ++__asm__ __volatile__("6667:\nnop\nnop\nnop\nnop\nnop\nnop\n6668:\n" \ ++ ".section __smp_alternatives,\"a\"\n" \ ++ ".long 6667b\n" \ ++ ".long 6673f\n" \ ++ ".previous\n" \ ++ ".section __smp_replacements,\"a\"\n" \ ++ "6673:.byte 6668b-6667b\n" \ ++ ".byte 6670f-6669f\n" \ ++ ".byte 6671f-6670f\n" \ ++ ".byte 0\n" \ ++ ".byte %c0\n" \ ++ "6669:lock;addl $0,0(%%esp)\n" \ ++ "6670:" instr "\n" \ ++ "6671:\n" \ ++ ".previous\n" \ ++ : \ ++ : "i" (X86_FEATURE_XMM2) \ ++ : "memory") ++#define smp_rmb() smp_alt_mb("lfence") ++#define smp_mb() smp_alt_mb("mfence") ++#define set_mb(var, value) do { \ ++unsigned long __set_mb_temp; \ ++__asm__ __volatile__("6667:movl %1, %0\n6668:\n" \ ++ ".section __smp_alternatives,\"a\"\n" \ ++ ".long 6667b\n" \ ++ ".long 6673f\n" \ ++ ".previous\n" \ ++ ".section __smp_replacements,\"a\"\n" \ ++ "6673: .byte 6668b-6667b\n" \ ++ ".byte 6670f-6669f\n" \ ++ ".byte 0\n" \ ++ ".byte 6671f-6670f\n" \ ++ ".byte -1\n" \ ++ "6669: xchg %1, %0\n" \ ++ "6670:movl %1, %0\n" \ ++ "6671:\n" \ ++ ".previous\n" \ ++ : "=m" (var), "=r" (__set_mb_temp) \ ++ : "1" (value) \ ++ : "memory"); } while (0) ++#else ++#define smp_rmb() rmb() ++#define smp_mb() mb() + #define set_mb(var, value) do { xchg(&var, value); } while (0) ++#endif ++#define smp_read_barrier_depends() read_barrier_depends() + #else + #define smp_mb() barrier() + #define smp_rmb() barrier() -- cgit v1.2.3