[Nottingham] The Wed Kernal Talk/Meeting (fwd)

James Gibbon nottingham at mailman.lug.org.uk
Wed May 14 14:54:08 2003


Here's Dave's reply re: altinstructions, which I assume didn't reach
the list (apologies if it did, I have a procmail rule which filters
out duplicate messages based on message-id so wouldn't have seen it)

------- Forwarded Message

Date:    Wed, 14 May 2003 14:14:04 +0100
From:    Dave Jones <davej@codemonkey.org.uk>
To:      James Gibbon <james.gibbon@virgin.net>
Cc:      nottingham@mailman.lug.org.uk, davej@codemonkey.org.uk
Subject: Re: [Nottingham] The Wed Kernal Talk/Meeting

On Wed, May 14, 2003 at 02:03:06PM +0000, James Gibbon wrote:

 > The single thing that sticks in my mind about Dave's excellent talk
 > is the 'altinstructions' idea, whereby, if I understand correctly,
 > a single 'one size fits all' kernel will feature alternative
 > sections of optimised code for different architectures.
 > 
 > This strikes me as being a deeply repugnant, thoroughly despicable
 > hack, frankly - imagine having kernel code which will never be used
 > taking up valuable memory.  I can only infer that the criminal who
 > came up with this idea didn't learn to program on a ZX81 like I
 > did.

The code to do the replacement, as well as the alternative instructions
is marked as __init, which means the memory it uses gets freed at boot
time anyway. Remember that "Freeing unused kernel memory: xxxKB freed"
message? That's the puppy..

The actual replacements that are happening are single instructions,
(typically prefetch instructions) that get replaced with NOPs on earlier
CPUs that have no prefetch, the K7 prefetch opcode, or the Intel
prefetch opcode.

Compiling a K7 kernel will still run faster than the 'runtime patched'
kernel due to things like it using the K7 optimised memory copy routine.
(Which won't get compiled into the generic kernel).

Runtime evaluation and throwing away of the memory copy routines is
something that we may come back in visit for 2.7.  I had it on my TODO
for 2.6, but someone distracted me with AGP.

Hope this clears things up?

		Dave


------- End of Forwarded Message