diff options
author | Avi Kivity <avi@qumranet.com> | 2007-10-17 12:04:38 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@inhelltoy.tec.linutronix.de> | 2007-10-17 14:16:20 -0400 |
commit | 5f1f935ca4e385444c07164cf43dfdfe5eeee006 (patch) | |
tree | 3693d9e1cee6b917a507bd96332c1464b96cdab1 /arch | |
parent | 4a40cb1ec68d021125e37a69a0be79dc16dd41b1 (diff) |
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: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andi Kleen <ak@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/x86/lib/msr-on-cpu.c | 62 |
1 files changed, 22 insertions, 40 deletions
diff --git a/arch/x86/lib/msr-on-cpu.c b/arch/x86/lib/msr-on-cpu.c index 7767962f25d3..57d043fa893e 100644 --- a/arch/x86/lib/msr-on-cpu.c +++ b/arch/x86/lib/msr-on-cpu.c | |||
@@ -26,27 +26,18 @@ static void __rdmsr_safe_on_cpu(void *info) | |||
26 | static int _rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h, int safe) | 26 | static int _rdmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 *l, u32 *h, int safe) |
27 | { | 27 | { |
28 | int err = 0; | 28 | int err = 0; |
29 | preempt_disable(); | 29 | struct msr_info rv; |
30 | if (smp_processor_id() == cpu) | 30 | |
31 | if (safe) | 31 | rv.msr_no = msr_no; |
32 | err = rdmsr_safe(msr_no, l, h); | 32 | if (safe) { |
33 | else | 33 | smp_call_function_single(cpu, __rdmsr_safe_on_cpu, &rv, 0, 1); |
34 | rdmsr(msr_no, *l, *h); | 34 | err = rv.err; |
35 | else { | 35 | } else { |
36 | struct msr_info rv; | 36 | smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 0, 1); |
37 | |||
38 | rv.msr_no = msr_no; | ||
39 | if (safe) { | ||
40 | smp_call_function_single(cpu, __rdmsr_safe_on_cpu, | ||
41 | &rv, 0, 1); | ||
42 | err = rv.err; | ||
43 | } else { | ||
44 | smp_call_function_single(cpu, __rdmsr_on_cpu, &rv, 0, 1); | ||
45 | } | ||
46 | *l = rv.l; | ||
47 | *h = rv.h; | ||
48 | } | 37 | } |
49 | preempt_enable(); | 38 | *l = rv.l; |
39 | *h = rv.h; | ||
40 | |||
50 | return err; | 41 | return err; |
51 | } | 42 | } |
52 | 43 | ||
@@ -67,27 +58,18 @@ static void __wrmsr_safe_on_cpu(void *info) | |||
67 | static int _wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h, int safe) | 58 | static int _wrmsr_on_cpu(unsigned int cpu, u32 msr_no, u32 l, u32 h, int safe) |
68 | { | 59 | { |
69 | int err = 0; | 60 | int err = 0; |
70 | preempt_disable(); | 61 | struct msr_info rv; |
71 | if (smp_processor_id() == cpu) | 62 | |
72 | if (safe) | 63 | rv.msr_no = msr_no; |
73 | err = wrmsr_safe(msr_no, l, h); | 64 | rv.l = l; |
74 | else | 65 | rv.h = h; |
75 | wrmsr(msr_no, l, h); | 66 | if (safe) { |
76 | else { | 67 | smp_call_function_single(cpu, __wrmsr_safe_on_cpu, &rv, 0, 1); |
77 | struct msr_info rv; | 68 | err = rv.err; |
78 | 69 | } else { | |
79 | rv.msr_no = msr_no; | 70 | smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 0, 1); |
80 | rv.l = l; | ||
81 | rv.h = h; | ||
82 | if (safe) { | ||
83 | smp_call_function_single(cpu, __wrmsr_safe_on_cpu, | ||
84 | &rv, 0, 1); | ||
85 | err = rv.err; | ||
86 | } else { | ||
87 | smp_call_function_single(cpu, __wrmsr_on_cpu, &rv, 0, 1); | ||
88 | } | ||
89 | } | 71 | } |
90 | preempt_enable(); | 72 | |
91 | return err; | 73 | return err; |
92 | } | 74 | } |
93 | 75 | ||