Subject: Re: more funky stuff with kthreads and interrupts
To: Rafal Boni <rafal.boni@eDial.com>
From: Michael L. Hitch <mhitch@lightning.msu.montana.edu>
List: port-mips
Date: 05/01/2001 21:19:41
On Tue, 1 May 2001, Rafal Boni wrote:

> In message <Pine.ULT.4.05.10105011101210.6393-100000@lightning.msu.montana.edu>
> , Michael Hitch writes: 
> 
> -> On Tue, 1 May 2001, Toru Nishimura wrote:
> -> 
> -> > It's worthwhile of printf()ing SR value when kthread gets assigned the
> -> > very first timeslice.
...
> -> root file system type: ffs
> -> Reaper started with SPL 00000001
> -> Ioflush started with IPL 00000001
> -> init: copying out path `/sbin/init' 11
> 
> I seem to recall the same happening on the SGI, which is why I sent the 
> patch to specifically set the IPL in cpu_fork() a while ago.  However, 
> once I was convinced that proc0's IPL was being set by the MD code, I
> dropped the issue.  I'll have to go double-check it.

  I now see what is happening.  On the pmax, the initial SR value is
initialized in the pcb before calling main().  However, the kernel has
called tsleep() at least once prior to forking any kthread processes,
and tsleep() results in cpu_switch() being called at a non-zero SPL.
Cpu_switch() saves the current SR in the current pcb - oops.

  I can't think of any way to fix this other than setting the SR in
cpu_fork().  I don't know that the implications of that are for the
non-kthread processes, since I think it results in running proc_trampoline
with SPL0.  One possibility might be to only set SPL0 when the parent
process is proc0.

--
Michael L. Hitch			mhitch@montana.edu
Computer Consultant
Information Technology Center
Montana State University	Bozeman, MT	USA