[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080425155000.GA4438@elte.hu>
Date: Fri, 25 Apr 2008 17:50:00 +0200
From: Ingo Molnar <mingo@...e.hu>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Jiri Slaby <jirislaby@...il.com>,
David Miller <davem@...emloft.net>, zdenek.kabelac@...il.com,
rjw@...k.pl, paulmck@...ux.vnet.ibm.com, akpm@...ux-foundation.org,
linux-ext4@...r.kernel.org, herbert@...dor.apana.org.au,
penberg@...helsinki.fi, clameter@....com,
linux-kernel@...r.kernel.org,
Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>,
Andi Kleen <andi@...stfloor.org>, pageexec@...email.hu,
"H. Peter Anvin" <hpa@...or.com>,
Jeremy Fitzhardinge <jeremy@...p.org>
Subject: Re: [PATCH 1/1] x86: fix text_poke
* Linus Torvalds <torvalds@...ux-foundation.org> wrote:
> No. That whole code sequence is total and utter crap. It needs to be
> rewritten.
>
> It first does a BUG_ON() if it's not naturally aligned (because that
> wouldn't be atomic), and then it has code for page crossing! What a
> TOTAL PIECE OF SH*T!
>
> Hint:
> - if it's naturally aligned, it couldn't be page crossing ANYWAY
> - and if it was a page-crosser, it sure as hell couldn't be atomic!
>
> The code is just crap, crap, crap. It needs to be rewritten from
> scratch. I'll have a patch soonish.
yeah :(
it seems that this code only worked because text_poke_early() [which can
take arbitrary length and alignment] does most of the patching, it is
the real code-patching machinery that is used during early bootup - and
that's not used later on.
text_poke() itself only applies/unapplies the LOCK prefix - a single
byte. We shouldnt be doing that at all: the cost of LOCK is
insignificant (a few cycles) and most systems are SMP anyway.
any other type of code patching should use stop_machine_run(), where
every CPU is stopped with irqs disabled.
Ingo
--
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