Subject: Re: kernel profiling..
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Michael L. Hitch <mhitch@lightning.oscs.montana.edu>
List: port-mips
Date: 02/23/1999 14:40:07
On Mon, 22 Feb 1999, Jonathan Stone wrote:

> 
> I've finally kludged kernel profiling into working.  (I've done a full
> kernel re-build with profiling turned on, and got the same binaries as
> with a non- profiling kernel._)
> 
> It turns out that if I builda both locore.o and kern_synch.o without
> profililng, profiling works. (I don t recall if all the chagnes to
> <mips/profile.h> are in the tree; the machine is off for reasons
> beyond my control.)

  The profile.h changes aren't in the tree yet.

> I double-checked that if trap.o and locore_mips3.o are built with
> profiling enabled (-pg / -DGPROF), then profillng still woriks.
> It's just locore.o and kern_synch.o

  I've been able to get a profiling kernel to run by just compiling
kern_synch.o without profiling.  My locore.o includes the profiling
code.  [My change to profile.h just allocates the additional 4 words
to the stack to save $a0-$a3.  I don't think this should really be
necessary, and feel that egcs is not generating the proper stack frames
in certain cases.  I've identified one place where egcs generates a bad
stack frame prior to the call to _mcount():  kern_siginit().]

> That strongly suggests some kind of stack-layout dependency between
> the context-switch code in kern_synch.c and locore.S. I didnt' see
> anything obvious last night, though.

  I haven't been able to see it so far, either, but will likely continue
hunting it down.

Michael