mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-22 18:41:06 +00:00
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>
This commit is contained in:
parent
4460fdad85
commit
3945dab45a
1 changed files with 5 additions and 0 deletions
|
@ -5,6 +5,7 @@
|
||||||
#include <linux/kprobes.h>
|
#include <linux/kprobes.h>
|
||||||
#include <linux/mm.h>
|
#include <linux/mm.h>
|
||||||
#include <linux/vmalloc.h>
|
#include <linux/vmalloc.h>
|
||||||
|
#include <linux/memory.h>
|
||||||
#include <asm/alternative.h>
|
#include <asm/alternative.h>
|
||||||
#include <asm/sections.h>
|
#include <asm/sections.h>
|
||||||
#include <asm/pgtable.h>
|
#include <asm/pgtable.h>
|
||||||
|
@ -226,6 +227,7 @@ static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end)
|
||||||
{
|
{
|
||||||
u8 **ptr;
|
u8 **ptr;
|
||||||
|
|
||||||
|
mutex_lock(&text_mutex);
|
||||||
for (ptr = start; ptr < end; ptr++) {
|
for (ptr = start; ptr < end; ptr++) {
|
||||||
if (*ptr < text)
|
if (*ptr < text)
|
||||||
continue;
|
continue;
|
||||||
|
@ -234,6 +236,7 @@ static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end)
|
||||||
/* turn DS segment override prefix into lock prefix */
|
/* turn DS segment override prefix into lock prefix */
|
||||||
text_poke(*ptr, ((unsigned char []){0xf0}), 1);
|
text_poke(*ptr, ((unsigned char []){0xf0}), 1);
|
||||||
};
|
};
|
||||||
|
mutex_unlock(&text_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end)
|
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
|
||||||
if (noreplace_smp)
|
if (noreplace_smp)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
mutex_lock(&text_mutex);
|
||||||
for (ptr = start; ptr < end; ptr++) {
|
for (ptr = start; ptr < end; ptr++) {
|
||||||
if (*ptr < text)
|
if (*ptr < text)
|
||||||
continue;
|
continue;
|
||||||
|
@ -251,6 +255,7 @@ static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end
|
||||||
/* turn lock prefix into DS segment override prefix */
|
/* turn lock prefix into DS segment override prefix */
|
||||||
text_poke(*ptr, ((unsigned char []){0x3E}), 1);
|
text_poke(*ptr, ((unsigned char []){0x3E}), 1);
|
||||||
};
|
};
|
||||||
|
mutex_unlock(&text_mutex);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct smp_alt_module {
|
struct smp_alt_module {
|
||||||
|
|
Loading…
Reference in a new issue