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

From: Mathieu Desnoyers
Date: Mon Jun 18 2007 - 18:05:55 EST


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

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@xxxxxxxxxx>
---
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

--
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/