Commit 5f1f935c authored by Avi Kivity's avatar Avi Kivity Committed by Thomas Gleixner

i386: simplify smp_call_function_single() call sequence in msr-on-cpu

smp_call_function_single() now knows how to call the function on the
current cpu.

[ tglx: arch/x86 adaptation ]

Cc: H. Peter Anvin <hpa@zytor.com>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
Signed-off-by: default avatarAndi Kleen <ak@suse.de>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
parent 4a40cb1e
...@@ -26,27 +26,18 @@ static void __rdmsr_safe_on_cpu(void *info) ...@@ -26,27 +26,18 @@ static void __rdmsr_safe_on_cpu(void *info)
static int _rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h, int safe) static int _rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h, int safe)
{ {
int err = 0; int err = 0;
preempt_disable(); struct msr_info rv;
if (smp_processor_id() == cpu)
if (safe) rv.msr_no = msr_no;
err = rdmsr_safe(msr_no, l, h); if (safe) {
else smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 0, 1);
rdmsr(msr_no, *l, *h); err = rv.err;
else { } else {
struct msr_info rv; smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 0, 1);
rv.msr_no = msr_no;
if (safe) {
smp_call_function_single(cpu, __rdmsr_safe_on_cpu,
&rv, 0, 1);
err = rv.err;
} else {
smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 0, 1);
}
*l = rv.l;
*h = rv.h;
} }
preempt_enable(); *l = rv.l;
*h = rv.h;
return err; return err;
} }
...@@ -67,27 +58,18 @@ static void __wrmsr_safe_on_cpu(void *info) ...@@ -67,27 +58,18 @@ static void __wrmsr_safe_on_cpu(void *info)
static int _wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h, int safe) static int _wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h, int safe)
{ {
int err = 0; int err = 0;
preempt_disable(); struct msr_info rv;
if (smp_processor_id() == cpu)
if (safe) rv.msr_no = msr_no;
err = wrmsr_safe(msr_no, l, h); rv.l = l;
else rv.h = h;
wrmsr(msr_no, l, h); if (safe) {
else { smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 0, 1);
struct msr_info rv; err = rv.err;
} else {
rv.msr_no = msr_no; smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 0, 1);
rv.l = l;
rv.h = h;
if (safe) {
smp_call_function_single(cpu, __wrmsr_safe_on_cpu,
&rv, 0, 1);
err = rv.err;
} else {
smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 0, 1);
}
} }
preempt_enable();
return err; return err;
} }
......
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