make x86 MSR driver preempt safe

From: davej@codemonkey.org.uk
Date: Mon Mar 24 2003 - 11:41:45 EST


diff -urpN --exclude-from=/home/davej/.exclude bk-linus/arch/i386/kernel/msr.c linux-2.5/arch/i386/kernel/msr.c
--- bk-linus/arch/i386/kernel/msr.c 2003-03-08 09:56:25.000000000 +0000
+++ linux-2.5/arch/i386/kernel/msr.c 2003-03-18 21:22:30.000000000 +0000
@@ -115,9 +115,13 @@ static void msr_smp_rdmsr(void *cmd_bloc
 static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx)
 {
   struct msr_command cmd;
+ int ret;
 
+ preempt_disable();
   if ( cpu == smp_processor_id() ) {
- return wrmsr_eio(reg, eax, edx);
+ ret = wrmsr_eio(reg, eax, edx);
+ preempt_enable();
+ return ret;
   } else {
     cmd.cpu = cpu;
     cmd.reg = reg;
@@ -125,6 +129,7 @@ static inline int do_wrmsr(int cpu, u32
     cmd.data[1] = edx;
     
     smp_call_function(msr_smp_wrmsr, &cmd, 1, 1);
+ preempt_enable();
     return cmd.err;
   }
 }
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Mar 31 2003 - 22:00:16 EST