Subject: Re: Kernel profiling - solved? (or where, oh where has nullproc
To: Jason Thorpe <thorpej@nas.nasa.gov>
From: Michael L. Hitch <osymh@terra.oscs.montana.edu>
List: tech-kern
Date: 02/28/1999 13:36:42
On Sat, 27 Feb 1999, Jason Thorpe wrote:
> [ Can we follow this up to tech-kern next? ]
Certainly.
> The alpha witches to proc0's stack (its entire context, actually) in
> switch_exit(). proc0 _CAN'T_ be running alreay when you call switch_exit(),
> so I really don't see how there is a "2 proesses using same stack" problem.
I looked at the alpha at the time, but didn't completely understand what
it was doing. I went back and looked at it some more and have a better
idea of what it is doing now.
> Really, proc0 is FOR this.. it's the primary processor's idle context.
>
> Oh...wait... I see. "Eek." This trick mostly works other places because
> the stack isn't actually USED (i.e. no software TLB miss handler).
Aha! I now see where the mips went wrong. When the mips was switched
to use the proc0 stack, it was *resetting* the stack pointer, which then
started scribbling over the current stack frames in use by uvm_scheduler.
It should have been using the *current* stack pointer for proc0. Doing
this now allows a profiled kernel to work.
Michael