Subject: Re: MIPS cpu_fork() runs kthreads at splhigh()
To: None <port-mips@netbsd.org>
From: Toru Nishimura <nisimura@itc.aist-nara.ac.jp>
List: port-mips
Date: 04/24/2001 13:18:28
> Folks:
>   From my quick peek at the MIPS cpu_fork() code, it looks like it
>   suffers from the same problems the Alpha and i386 cpu_fork()s did,
>   namely that it runs all kthreads at splhigh().
>
>   Attached is a patch that I believe should fix this.

The issue was spotted by Ethan Solomita, after NetBSD kernel was changed
to have kthreads for various purposes, and fixed by me.

From CVS commit log of NetBSD/pmax machdep.c;

revision 1.168
date: 2000/03/25 10:14:14;  author: nisimura;  state: Exp;  lines: +4 -3

Make sure proc0 PCB has spl0 condition in CP0 status register field.

cpu_fork() mistakenly created processes forked by proc0, including
kthreads, in splhigh condition, because [1] proc0's PCB was zero
cleared during initialization, and [2] value 0 in status register
field made processes to have splhigh condition when CPU tick was
assigned for them.  This mostly doesn't matter as forked processes
dive immediately into user mode through proc_trampoline code path,
however, kthreads never do that and remain in splhigh.

Reported by Ethan Solomita <ethan@geocast.com>.
--