[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090306181133.GC14236@Krystal>
Date: Fri, 6 Mar 2009 13:11:33 -0500
From: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
To: Masami Hiramatsu <mhiramat@...hat.com>
Cc: Ingo Molnar <mingo@...e.hu>,
Andrew Morton <akpm@...ux-foundation.org>,
Nick Piggin <npiggin@...e.de>,
Steven Rostedt <rostedt@...dmis.org>,
Andi Kleen <andi@...stfloor.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Frederic Weisbecker <fweisbec@...il.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Arjan van de Ven <arjan@...radead.org>,
Rusty Russell <rusty@...tcorp.com.au>,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH -tip 3/4]Text Edit Lock - Smp alternatives support
* Masami Hiramatsu (mhiramat@...hat.com) wrote:
> 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@...hat.com>
> Cc: Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
> Cc: Ingo Molnar <mingo@...e.hu>
> ---
> arch/x86/kernel/alternative.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> Index: 2.6.29-rc7/arch/x86/kernel/alternative.c
> ===================================================================
> --- 2.6.29-rc7.orig/arch/x86/kernel/alternative.c
> +++ 2.6.29-rc7/arch/x86/kernel/alternative.c
> @@ -5,6 +5,7 @@
> #include <linux/kprobes.h>
> #include <linux/mm.h>
> #include <linux/vmalloc.h>
> +#include <linux/memory.h>
> #include <asm/alternative.h>
> #include <asm/sections.h>
> #include <asm/pgtable.h>
> @@ -226,6 +227,7 @@ static void alternatives_smp_lock(u8 **s
> {
> u8 **ptr;
>
> + mutex_lock(&text_mutex);
> for (ptr = start; ptr < end; ptr++) {
> if (*ptr < text)
> continue;
> @@ -234,6 +236,7 @@ static void alternatives_smp_lock(u8 **s
> /* turn DS segment override prefix into lock prefix */
> 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)
> @@ -243,6 +246,7 @@ static void alternatives_smp_unlock(u8 *
> if (noreplace_smp)
> return;
>
> + mutex_lock(&text_mutex);
> for (ptr = start; ptr < end; ptr++) {
> if (*ptr < text)
> continue;
> @@ -251,6 +255,7 @@ static void alternatives_smp_unlock(u8 *
> /* turn lock prefix into DS segment override prefix */
> text_poke(*ptr, ((unsigned char []){0x3E}), 1);
> };
> + mutex_unlock(&text_mutex);
And for these cases, the "alternatives_smp_lock" and
"alternatives_smp_unlock", the system is running as uniprocessor.
Therefore it's enough to disable interrupts within text_poke to make it
work correctly.
Mathieu
> }
>
> struct smp_alt_module {
> --
> Masami Hiramatsu
>
> Software Engineer
> Hitachi Computer Products (America) Inc.
> Software Solutions Division
>
> e-mail: mhiramat@...hat.com
>
--
Mathieu Desnoyers
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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists