diff options
author | Masami Hiramatsu <mhiramat@redhat.com> | 2009-03-06 10:37:22 -0500 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-03-06 10:49:00 -0500 |
commit | 3945dab45aa8c89014893bfa8eb1e1661a409cef (patch) | |
tree | dff11f176f0027d8958c7176524e7a64e8711f30 /arch/x86/kernel/alternative.c | |
parent | 4460fdad85becd569f11501ad5b91814814335ff (diff) |
tracing, Text Edit Lock - SMP alternatives support
Use the mutual exclusion provided by the text edit lock in alternatives code.
Since alternative_smp_* will be called from module init code, etc,
we'd better protect it from other subsystems.
Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com>
LKML-Reference: <49B14332.9030109@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'arch/x86/kernel/alternative.c')
-rw-r--r-- | arch/x86/kernel/alternative.c | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/arch/x86/kernel/alternative.c b/arch/x86/kernel/alternative.c index 4c80f155743..092a7b8be68 100644 --- a/arch/x86/kernel/alternative.c +++ b/arch/x86/kernel/alternative.c | |||
@@ -5,6 +5,7 @@ | |||
5 | #include <linux/kprobes.h> | 5 | #include <linux/kprobes.h> |
6 | #include <linux/mm.h> | 6 | #include <linux/mm.h> |
7 | #include <linux/vmalloc.h> | 7 | #include <linux/vmalloc.h> |
8 | #include <linux/memory.h> | ||
8 | #include <asm/alternative.h> | 9 | #include <asm/alternative.h> |
9 | #include <asm/sections.h> | 10 | #include <asm/sections.h> |
10 | #include <asm/pgtable.h> | 11 | #include <asm/pgtable.h> |
@@ -226,6 +227,7 @@ static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end) | |||
226 | { | 227 | { |
227 | u8 **ptr; | 228 | u8 **ptr; |
228 | 229 | ||
230 | mutex_lock(&text_mutex); | ||
229 | for (ptr = start; ptr < end; ptr++) { | 231 | for (ptr = start; ptr < end; ptr++) { |
230 | if (*ptr < text) | 232 | if (*ptr < text) |
231 | continue; | 233 | continue; |
@@ -234,6 +236,7 @@ static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end) | |||
234 | /* turn DS segment override prefix into lock prefix */ | 236 | /* turn DS segment override prefix into lock prefix */ |
235 | text_poke(*ptr, ((unsigned char []){0xf0}), 1); | 237 | text_poke(*ptr, ((unsigned char []){0xf0}), 1); |
236 | }; | 238 | }; |
239 | mutex_unlock(&text_mutex); | ||
237 | } | 240 | } |
238 | 241 | ||
239 | static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end) | 242 | static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end) |
@@ -243,6 +246,7 @@ static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end | |||
243 | if (noreplace_smp) | 246 | if (noreplace_smp) |
244 | return; | 247 | return; |
245 | 248 | ||
249 | mutex_lock(&text_mutex); | ||
246 | for (ptr = start; ptr < end; ptr++) { | 250 | for (ptr = start; ptr < end; ptr++) { |
247 | if (*ptr < text) | 251 | if (*ptr < text) |
248 | continue; | 252 | continue; |
@@ -251,6 +255,7 @@ static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end | |||
251 | /* turn lock prefix into DS segment override prefix */ | 255 | /* turn lock prefix into DS segment override prefix */ |
252 | text_poke(*ptr, ((unsigned char []){0x3E}), 1); | 256 | text_poke(*ptr, ((unsigned char []){0x3E}), 1); |
253 | }; | 257 | }; |
258 | mutex_unlock(&text_mutex); | ||
254 | } | 259 | } |
255 | 260 | ||
256 | struct smp_alt_module { | 261 | struct smp_alt_module { |