[patch 2/3] Text Edit Lock - Alternative i386

Mathieu Desnoyers
2007-06-18T22:05:55Z

[-- Attachment #1: text-edit-lock-alternative-i386.patch --]
[-- Type: text/plain, Size: 1664 bytes --]

alternative.c can use the text edit lock to remove CPU HOTPLUG special cases.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
---
arch/i386/kernel/alternative.c | 5 +++++
1 file changed, 5 insertions(+)

Index: linux-2.6-lttng/arch/i386/kernel/alternative.c
===================================================================
--- linux-2.6-lttng.orig/arch/i386/kernel/alternative.c 2007-06-18 17:38:41.000000000 -0400
+++ linux-2.6-lttng/arch/i386/kernel/alternative.c 2007-06-18 17:42:30.000000000 -0400
@@ -4,6 +4,7 @@
#include <linux/list.h>
#include <asm/alternative.h>
#include <asm/sections.h>
+#include <asm/cacheflush.h>

static int noreplace_smp = 0;
static int smp_alt_once = 0;
@@ -179,9 +180,11 @@
__FUNCTION__, a->instr, instr);
}
#endif
+ kernel_text_lock((unsigned long)instr, a->instrlen);
memcpy(instr, a->replacement, a->replacementlen);
diff = a->instrlen - a->replacementlen;
nop_out(instr + a->replacementlen, diff);
+ kernel_text_unlock((unsigned long)instr, a->instrlen);
}
}

@@ -346,6 +349,7 @@
for (p = start; p < end; p++) {
unsigned int used;

+ kernel_text_lock((unsigned long)p->instr, p->len);
used = paravirt_ops.patch(p->instrtype, p->clobbers, p->instr,
p->len);

@@ -353,6 +357,7 @@

/* Pad the rest with nops */
nop_out(p->instr + used, p->len - used);
+ kernel_text_unlock((unsigned long)p->instr, p->len);
}

/* Sync to be conservative, in case we patched following