Subject: Re: Optimized kernel for PB520
To: Frederick Bruckman <fredb@immanent.net>
From: Joe Laffey <joe@laffeycomputer.com>
List: port-mac68k
Date: 11/29/2004 08:33:14
On Mon, 29 Nov 2004, Frederick Bruckman wrote:

> In article <Pine.NEB.4.61.0411281228490.18889@phenotype.laffeycomputer.com>,
> 	joe@laffeycomputer.com (Joe Laffey) writes:
>> I am trying to build a minimalist kernel for this 520c PB with 8mb (I
>> know, buy more ram ;-)
>>
>> I was wondering....
>>
>> I should enable FPU_EMULATE, obviously, but what about FPSP? Also, can I
>> use -m68040 with -msoft-float ? I have them both in there now, but does
>> -m68040 imply having an FPU? I thought it had more to do with some
>> interger math operations that are handled with a single instruction in the
>> 040 vs the 030 and earlier.
>
> The kernel must always be built with -msoft-float (and is, if you set
> options the usual way, with "COPTS" or "CPUFLAGS"). As I understand it,
> each process's floating point context is saved in the pmap on switching
> to kernel mode, and restored when the process is run again, but there
> is no place to save kernel floating point context.  This negates much
> (all?) of the advantage of building the kernel with "-m68040", but it
> doesn't hurt. (I do it.)

OK. Including -m68040 for the heck of it, then...
>
> The most important optimization is to comment out "options M68030"
> and "options M68020", which causes some run-time case statements to
> be optimized away completely.
>

Got these.

> With a 68LC040, FPSP is doing you no good at all. That module is an
> exception to the "no floating point in kernel". It consists of 68040
> floating points instructions, supplied by Motorola (as machine code)
> to exactly emulate the 68881 FP instructions.  As you don't have a
> 68040 floating point unit, the kernel should have set up the trap
> table to go into FPU_EMULATE for any FP traps, so your system never
> uses any of the FPSP code.
>

Interesting. So I should be able to comment out FPSP if I use FPU_EMULATE, 
regardless of how other binaries on the system are built then , right?

> You're lucky that FPU_EMULATE works at all; many LC040's are broken
> in some way which makes it impossible to emulate FP correctly.  Even
> so, you'll probably get better performance if you build all binaries
> with "-msoft-float"--in which case you won't even need FPU_EMULATE--as
> that saves the overhead of a "trap".  If you do that, you'll also save
> the kernel memory that FPU_EMULATE uses.  You could update to a
> soft-float snapshot from within NetBSD, using "tar -C / -xzpf ...".
> If it's a current snapshot, don't forget to update the kernel first.

I am currently running the kernel and userland built with soft-float from 
ftp.ziaspace.com (RC5). Since this machine has only 8 megs I am trying to 
build a much more optimzed and smaller kernel. I removed all extra scsi 
drivers, network drivers, etc. I got rid of older COMPAT setting I don't 
needs, etc. Basically, I stripped the kernel down to the bare bones for 
this system (which is what I frequently do when building kernels for any 
architecture. But while I normally leave a few things in for expansion, 
here I am taking it all out.) My hope is to get another meg or so of 
useable ram. (not-used by the kernel). This should give me enough memory 
for the ONE prupose this box will be used for.

I guess I shall find out. If this fails to do it then I will find some ore 
RAM. I looked on ebay right after someone suggested it, but there was 
nothing available when I looked. I may snag something from memoryx.com, 
but I really don't want to spend more than about $20-30 on this. The 
machine is just too old to "invest" in. ;-)

That's the beauty of NetBSD. You can run it on old junk and it works like 
a charm ;-) (It works awesome on new hardware, as we use it for our primar 
servers as well.)

Thanks,

--
Joe Laffey                |        Visual Effects for Film and Video
LAFFEY Computer Imaging   |        ---------------------------------
St. Louis, MO             |        Show Reel at http://LAFFEY.tv/?s
USA                       |        ---------------------------------
--------------------------------------------------------------------------
Mail here will be rejected --> "Real Trap" <r_trap@laffeycomputer.com>