lkml.org 
[lkml]   [2007]   [Jul]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 5/8] Text Edit Lock - Alternative code for i386 and x86_64
alternative.c can use the text edit lock to remove CPU HOTPLUG special cases.
Also used by x86_64.

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

Index: linux-2.6-lttng/arch/i386/kernel/alternative.c
===================================================================
--- linux-2.6-lttng.orig/arch/i386/kernel/alternative.c 2007-07-13 16:08:14.000000000 -0400
+++ linux-2.6-lttng/arch/i386/kernel/alternative.c 2007-07-13 16:39:26.000000000 -0400
@@ -2,8 +2,10 @@
#include <linux/sched.h>
#include <linux/spinlock.h>
#include <linux/list.h>
+#include <linux/memory.h>
#include <asm/alternative.h>
#include <asm/sections.h>
+#include <asm/cacheflush.h>

#ifdef CONFIG_HOTPLUG_CPU
static int smp_alt_once;
@@ -185,9 +187,13 @@
__FUNCTION__, a->instr, instr);
}
#endif
+ kernel_text_lock();
+ kernel_text_mark_rw((unsigned long)instr, a->instrlen);
memcpy(instr, a->replacement, a->replacementlen);
diff = a->instrlen - a->replacementlen;
nop_out(instr + a->replacementlen, diff);
+ kernel_text_unmark((unsigned long)instr, a->instrlen);
+ kernel_text_unlock();
}
}

@@ -352,6 +358,8 @@
for (p = start; p < end; p++) {
unsigned int used;

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

@@ -359,6 +367,8 @@

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

/* 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@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2007-07-14 03:29    [W:0.314 / U:13.992 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site