📄 1018.kernel-preempt.patch
字号:
@@ -417,6 +420,7 @@ error = -EIO; } do_update_one(NULL);+ preempt_enable(); out_free: for (i = 0; i < smp_num_cpus; i++) {@@ -431,6 +435,7 @@ } } out:+ return error; } diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/i386/kernel/msr.c linuxmips-2.4.30/arch/i386/kernel/msr.c--- linuxmips-2.4.30.ref/arch/i386/kernel/msr.c 2005-08-29 11:42:15.000000000 -0700+++ linuxmips-2.4.30/arch/i386/kernel/msr.c 2005-08-29 11:43:45.000000000 -0700@@ -114,8 +114,9 @@ { struct msr_command cmd; + preempt_disable(); if ( cpu == smp_processor_id() ) {- return wrmsr_eio(reg, eax, edx);+ cmd.err = wrmsr_eio(reg, eax, edx); } else { cmd.cpu = cpu; cmd.reg = reg;@@ -123,16 +124,19 @@ cmd.data[1] = edx; smp_call_function(msr_smp_wrmsr, &cmd, 1, 1);- return cmd.err; }++ preempt_enable();+ return cmd.err; } static inline int do_rdmsr(int cpu, u32 reg, u32 *eax, u32 *edx) { struct msr_command cmd; + preempt_disable(); if ( cpu == smp_processor_id() ) {- return rdmsr_eio(reg, eax, edx);+ cmd.err = rdmsr_eio(reg, eax, edx); } else { cmd.cpu = cpu; cmd.reg = reg;@@ -141,9 +145,10 @@ *eax = cmd.data[0]; *edx = cmd.data[1];-- return cmd.err; }++ preempt_enable();+ return cmd.err; } #else /* ! CONFIG_SMP */diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/i386/kernel/mtrr.c linuxmips-2.4.30/arch/i386/kernel/mtrr.c--- linuxmips-2.4.30.ref/arch/i386/kernel/mtrr.c 2005-08-29 11:42:15.000000000 -0700+++ linuxmips-2.4.30/arch/i386/kernel/mtrr.c 2005-08-29 11:43:45.000000000 -0700@@ -1065,6 +1065,9 @@ wait_barrier_execute = TRUE; wait_barrier_cache_enable = TRUE; atomic_set (&undone_count, smp_num_cpus - 1);++ preempt_disable();+ /* Start the ball rolling on other CPUs */ if (smp_call_function (ipi_handler, &data, 1, 0) != 0) panic ("mtrr: timed out waiting for other CPUs\n");@@ -1090,6 +1093,9 @@ then enable the local cache and return */ wait_barrier_cache_enable = FALSE; set_mtrr_done (&ctxt);++ preempt_enable();+ } /* End Function set_mtrr_smp */ diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/i386/kernel/smp.c linuxmips-2.4.30/arch/i386/kernel/smp.c--- linuxmips-2.4.30.ref/arch/i386/kernel/smp.c 2005-08-29 11:42:15.000000000 -0700+++ linuxmips-2.4.30/arch/i386/kernel/smp.c 2005-08-29 11:43:45.000000000 -0700@@ -360,10 +360,14 @@ asmlinkage void smp_invalidate_interrupt (void) {- unsigned long cpu = smp_processor_id();+ unsigned long cpu;++ preempt_disable();++ cpu = smp_processor_id(); if (!test_bit(cpu, &flush_cpumask))- return;+ goto out; /* * This was a BUG() but until someone can quote me the * line from the intel manual that guarantees an IPI to@@ -384,6 +388,8 @@ } ack_APIC_irq(); clear_bit(cpu, &flush_cpumask);+out:+ preempt_enable(); } static void flush_tlb_others (unsigned long cpumask, struct mm_struct *mm,@@ -433,17 +439,22 @@ void flush_tlb_current_task(void) { struct mm_struct *mm = current->mm;- unsigned long cpu_mask = mm->cpu_vm_mask & ~(1 << smp_processor_id());+ unsigned long cpu_mask; + preempt_disable();+ cpu_mask = mm->cpu_vm_mask & ~(1UL << smp_processor_id()); local_flush_tlb(); if (cpu_mask) flush_tlb_others(cpu_mask, mm, FLUSH_ALL);+ preempt_enable(); } void flush_tlb_mm (struct mm_struct * mm) {- unsigned long cpu_mask = mm->cpu_vm_mask & ~(1 << smp_processor_id());+ unsigned long cpu_mask; + preempt_disable();+ cpu_mask = mm->cpu_vm_mask & ~(1UL << smp_processor_id()); if (current->active_mm == mm) { if (current->mm) local_flush_tlb();@@ -452,13 +463,16 @@ } if (cpu_mask) flush_tlb_others(cpu_mask, mm, FLUSH_ALL);+ preempt_enable(); } void flush_tlb_page(struct vm_area_struct * vma, unsigned long va) { struct mm_struct *mm = vma->vm_mm;- unsigned long cpu_mask = mm->cpu_vm_mask & ~(1 << smp_processor_id());+ unsigned long cpu_mask; + preempt_disable();+ cpu_mask = mm->cpu_vm_mask & ~(1UL << smp_processor_id()); if (current->active_mm == mm) { if(current->mm) __flush_tlb_one(va);@@ -468,6 +482,7 @@ if (cpu_mask) flush_tlb_others(cpu_mask, mm, va);+ preempt_enable(); } static inline void do_flush_tlb_all_local(void)@@ -486,9 +501,11 @@ void flush_tlb_all(void) {+ preempt_disable(); smp_call_function (flush_tlb_all_ipi,0,1,1); do_flush_tlb_all_local();+ preempt_enable(); } /*@@ -572,7 +589,7 @@ static void stop_this_cpu (void * dummy) { /*- * Remove this CPU:+ * Remove this CPU: assumes preemption is disabled */ clear_bit(smp_processor_id(), &cpu_online_map); __cli();diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/i386/kernel/traps.c linuxmips-2.4.30/arch/i386/kernel/traps.c--- linuxmips-2.4.30.ref/arch/i386/kernel/traps.c 2005-08-29 11:42:15.000000000 -0700+++ linuxmips-2.4.30/arch/i386/kernel/traps.c 2005-08-29 11:43:45.000000000 -0700@@ -751,6 +751,8 @@ * * Careful.. There are problems with IBM-designed IRQ13 behaviour. * Don't touch unless you *really* know how it works.+ *+ * Must be called with kernel preemption disabled. */ asmlinkage void math_state_restore(struct pt_regs regs) {diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/i386/lib/dec_and_lock.c linuxmips-2.4.30/arch/i386/lib/dec_and_lock.c--- linuxmips-2.4.30.ref/arch/i386/lib/dec_and_lock.c 2005-08-29 11:42:15.000000000 -0700+++ linuxmips-2.4.30/arch/i386/lib/dec_and_lock.c 2005-08-29 11:43:45.000000000 -0700@@ -8,6 +8,7 @@ */ #include <linux/spinlock.h>+#include <linux/sched.h> #include <asm/atomic.h> int atomic_dec_and_lock(atomic_t *atomic, spinlock_t *lock)diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/i386/mm/init.c linuxmips-2.4.30/arch/i386/mm/init.c--- linuxmips-2.4.30.ref/arch/i386/mm/init.c 2005-08-29 11:42:15.000000000 -0700+++ linuxmips-2.4.30/arch/i386/mm/init.c 2005-08-29 11:43:45.000000000 -0700@@ -46,6 +46,7 @@ int do_check_pgt_cache(int low, int high) { int freed = 0;+ preempt_disable(); if(pgtable_cache_size > high) { do { if (pgd_quicklist) {@@ -62,6 +63,7 @@ } } while(pgtable_cache_size > low); }+ preempt_enable(); return freed; } diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/config-shared.in linuxmips-2.4.30/arch/mips/config-shared.in--- linuxmips-2.4.30.ref/arch/mips/config-shared.in 2005-08-29 11:42:15.000000000 -0700+++ linuxmips-2.4.30/arch/mips/config-shared.in 2005-08-29 11:43:45.000000000 -0700@@ -872,6 +872,7 @@ define_bool CONFIG_HOTPLUG_PCI n fi +dep_bool 'Preemptible Kernel' CONFIG_PREEMPT $CONFIG_NEW_IRQ bool 'System V IPC' CONFIG_SYSVIPC bool 'BSD Process Accounting' CONFIG_BSD_PROCESS_ACCT bool 'Sysctl support' CONFIG_SYSCTLdiff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/defconfig linuxmips-2.4.30/arch/mips/defconfig--- linuxmips-2.4.30.ref/arch/mips/defconfig 2005-08-29 11:41:35.000000000 -0700+++ linuxmips-2.4.30/arch/mips/defconfig 2005-08-29 11:44:23.000000000 -0700@@ -137,6 +137,7 @@ # CONFIG_HOTPLUG is not set # CONFIG_PCMCIA is not set # CONFIG_HOTPLUG_PCI is not set+CONFIG_PREEMPT=y CONFIG_SYSVIPC=y # CONFIG_BSD_PROCESS_ACCT is not set CONFIG_SYSCTL=ydiff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/kernel/i8259.c linuxmips-2.4.30/arch/mips/kernel/i8259.c--- linuxmips-2.4.30.ref/arch/mips/kernel/i8259.c 2005-08-29 11:42:15.000000000 -0700+++ linuxmips-2.4.30/arch/mips/kernel/i8259.c 2005-08-29 11:43:45.000000000 -0700@@ -8,6 +8,7 @@ * Copyright (C) 1992 Linus Torvalds * Copyright (C) 1994 - 2000 Ralf Baechle */+#include <linux/sched.h> #include <linux/delay.h> #include <linux/init.h> #include <linux/ioport.h>diff -Naur --exclude=CVS --exclude='*.o' --exclude='*.a' --exclude='*.so' --exclude='*.elf' --exclude=System.map --exclude=Makefile.d --exclude='*log' --exclude='*log2' --exclude='*~' --exclude='.*~' --exclude='.#*' --exclude='*.bak' --exclude='*.orig' --exclude='*.rej' --exclude='core.[0-9]*' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=.depend --exclude='.*.o.flags' --exclude='*.gz' --exclude=vmlinux --exclude=vmlinux.bin --exclude=yamon-02.06-SIGMADESIGNS-01_el.bin linuxmips-2.4.30.ref/arch/mips/kernel/irq.c linuxmips-2.4.30/arch/mips/kernel/irq.c--- linuxmips-2.4.30.ref/arch/mips/kernel/irq.c 2005-08-29 11:42:15.000000000 -0700+++ linuxmips-2.4.30/arch/mips/kernel/irq.c 2005-08-29 11:43:45.000000000 -0700@@ -8,6 +8,8 @@ * Copyright (C) 1992 Linus Torvalds * Copyright (C) 1994 - 2000 Ralf Baechle */++#include <linux/sched.h> #include <linux/config.h> #include <linux/kernel.h> #include <linux/delay.h>@@ -19,11 +21,13 @@ #include <linux/slab.h> #include <linux/mm.h> #include <linux/random.h>-#include <linux/sched.h>+#include <linux/spinlock.h>+#include <linux/ptrace.h> #include <asm/atomic.h> #include <asm/system.h> #include <asm/uaccess.h>+#include <asm/debug.h> /* * Controller mappings for all interrupt sources:@@ -429,6 +433,8 @@ struct irqaction * action; unsigned int status; + preempt_disable();+
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -