Commit 30238121 authored by Dave Jones's avatar Dave Jones Committed by Linus Torvalds

[PATCH] Preemption fixes for x86 MSR driver.

wrmsr is ok, but needs cleans up, second part (rdmsr)
is currently broken.
parent b4ffe57a
...@@ -120,8 +120,6 @@ static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx) ...@@ -120,8 +120,6 @@ static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx)
preempt_disable(); preempt_disable();
if ( cpu == smp_processor_id() ) { if ( cpu == smp_processor_id() ) {
ret = wrmsr_eio(reg, eax, edx); ret = wrmsr_eio(reg, eax, edx);
preempt_enable();
return ret;
} else { } else {
cmd.cpu = cpu; cmd.cpu = cpu;
cmd.reg = reg; cmd.reg = reg;
...@@ -129,17 +127,20 @@ static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx) ...@@ -129,17 +127,20 @@ static inline int do_wrmsr(int cpu, u32 reg, u32 eax, u32 edx)
cmd.data[1] = edx; cmd.data[1] = edx;
smp_call_function(msr_smp_wrmsr, &cmd, 1, 1); smp_call_function(msr_smp_wrmsr, &cmd, 1, 1);
preempt_enable(); ret = cmd.err;
return cmd.err;
} }
preempt_enable();
return ret;
} }
static inline int do_rdmsr(int cpu, u32 reg, u32 *eax, u32 *edx) static inline int do_rdmsr(int cpu, u32 reg, u32 *eax, u32 *edx)
{ {
struct msr_command cmd; struct msr_command cmd;
int ret;
preempt_disable();
if ( cpu == smp_processor_id() ) { if ( cpu == smp_processor_id() ) {
return rdmsr_eio(reg, eax, edx); ret = rdmsr_eio(reg, eax, edx);
} else { } else {
cmd.cpu = cpu; cmd.cpu = cpu;
cmd.reg = reg; cmd.reg = reg;
...@@ -149,8 +150,10 @@ static inline int do_rdmsr(int cpu, u32 reg, u32 *eax, u32 *edx) ...@@ -149,8 +150,10 @@ static inline int do_rdmsr(int cpu, u32 reg, u32 *eax, u32 *edx)
*eax = cmd.data[0]; *eax = cmd.data[0];
*edx = cmd.data[1]; *edx = cmd.data[1];
return cmd.err; ret = cmd.err;
} }
preempt_enable();
return ret;
} }
#else /* ! CONFIG_SMP */ #else /* ! CONFIG_SMP */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment