Subject: Re: Kernel profiling - solved? (or where, oh where has nullproc gone?)
To: Jonathan Stone <jonathan@DSG.Stanford.EDU>
From: Jason Thorpe <thorpej@nas.nasa.gov>
List: tech-kern
Date: 02/27/1999 19:00:43
[ Can we follow this up to tech-kern next? ]

On Sat, 27 Feb 1999 18:43:13 -0800 
 Jonathan Stone <jonathan@DSG.Stanford.EDU> wrote:

 > I'd sooner just allocate a static USPACE-sized stack and be done with
 > it.  You never know when someone else might trip over the same problem.

I don't understand...

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.

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).

Um... I have an issue with this for multiprocessor systems, too.

Ok...

So, I think the right answer here is to create a new machdep call:

	cpu_idle_thread()

...this is for each processor's idle thread.  (proc0 for primary).

Then, instead of using proc0 for {,_uvm}scheduler(), create a process 4
for that... then have proc0 call cpu_idle_thread()...at which point
it will simply yield.  (There is where we might also put kernel entry
big spin locks for secondary processors.)

        -- Jason R. Thorpe <thorpej@nas.nasa.gov>